René's URL Explorer Experiment


Title: sqlite: backup() rejects with "not an error" when its first step returns SQLITE_BUSY or SQLITE_LOCKED · Issue #66760 · nodejs/node · GitHub

Open Graph Title: sqlite: backup() rejects with "not an error" when its first step returns SQLITE_BUSY or SQLITE_LOCKED · Issue #66760 · nodejs/node

X Title: sqlite: backup() rejects with "not an error" when its first step returns SQLITE_BUSY or SQLITE_LOCKED · Issue #66760 · nodejs/node

Description: Version v22.22.1, v24.21.0 Platform Darwin 27.0.0 arm64 Subsystem sqlite What steps will reproduce the bug? Run this script as node repro.mjs, then as node repro.mjs --no-overlap: import { DatabaseSync, backup } from "node:sqlite"; impor...

Open Graph Description: Version v22.22.1, v24.21.0 Platform Darwin 27.0.0 arm64 Subsystem sqlite What steps will reproduce the bug? Run this script as node repro.mjs, then as node repro.mjs --no-overlap: import { Database...

X Description: Version v22.22.1, v24.21.0 Platform Darwin 27.0.0 arm64 Subsystem sqlite What steps will reproduce the bug? Run this script as node repro.mjs, then as node repro.mjs --no-overlap: import { Database...

Opengraph URL: https://github.com/nodejs/node/issues/66760

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"sqlite: backup() rejects with \"not an error\" when its first step returns SQLITE_BUSY or SQLITE_LOCKED","articleBody":"### Version\n\nv22.22.1, v24.21.0\n\n### Platform\n\n```text\nDarwin 27.0.0 arm64\n```\n\n### Subsystem\n\nsqlite\n\n### What steps will reproduce the bug?\n\nRun this script as `node repro.mjs`, then as `node repro.mjs --no-overlap`:\n\n```js\nimport { DatabaseSync, backup } from \"node:sqlite\";\nimport fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\nconst dir = fs.mkdtempSync(path.join(os.tmpdir(), \"sqlite-backup-\"));\nconst db = new DatabaseSync(path.join(dir, \"src.db\"));\ndb.exec(\"PRAGMA journal_mode = WAL; CREATE TABLE t (x BLOB)\");\nconst insert = db.prepare(\"INSERT INTO t VALUES (randomblob(4000))\");\nfor (let i = 0; i \u003c 300; i++) insert.run();\n\nconst overlap = process.argv[2] !== \"--no-overlap\";\nconst results = {};\nfor (let i = 0; i \u003c 20; i++) {\n  let job;\n  if (overlap) {\n    // Keep a write transaction open briefly so the backup worker can attempt its first step.\n    db.exec(\"BEGIN IMMEDIATE\");\n    insert.run();\n    job = backup(db, path.join(dir, `copy-${i}.db`));\n    const until = Date.now() + 30;\n    while (Date.now() \u003c until);\n    db.exec(\"COMMIT\");\n  } else {\n    job = backup(db, path.join(dir, `copy-${i}.db`));\n  }\n  try {\n    await job;\n    results.ok = (results.ok ?? 0) + 1;\n  } catch (e) {\n    const key = `${e.code} errcode=${e.errcode} message=${JSON.stringify(e.message)}`;\n    results[key] = (results[key] ?? 0) + 1;\n  }\n}\nconsole.log(process.version, overlap ? \"overlap\" : \"no overlap\", results);\ndb.close();\nfs.rmSync(dir, { recursive: true, force: true });\n```\n\n### How often does it reproduce? Is there a required condition?\n\nIn my tests on each version above, all 20 backups failed with overlap enabled, and all 20 succeeded with `--no-overlap`. The reproducer holds a write transaction open on the same source connection for 30 ms after starting the backup. Reproduction depends on the worker attempting its first step during that interval.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nThe backup should reschedule a first step that returns `SQLITE_BUSY` or `SQLITE_LOCKED`, just as it reschedules later steps when pages remain, allowing it to finish after the write transaction commits. `SQLITE_BUSY` and `SQLITE_LOCKED` from `sqlite3_backup_step()` are retryable according to the SQLite documentation. If Node does reject, the error should carry the real result code (5 or 6), not 0.\n\n### What do you see instead?\n\n```text\nv22.22.1 overlap { 'ERR_SQLITE_ERROR errcode=0 message=\"not an error\"': 20 }\nv22.22.1 no overlap { ok: 20 }\nv24.21.0 overlap { 'ERR_SQLITE_ERROR errcode=0 message=\"not an error\"': 20 }\nv24.21.0 no overlap { ok: 20 }\n```\n\nThe promise rejects with `ERR_SQLITE_ERROR`, `errcode: 0` and the message \"not an error\".\n\n### Additional information\n\nThe cause appears to be in `BackupJob::AfterThreadPoolWork` in `src/node_sqlite.cc` (the same logic is on `main`):\n\n1. A step result of `SQLITE_BUSY` or `SQLITE_LOCKED` is not treated as an error at first.\n2. The job is rescheduled only when `sqlite3_backup_remaining()` is non-zero. The count starts at 0 and can remain 0 when the first step returns `SQLITE_BUSY` or `SQLITE_LOCKED` before updating it.\n3. So when the first step returns `SQLITE_BUSY` or `SQLITE_LOCKED`, the job is not rescheduled. Because the status is not `SQLITE_DONE`, `HandleBackupError(resolver)` runs. It builds the error from the destination connection, which has no error, so the result is errcode 0, \"not an error\".\n\nA possible fix: reschedule the work whenever the step returned `SQLITE_BUSY` or `SQLITE_LOCKED`, whatever the remaining page count. If the final `backup_status_ != SQLITE_DONE` rejection path is retained, pass `backup_status_` to `HandleBackupError` there, as the earlier fatal-error branch already does.\n\nA possible workaround for this failure is to retry the backup after the overlapping write transaction ends, using a bounded retry policy and checking for both `code === 'ERR_SQLITE_ERROR'` and `errcode === 0`.\n","author":{"url":"https://github.com/EminUZUN","@type":"Person","name":"EminUZUN"},"datePublished":"2026-10-15T13:34:17Z","url":"https://github.com/nodejs/node/issues/66760"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:e2bd7d27-a3c7-4c7c-d698-b2a6db9c814c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE226:1E45AC:5E1B01:7A49CF:6AED2AC3
html-safe-noncef6588b2cd169f733c3d5eb3ff09e967a8f3c3a3a321cc55f8d6fa850059b2891
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMjI2OjFFNDVBQzo1RTFCMDE6N0E0OUNGOjZBRUQyQUMzIiwidmlzaXRvcl9pZCI6IjU1MjY3Mzg5OTAyOTY1NDE4OTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacd73c023c3c88de55bdc4c748b17d2f172dca820361eef1219adf573d292415cf
hovercard-subject-tagissue:5867145870
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/66760/issue_layout
twitter:imagehttps://opengraph.githubassets.com/a8c48cd71d7271c1e3bd5daba99edf6ebe672c882245e008b6d862c4988bc0c2/nodejs/node/issues/66760
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/a8c48cd71d7271c1e3bd5daba99edf6ebe672c882245e008b6d862c4988bc0c2/nodejs/node/issues/66760
og:image:altVersion v22.22.1, v24.21.0 Platform Darwin 27.0.0 arm64 Subsystem sqlite What steps will reproduce the bug? Run this script as node repro.mjs, then as node repro.mjs --no-overlap: import { Database...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameEminUZUN
hostnamegithub.com
expected-hostnamegithub.com
None9d95365dda0576efe9b71f45807595e396bd0ca9286fba5367a05048e6ddf8f2
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release98b41fa4b5635ceb45a4c54320fced73817ff290
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/66760#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F66760
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F66760
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/66760
Reloadhttps://github.com/nodejs/node/issues/66760
Reloadhttps://github.com/nodejs/node/issues/66760
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues656 (656)https://github.com/nodejs/node/issues
Pull requests666 (666)https://github.com/nodejs/node/pulls
Actionshttps://github.com/nodejs/node/actions
Projectshttps://github.com/nodejs/node/projects
Security and qualityhttps://github.com/nodejs/node/security
Insightshttps://github.com/nodejs/node/pulse
https://github.com/nodejs/node
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/66760
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/66760
#66769https://github.com/nodejs/node/pull/66769
sqlite: backup() rejects with "not an error" when its first step returns SQLITE_BUSY or SQLITE_LOCKEDhttps://github.com/nodejs/node/issues/66760#top
#66769https://github.com/nodejs/node/pull/66769
https://github.com/EminUZUN
EminUZUNhttps://github.com/EminUZUN
on Oct 15, 2026https://github.com/nodejs/node/issues/66760#issue-5867145870
livisityhttps://github.com/livisity
on Oct 21, 2026https://github.com/nodejs/node/issues/66760#event-33878213533
fix(cursor-cli): 修复 Cursor 对话 Fork 失败(运行中 Turn、Node 26 快照卡住、路径大小写) (B…https://github.com/livisity/codex-host/commit/8e649285e01fa490944a97e88db3234dd29b0350
B…https://github.com/BytePioneer-AI/codex-host/pull/573
8e64928https://github.com/livisity/codex-host/commit/8e649285e01fa490944a97e88db3234dd29b0350
nodejs-github-bothttps://github.com/nodejs-github-bot
completedhttps://github.com/nodejs/node/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#66769https://github.com/nodejs/node/pull/66769
on Oct 25, 2026https://github.com/nodejs/node/issues/66760#event-34210603035
nodejs-github-bothttps://github.com/nodejs-github-bot
on Oct 25, 2026https://github.com/nodejs/node/issues/66760#event-34210603133
sqlite: retry busy or locked backup stepshttps://github.com/nodejs/node/commit/d630b5d88bc19c10443b3d83b723b7b052fa0c7f
d630b5dhttps://github.com/nodejs/node/commit/d630b5d88bc19c10443b3d83b723b7b052fa0c7f
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/66760
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/66760
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.