Skip to content

[tx] Dead-thread cleanup discards transactions without rollback; explicit file locks leak forever #4941

Description

@lvca

Severity: MEDIUM

Location: DatabaseContext.java:190-195 (cleanupDeadThreads only prunes the CONTEXTS map), utility/LockManager (ownership keyed by requester with no liveness sweep / timeout), TransactionContext.java:519-530 (kill() nulls lockedFiles without unlocking).

A thread acquires an explicit lock (acquireLock().type("X").lock()), then dies from an uncaught error before commit/rollback. cleanupDeadThreads removes its context, dropping the only reference to explicitLockedFiles. The LockManager entries remain owned by the dead requester forever; every later commit touching those files times out with LockTimeoutException until restart.

Fix: in cleanupDeadThreads/removeAllContexts, roll back any active TransactionContext found (which releases locks via reset()); optionally add a dead-owner sweep to LockManager for Thread requesters.


Filed from an internal engine deep-audit (2026-07). Traced to source; verify against current main before fixing and add a regression test.

Metadata

Metadata

Assignees

Labels

auditFindings from the 2026-07 engine deep auditbugconcurrencyThreading / concurrency / MVCC

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions