sqlite: keep source database alive during backup#62673
Open
mcollina wants to merge 1 commit intonodejs:mainfrom
Open
sqlite: keep source database alive during backup#62673mcollina wants to merge 1 commit intonodejs:mainfrom
mcollina wants to merge 1 commit intonodejs:mainfrom
Conversation
Collaborator
|
Review requested:
|
geeksilva97
reviewed
Apr 10, 2026
Comment on lines
+344
to
+349
| if (typeof global.gc === 'function') { | ||
| for (let i = 0; i < 5; i++) { | ||
| global.gc(); | ||
| await new Promise((resolve) => setImmediate(resolve)); | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
We can add the flag at the top
// Flags: --expose_gc
Then do
Suggested change
| if (typeof global.gc === 'function') { | |
| for (let i = 0; i < 5; i++) { | |
| global.gc(); | |
| await new Promise((resolve) => setImmediate(resolve)); | |
| } | |
| } | |
| for (let i = 0; i < 5; i++) { | |
| global.gc(); | |
| await new Promise((resolve) => setImmediate(resolve)); | |
| } |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #62673 +/- ##
==========================================
+ Coverage 89.78% 89.79% +0.01%
==========================================
Files 697 699 +2
Lines 215749 216245 +496
Branches 41294 41336 +42
==========================================
+ Hits 193705 194187 +482
- Misses 14124 14141 +17
+ Partials 7920 7917 -3
🚀 New features to boost your workflow:
|
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
BackupJobheld a rawDatabaseSync*to the source. If the source lost its last JS reference during an in-flightbackup(), GC could destroy it while the job was still pending, andFinalize()would later dereference a dangling pointer viasource_->RemoveBackup(this).Switch
BackupJob::source_toBaseObjectPtr<DatabaseSync>so the source stays alive for the lifetime of the job, anddeletethe job at its terminal states (previously leaked).