Commit 1d08185
fix(sqlite): stop SqliteAiVectorStorage.putBulk deadlocking on its own chain slot
`guardedWrite` (added with withConnectionTransaction) routes every public
write through `runOnConnection`, but `SqliteAiVectorStorage._putBulkInternal`
had taken the shared connection-chain slot itself since before anything above
it did. `putBulk` therefore took the slot twice on one handle: the inner
`runOnConnection` awaits the outer's promise, which only resolves once the
inner returns.
The `finally` never runs, so `state.chain` is left unresolved and the handle
is poisoned for every later write on it — which is why the suite's `afterEach`
`deleteAll()` timed out alongside the three `putBulk` tests.
The parent `SqliteTabularStorage._putBulkInternal` does not re-take the chain;
this restores that symmetry. Both entry paths already hold the slot: the public
`putBulk` via `guardedWrite`, and a call arriving through the `tx` proxy runs
inside the transaction that holds it — which is why the removed branch was
reachable only from the deadlocking path. `runVectorPutBulkOnHandle` still
reads `db.inTransaction` to decide whether to open its own `db.transaction`,
so SQLite transaction nesting is unchanged.
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 9e3dee6 commit 1d08185
1 file changed
Lines changed: 4 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| |||
487 | 486 | | |
488 | 487 | | |
489 | 488 | | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
501 | 493 | | |
502 | 494 | | |
503 | 495 | | |
| |||
0 commit comments