GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: retry ExecuteStatement when the connection fails before the request is sent by vuanhphung · Pull Request #598 · databricks/databricks-sql-nodejs

Conversation

@vuanhphung

@vuanhphung vuanhphung commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

Thrift ExecuteStatement is excluded from retryableThriftMethods, so any transport failure fails the query on the first attempt. Retrying it unconditionally (as the conformance spec and the reference ADBC PR do) can run an INSERT/MERGE/DDL twice. I reproduced it locally on Node 24 with the driver's own node-fetch and keep-alive agent. A connection that is closed after the peer read the full request (what the conformance proxy's close_connection does) and a stale keep-alive socket whose request was never read look exactly the same to the client: ECONNRESET "socket hang up", on a connected, reused socket, with the request fully written. So Node can't prove those requests were never delivered.

This PR retries ExecuteStatement only when the connection fails before it is established, which is the case where we can prove nothing was sent: ECONNREFUSED, ENOTFOUND, EAI_AGAIN. It uses the existing retryMaxAttempts / retriesTimeout / backoff settings. HTTP status codes and failures on a connected socket are still not retried. When retries run out, the original connection error is thrown instead of a RetryError, so callers keep the error they get today. Other methods are unchanged.

Verification:

  • New unit tests use a local server and an agent that refuses connects on demand. A refused connect is retried and succeeds. A close after the request was sent, and a 503, both surface after exactly one attempt. OpenSession is still not retried. Idempotent methods still retry. Full unit suite: 1548 passing. Lint, prettier, type-check and build are clean.
  • Live, via a local CONNECT proxy in front of the e2e warehouse:
    • Proxy down, so the connect is refused: origin/main fails in 1 ms with ECONNREFUSED. This branch retries after the 2 s backoff and returns the row.
    • Proxy forwards the ExecuteStatement bytes, then drops the tunnel before the response: both builds surface the same ECONNRESET after one attempt.
    • Thrift e2e specs (operation_error_codes, timeouts, query_parameters, proxy, iterators): 17 passing. useKernel: true SELECT 1 works.
  • Perf: the success path now builds the new policy instead of a NullRetryPolicy, about +0.2 µs per ExecuteStatement (median 88 ns vs 292 ns, 10 runs each). Loopback ExecuteStatement round-trip median: 190.5 µs (main) vs 197.7 µs (branch), within that benchmark's noise. Live ExecuteStatement median: 106.5 ms (main, 5 runs) vs 107.7 ms (branch, 6 runs).

Not addressed here:

  • The conformance scenario itself (connection closed after the request was sent) is intentionally still not retried, so the ERRORRECOV-013 Thrift xfail stays red. Retrying it needs server-side idempotency or a product decision to accept duplicate execution.
  • [sea]: the kernel not retrying a connection close on ExecuteStatement is in databricks/databricks-sql-kernel (databricks/databricks-sql-kernel#185), not in this repo.

Addresses #458

This pull request and its description were written by Isaac.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vuanhphung Isaac
fix: retry ExecuteStatement when the connection fails before the requ…
b798b84
…est is sent

ExecuteStatement was never retried on a transport failure. Retrying it
after the request may have reached the server can run a statement
twice, and Node cannot tell a connection closed after delivery apart
from a stale keep-alive socket. So retry it only on connect-phase
errors (ECONNREFUSED, ENOTFOUND, EAI_AGAIN), where no request bytes
were written, and surface the original error when retries run out.

Signed-off-by: Vu Anh Phung <[email protected]>
Co-authored-by: Isaac <[email protected]>
@vuanhphung
vuanhphung temporarily deployed to azure-prod November 11, 2026 23:35 — with GitHub Actions Inactive
@vuanhphung
vuanhphung temporarily deployed to azure-prod November 11, 2026 23:35 — with GitHub Actions Inactive
@vuanhphung
vuanhphung temporarily deployed to azure-prod November 11, 2026 23:35 — with GitHub Actions Inactive
peco-review-bot[bot]
peco-review-bot Bot approved these changes Nov 11, 2026
View reviewed changes

@peco-review-bot peco-review-bot Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No issues identified by the review bot.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

This branch was previously deployed

1 inactive deployment
azure-prod — b798b846 Deployed Nov 11, 2026 by vuanhphung via e2e-test (24.22.1, 24_22_1) #1890
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@peco-review-bot peco-review-bot[bot] peco-review-bot[bot] approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@vuanhphung
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.