fix(core): retry entire SQLite transaction on DatabaseBusy#34533
Merged
FrozenPandaz merged 1 commit intomasterfrom Feb 23, 2026
Merged
fix(core): retry entire SQLite transaction on DatabaseBusy#34533FrozenPandaz merged 1 commit intomasterfrom
FrozenPandaz merged 1 commit intomasterfrom
Conversation
Previously the retry_db_operation_when_busy macro only wrapped conn.transaction() (the BEGIN step). Operations inside the transaction and the COMMIT were not retried, causing crashes when the DB was busy during those steps. Now the entire begin-execute-commit sequence is wrapped in a single retry macro call using and_then.
Contributor
|
View your CI Pipeline Execution ↗ for commit b3a6ef2
☁️ Nx Cloud last updated this comment at |
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for nx-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
AgentEnder
approved these changes
Feb 23, 2026
FrozenPandaz
added a commit
that referenced
this pull request
Feb 26, 2026
## Current Behavior
When multiple Nx processes (task hasher, daemon, workers) access the
SQLite database concurrently, the `NxDbConnection::transaction()` method
only retries the BEGIN step using the `retry_db_operation_when_busy!`
macro. Operations executed inside the transaction and the COMMIT are not
retried, so if the database is busy during those steps, the task crashes
with:
```
Error: DB transaction operation error: SqliteFailure(Error { code: DatabaseBusy, extended_code: 5 }, Some("database is locked"))
```
This is particularly common during parallel task hashing with continuous
tasks, where `TaskDetails.recordTaskDetails()` and `RunningTasksService`
compete for write access.
## Expected Behavior
The entire transaction (begin, execute, commit) is retried as a single
unit when any step encounters a `DatabaseBusy` error. If the database is
busy during the operation or commit, the transaction is automatically
rolled back (via drop) and retried with the same exponential backoff
used everywhere else.
## Related Issue(s)
<!-- No public issue linked -->
(cherry picked from commit dd325d7)
FrozenPandaz
added a commit
that referenced
this pull request
Feb 26, 2026
## Current Behavior
When multiple Nx processes (task hasher, daemon, workers) access the
SQLite database concurrently, the `NxDbConnection::transaction()` method
only retries the BEGIN step using the `retry_db_operation_when_busy!`
macro. Operations executed inside the transaction and the COMMIT are not
retried, so if the database is busy during those steps, the task crashes
with:
```
Error: DB transaction operation error: SqliteFailure(Error { code: DatabaseBusy, extended_code: 5 }, Some("database is locked"))
```
This is particularly common during parallel task hashing with continuous
tasks, where `TaskDetails.recordTaskDetails()` and `RunningTasksService`
compete for write access.
## Expected Behavior
The entire transaction (begin, execute, commit) is retried as a single
unit when any step encounters a `DatabaseBusy` error. If the database is
busy during the operation or commit, the transaction is automatically
rolled back (via drop) and retried with the same exponential backoff
used everywhere else.
## Related Issue(s)
<!-- No public issue linked -->
(cherry picked from commit dd325d7)
Contributor
|
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Current Behavior
When multiple Nx processes (task hasher, daemon, workers) access the SQLite database concurrently, the
NxDbConnection::transaction()method only retries the BEGIN step using theretry_db_operation_when_busy!macro. Operations executed inside the transaction and the COMMIT are not retried, so if the database is busy during those steps, the task crashes with:This is particularly common during parallel task hashing with continuous tasks, where
TaskDetails.recordTaskDetails()andRunningTasksServicecompete for write access.Expected Behavior
The entire transaction (begin, execute, commit) is retried as a single unit when any step encounters a
DatabaseBusyerror. If the database is busy during the operation or commit, the transaction is automatically rolled back (via drop) and retried with the same exponential backoff used everywhere else.Related Issue(s)