Skip to content

Retry the current user lookup and idempotent calls on EOF and Windows connection resets - #7961

Draft
denik wants to merge 2 commits into
mainfrom
retry-eof-reset
Draft

denik wants to merge 2 commits into
mainfrom
retry-eof-reset

Conversation

@denik

@denik denik commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Why

Bundle commands and file uploads fail outright when the server drops the connection in two ways the SDK does not retry:

  • Bare EOF on GET /api/2.0/preview/scim/v2/Me. This is the first API call of every bundle command (iamutil.GetCurrentUser), so one dropped connection fails the whole bundle deploy. A bare EOF (as opposed to unexpected EOF) means the server closed the connection during the TLS handshake, so the request was never sent. Over HTTP/2, Go reports a connection cut mid-request as unexpected EOF. The SDK retries neither, and GetCurrentUser only retried HTTP 500.
  • wsarecv: An existing connection was forcibly closed by the remote host on Windows. This is WSAECONNRESET. The SDK retries a reset by matching the text connection reset by peer, which only Unix uses, so on Windows a reset is not retried. It hit the overwriting upload of state/resources.json during bundle deploy.

Changes

  • retry.IsTransientRead now also matches a *url.Error that wraps io.EOF or WSAECONNRESET (syscall.Errno(10054); no Unix errno has that value). IsTransient, which non-idempotent calls use, is unchanged.
  • iamutil.GetCurrentUser now also retries the errors IsTransientRead covers, within its existing 30s bound.
  • TestGetCurrentUserRetriesOn500 set two Returns on the same mock call, so the second replaced the first and the test never saw the 500. Each attempt now has its own expectation.

Not retried, on purpose

  • POST /api/2.2/jobs/create: EOF from databricks jobs create. A bare EOF over HTTP/2 is almost certainly a failed TLS handshake (the request was never sent), but over HTTP/1.1 (e.g. behind a proxy) it can also follow a request the server already applied, and a retried create would then make a duplicate job. In bundles, the direct engine's create recovery already covers uncertain creates.
  • PUT /api/2.0/fs/files/...?overwrite=false: unexpected EOF. This is a test-setup write without overwrite: if the first attempt landed, a retry fails with "already exists", so it is not safely retriable either.

Dashboard

Over the last 7 days, 11 of the 14 error/3840 failures fell within one window on Azure (2026-11-23 18:53–20:03 UTC), alongside many unexpected EOF errors on other endpoints. The other 3 were spread over AWS, GCP and Azure.

error snippet
error/3840 (fixed) Error: Get "[DATABRICKS_URL]/api/2.0/preview/scim/v2/Me": EOF
error/174 (fixed) Error: Post "[DATABRICKS_URL]/api/2.0/workspace-files/import-file/[PATH]": read tcp <IP>-><IP>: wsarecv: An existing connection was forcibly closed by the remote host.

Tests

  • New unit cases for IsTransientRead (bare EOF, WSAECONNRESET), plus a test against a real server that closes the connection, which checks the error the SDK actually returns.
  • TestGetCurrentUserRetriesOnEOF. Both new tests fail without the fix.

This pull request and its description were written by Isaac.

… connection resets

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 8371621

Run: 45578371104

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 272 19 5:10
💚​ aws-windows-latest-4core-16gb 1 274 17 3:44
💚​ azure linux-2core-8gb 1 271 19 5:43
💚​ azure-windows-latest-4core-16gb 1 273 17 3:40
💚​ gcp linux-2core-8gb 1 272 19 4:40
💚​ gcp-windows-latest-4core-16gb 1 274 17 3:31
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 6 slowest tests (at least 2 minutes):
duration env testname
4:02 aws linux-2core-8gb TestAccept
3:57 azure linux-2core-8gb TestAccept
3:42 aws-windows-latest-4core-16gb TestAccept
3:38 azure-windows-latest-4core-16gb TestAccept
3:33 gcp linux-2core-8gb TestAccept
3:30 gcp-windows-latest-4core-16gb TestAccept

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants