Repository navigation
fix(kernel): decode a failed async status poll into the driver error - #608
Merged
Merged
Conversation
vuanhphung
temporarily deployed
to
azure-prod
November 13, 2026 08:28 — with
GitHub Actions
Inactive
vuanhphung
temporarily deployed
to
azure-prod
November 13, 2026 08:28 — with
GitHub Actions
Inactive
vuanhphung
temporarily deployed
to
azure-prod
November 13, 2026 08:28 — with
GitHub Actions
Inactive
On a runAsync: true statement, waitUntilReady() and status() awaited the napi AsyncStatement.status() without decodeNapiKernelError, so a failed poll (for example, retries exhausted on HTTP 500) reached the caller as a raw Error whose message is the __databricks_error__:{...} envelope. Decode it like the other napi calls.
Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
… changelog scope The unit test now also checks kernelMetadata.httpStatus and the bounded cause. The changelog notes that a default execution that outlives the server's inline wait polls the same status() and was affected too, and adds the PR number. Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
vuanhphung
force-pushed
the
fix/kernel-async-status-error-mapping
branch
from
November 15, 2026 07:13
548eb21 to
720b4ed
Compare
vuanhphung
had a problem deploying
to
azure-prod
November 15, 2026 07:13 — with
GitHub Actions
Failure
vuanhphung
temporarily deployed
to
azure-prod
November 15, 2026 07:13 — with
GitHub Actions
Inactive
vuanhphung
temporarily deployed
to
azure-prod
November 15, 2026 07:13 — with
GitHub Actions
Inactive
vuanhphung
temporarily deployed
to
azure-prod
November 15, 2026 07:27 — with
GitHub Actions
Inactive
hasMore() prefetches the next batch through the napi fetchNextBatch(), so when hasMoreRows() runs before the first fetch, a failed fetch reached the caller as the raw __databricks_error__:{...} envelope. Handle it like fetchChunk(): best-effort close the wedged statement, then throw the decoded error. Both paths now share one helper.
Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
vuanhphung
temporarily deployed
to
azure-prod
November 15, 2026 07:55 — with
GitHub Actions
Inactive
vuanhphung
temporarily deployed
to
azure-prod
November 15, 2026 07:55 — with
GitHub Actions
Inactive
vuanhphung
temporarily deployed
to
azure-prod
November 15, 2026 07:55 — with
GitHub Actions
Inactive
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On the kernel backend, two calls let a failure reach the caller as a raw
Errorwhose message is the binding's internal envelope, for example__databricks_error__:{"code":"Internal","httpStatus":500,"message":"HTTP 500: Internal Server Error"}:waitUntilReady()andstatus()awaitAsyncStatement.status()directly (lib/kernel/KernelOperationBackend.ts:429,:627). This affectsrunAsync: truestatements and default executions that outlive the server's inline wait, sinceexecuteStatementDirectthen returns anAsyncStatementthat is polled the same way (lib/kernel/KernelSessionBackend.ts:259-260). The databricks-driver-test RESULTFETCH-013 SEA test (a persistent HTTP 500 on GetStatementStatus) found it.hasMore()(:357-361). WhenhasMoreRows()runs before the first fetch, it prefetches the first batch throughfetchNextBatch(), which had no error handling. That's the first call in awhile (await op.hasMoreRows())loop.The poll now goes through a
pollAsyncStatus()helper that decodes the rejection.hasMore()now handles a failure likefetchChunk(): it best-effort closes the statement, since a failed fetch leaves the napi stream unusable, then throws the decoded error. Both paths share one helper. The caller gets the mapped driver error (HiveDriverError: HTTP 500: Internal Server Error) with its boundedcause, SQLSTATE andkernelMetadata.Verification: two new unit tests in
tests/unit/kernel/execution.test.ts. The status-poll test fails onmain8ccddd0, and thehasMoreRows()test fails without thehasMore()change. Both fail withexpected Error: __databricks_error__:{"code":"Inte… to be an instance of HiveDriverErrorand pass with the fix.npm test(1774 passing),npm run lint,npm run type-checkand prettier on the changed files are clean. Live on the pecotesting warehouse (kernel 0b5d0ed), RESULTFETCH-013 [sea] (databricks/databricks-driver-test#2068) throws the envelope onmain8ccddd0. With this fix it throwsHTTP 500: Internal Server Error(3 of 3 runs, plus once more on the final head). The driver-test fetchChunk, fetchAll and iterator suites (16 tests) and the RESULTFETCH group pass on [sea].This pull request and its description were written by Isaac.