Repository navigation
fix(sql-mssql): keep interrupted requests leased until Tedious settles them - #9636
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 62e05af The changes in this PR will be included in the next version bump. This PR includes changesets to release 33 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
effect-bot
force-pushed
the
v4/next-minor
branch
3 times, most recently
from
October 20, 2026 22:44
467e08d to
616dac1
Compare
tim-smart
force-pushed
the
agent/nelson/c1d55c9e5b7b
branch
from
October 20, 2026 23:00
992fbbc to
48ef9e6
Compare
tim-smart
enabled auto-merge (squash)
October 20, 2026 23:02
effect-bot
force-pushed
the
v4/next-minor
branch
from
October 20, 2026 23:03
616dac1 to
3988d0b
Compare
tim-smart
disabled auto-merge
October 20, 2026 23:04
Contributor
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
effect-bot
force-pushed
the
v4/next-minor
branch
2 times, most recently
from
October 20, 2026 23:19
2988dfb to
3d6518f
Compare
effect-bot
force-pushed
the
agent/nelson/c1d55c9e5b7b
branch
from
October 20, 2026 23:20
48ef9e6 to
62e05af
Compare
tim-smart
enabled auto-merge (squash)
October 20, 2026 23:23
Merged
effect-bot
added a commit
that referenced
this pull request
Oct 21, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
tim-smart
added a commit
that referenced
this pull request
Oct 21, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
to devangpratap/effect
that referenced
this pull request
Oct 21, 2026
…s them (Effect-TS#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
tim-smart
added a commit
that referenced
this pull request
Oct 21, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 21, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
to lloydrichards/open_effect
that referenced
this pull request
Oct 21, 2026
…s them (Effect-TS#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 21, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
to lloydrichards/open_effect
that referenced
this pull request
Oct 21, 2026
…s them (Effect-TS#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
tim-smart
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
tim-smart
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
tim-smart
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
effect-bot
added a commit
that referenced
this pull request
Oct 22, 2026
…s them (#9636) Co-authored-by: Effect Bot <tech-ops@effectful.co>
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.
Interrupting an MSSQL query released its connection back to the pool as soon as
conn.cancel()returned. Tedious is still inSentClientRequestat that point and only goes back toLoggedInonce the server acknowledges the attention. So the next borrower failed withEINVALIDSTATE: Requests can only be made in the LoggedIn state, not the SentClientRequest state. This is the intermittent failure in thePersistedQueue SQL claimstests: a lock-refreshUPDATEinterrupted at scope shutdown left its connection busy for the next test's migration query.Queries and stored procedures now go through one helper. On interruption it cancels the request and waits for the Tedious request callback before the cleanup finishes, so the lease is held until the connection is idle. Tedious calls that callback on every terminal path: normal completion, cancel acknowledgement (
ECANCEL), cancel timeout (socket error, connection goes toFinal) and close (ECLOSE). A cancel that never gets acknowledged is therefore bounded bycancelTimeout, and the ended connection is discarded by the existingacquireConnectionlatch. Theconn.cancel()before eachexecSql/callProcedureis removed. It was a no-op on an idle connection and couldn't drain a busy one.Transactions are covered as well.
begin/commit/rollbackalready run uninterruptibly, and an interrupted statement insidewithTransactionnow settles beforeROLLBACKruns. Before this change theROLLBACKitself failed withEINVALIDSTATEand became a defect, which left an open transaction on a pooled connection.Commits
test(sql-mssql): reproduce busy connection reuse after interruptionis the tests-only regression from test(sql-mssql): reproduce connection reuse before cancellation completes #9630, cherry-picked unchanged onto the currentv4/next-minor.fix(sql-mssql): ...contains the runtime change. It also updates the Tedious mock inClient.test.tssocancel()andclose()call the pending request back the way Tedious does. The old mock dropped the request silently. The cancel-timeout test now checks that interruption waits for the connection to end.Validation (local, real SQL Server 2022 via testcontainers)
Cancellation.integration.test.tsfails withEINVALIDSTATEwithout the fix and passes with it, on Node and on Bun 1.3.13 (CI pins 1.4.0).Client.test.ts: 22/22 on Node (5 repeated runs) and on Bun.Persistence.integration.test.ts: 35/35 on Node. On Bun, the 3PersistedQueue SQL claimstests pass.withTransactionrolls back cleanly (no rows,@@TRANCOUNT0, no defect), an interrupted stored procedure leaves the connection reusable, and 25 interrupt/query cycles on a one-connection pool succeed. All three fail without the fix.pnpm lint-fixandpnpm checkpass.KeyValueStore.integration.test.tsandSqlEventLogServerEncrypted.integration.test.tswere not validated locally. The shared host was overloaded (load around 20 on 8 cores) and their container setup hooks timed out before any test ran. The full Bun run ofPersistence.integration.test.tshit the same container-start timeout outside the claims block. CI will cover these.Closes EFF-2604