Skip to content

fix(@angular/build): add automatic corruption recovery in SQLite cache store - #34019

Merged
clydin merged 1 commit into
angular:mainfrom
clydin:fix/sqlite-cache-corruption-recovery
Sep 3, 2026
Merged

fix(@angular/build): add automatic corruption recovery in SQLite cache store#34019
clydin merged 1 commit into
angular:mainfrom
clydin:fix/sqlite-cache-corruption-recovery

Conversation

@clydin

@clydin clydin commented Sep 3, 2026

Copy link
Copy Markdown
Member

Abrupt process terminations (such as canceling a watch mode build or CI runner timeouts) can leave SQLite databases or their write-ahead logs in an inconsistent or corrupted state. Previously, corrupted database files or malformed pages caused subsequent builds to fail continuously until the cache directory was manually deleted. Additionally, uninitializable cache stores on read-only or restricted filesystems would throw errors during build initialization.

Corrupted cache files (.db, .db-wal, and .db-shm) are now automatically removed and recreated upon initialization failure. If the cache cannot be initialized or recovered (such as on read-only filesystems or due to permission errors), the cache store gracefully disables itself. Cache operations subsequently degrade cleanly to cache misses, allowing builds to proceed successfully without error.

…e store

Abrupt process terminations (such as canceling a watch mode build or CI runner timeouts) can leave SQLite databases or their write-ahead logs in an inconsistent or corrupted state. Previously, corrupted database files or malformed pages caused subsequent builds to fail continuously until the cache directory was manually deleted. Additionally, uninitializable cache stores on read-only or restricted filesystems would throw errors during build initialization.

Corrupted cache files (.db, .db-wal, and .db-shm) are now automatically removed and recreated upon initialization failure. If the cache cannot be initialized or recovered (such as on read-only filesystems or due to permission errors), the cache store gracefully disables itself. Cache operations subsequently degrade cleanly to cache misses, allowing builds to proceed successfully without error.
@clydin clydin added the target: minor This PR is targeted for the next minor release label Sep 3, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces robust error handling and recovery mechanisms to the SQLite-backed persistent cache store. It adds automatic recovery from database corruption (by deleting and recreating corrupted database files), graceful degradation when the database path is unwritable, and safe handling of locked databases. Additionally, it wraps cache operations in try-catch blocks to prevent fatal failures and introduces a configurable busy timeout. Comprehensive unit tests have been added to verify these behaviors. There are no review comments, so I have no feedback to provide.

@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Sep 3, 2026
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Sep 3, 2026
@clydin
clydin merged commit fe2f180 into angular:main Sep 3, 2026
69 of 71 checks passed
@clydin

clydin commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

This PR was merged into the repository. The changes were merged into the following branches:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants