Repository navigation
Fix project corruption (backport of #11378) - #11714
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 367439df9cc4ebac16104b3771a08fad30fa5101 and 53585110bef72656df7391e61b2d1deb40282e25. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review. 📝 WalkthroughWalkthroughProject database closing now performs a final truncating WAL checkpoint. Checkpoint retries continue after failures and limit repeated warnings. Project transactions use a dedicated mutex. Compaction flushes database files before rename. Blob read failures are reported during loading, which rejects read-only databases. Waveblock XML now stores sample counts in a Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🟡 Moderate · up to During project close, delayed checkpoint-failure handling can race project destruction because the callback does not retain the project after checking its reference; this could cause a crash or corrupted close path, so the issue should be fixed or explicitly accepted before merge. Sequence Diagram(s)sequenceDiagram
participant CheckpointThread
participant SQLite
participant ProjectCallback
CheckpointThread->>SQLite: execute checkpoint
SQLite-->>CheckpointThread: return success or failure
CheckpointThread->>ProjectCallback: notify the first failure when valid
CheckpointThread->>SQLite: retry after failure
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Warning Review ran into problems🔥 ProblemsLinked repositories: Public OSS repositories can only analyze public repositories installed in this organization. No linked repositories were analyzed; skipped Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 9ae7ebe6-8731-4eb5-9766-b0caff170e8a
📥 Commits
Reviewing files that changed from the base of the PR and between c90c052 and 367439df9cc4ebac16104b3771a08fad30fa5101.
📒 Files selected for processing (5)
libraries/lib-project-file-io/DBConnection.cpplibraries/lib-project-file-io/DBConnection.hlibraries/lib-project-file-io/ProjectFileIO.cpplibraries/lib-project-file-io/SqliteSampleBlock.cpplibraries/lib-wave-track/Sequence.cpp
Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review.
5358511 to
313bf4d
Compare
When opening a dirty project the loaded doc is an "autosave" that the user could reject and rollback to the last saved one. If we delete orphans now we may delete blocks that are referenced by the saved project, and this will cause a corruption: audacity#11359 Orphans will be removed on close anyway Backport of ac65627 (audacity#11378)
NOTE: This is a speculation, and might be not the case. A scenario: - AudioThread/: User is recording an audio, new Block audacity#500 is created - MainThread: starts autosaving, updates project doc and opens TransactionScope - AudioThread: New audio block 501 gets into block list, it gets into the current transaction, and AudioThread thinks it is saved - MainThread: gets an error (out of disk?), and Transaction is rolled back, including block 501 - Sequence still holds reference to block 501, even though it was never stored This mutex prevents simultaneous doc and sample write to the database Backport of 8890bb5 (audacity#11378)
Also explicitly checkpoint on close Backport of 00479c0 (audacity#11378)
Length value is used during project recovery only, not used during normal operations Backport of aacedf2 (audacity#11378)
313bf4d to
43bf263
Compare
This may resolve these issues, but we can't reproduce them. We will keep the issues open for now to improve discoverability if more reports come in:
Might fix: #8319, #11244
This pr is a backport of #11378
Changes:
Recommended:
QA: