Commit d5a5daf
committed
fix(chroma): release SQLite lock on cache invalidation, not just close_palace
`close_palace` already routed through `_close_client` to release chromadb's
rust-side SQLite WAL/journal lock before next open. The `_client` cache-
rebuild path (inode/mtime change OR DB-appeared-after-open) was the second
lifecycle point but did not match: it overwrote the dict slot directly,
leaving the stale handle alive until GC.
Under that branch, a concurrent reader could hit "database is locked"
mid-rebuild because the OS-level lock was still held by the previous
PersistentClient instance, even though MemPalace had stopped using it.
Now matches close_palace: `_close_client(cached)` runs before the slot
is overwritten on every invalidation path. Pinned with a test that seeds
a sentinel into `_clients`, materializes `chroma.sqlite3` to trip
`mtime_appeared`, and asserts the sentinel was passed to `_close_client`.1 parent 45df1a2 commit d5a5daf
2 files changed
Lines changed: 53 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1007 | 1007 | | |
1008 | 1008 | | |
1009 | 1009 | | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
1010 | 1019 | | |
1011 | 1020 | | |
1012 | 1021 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
318 | 362 | | |
319 | 363 | | |
320 | 364 | | |
| |||
0 commit comments