René's URL Explorer Experiment


Title: Conditional writes are atomic: PUT and DELETE run under the per-resource queue and lock (#600) by melvincarvalho · Pull Request #638 · JavaScriptSolidServer/JavaScriptSolidServer · GitHub

Open Graph Title: Conditional writes are atomic: PUT and DELETE run under the per-resource queue and lock (#600) by melvincarvalho · Pull Request #638 · JavaScriptSolidServer/JavaScriptSolidServer

X Title: Conditional writes are atomic: PUT and DELETE run under the per-resource queue and lock (#600) by melvincarvalho · Pull Request #638 · JavaScriptSolidServer/JavaScriptSolidServer

Description: Fixes #600. The bug If-Match and If-None-Match on PUT and DELETE were stat, compare, write, with nothing holding the resource in between. Two writers racing with the same, still valid, ETag both passed the check and both got 2xx; the loser's body was gone. Reproduced in test/conditional-race.test.js against gh-pages, three runs out of three: exactly one 204, got 204,204,204,204,204 exactly one of DELETE/PUT succeeds, got 204/204 exactly one 201, got 201,201,201 PATCH had already been serialised (in-process queue per path, plus a ..lock file next to the resource across processes that share the data directory). PUT and DELETE were not. The fix src/handlers/resource.js: the PATCH queue-and-lock wrapper becomes serialised(storagePath, reply, fn) and PUT, DELETE and PATCH all go through it. For PUT, everything from the stat onwards (precondition check, quota reservation, write) runs inside; the cheap rejections (read-only, container PUT, content type, ACL body) stay outside. For DELETE, the stat is repeated under the lock. A writer that cannot take the lock within 30 s gets 503 with Retry-After: 1, as PATCH already did. The lock file lives next to the resource and taking it creates the parent directory, so two cases are answered before the lock to avoid leaving an empty container behind: DELETE of a missing resource is 404, and a PUT whose If-Match cannot hold because the resource is not there is 412. Tests test/conditional-race.test.js, new, six cases, all but the last failing before the fix: five racing PUTs with one If-Match: exactly one 204, four 412, and the stored body is the winner's DELETE racing PUT with the same If-Match: one 204, one 412, and the resource state matches the winner three racing If-None-Match: * creates: one 201, two 412 a failed conditional PUT into a container that does not exist creates nothing no lock sidecar is listed in the container or left on disk the same PUTs in sequence are 204 then 412, unchanged docs/security.md gets a short section, "Conditional writes are atomic". Review follow-ups (f8fff8a) Copilot: the disk lock was treated as stale after 15 s, so a write holding it longer could have had it broken by another process. The holder now touches the lock file every staleMs / 3 while it works, so a stale lock means a crashed process, not a slow one. withLock takes optional { staleMs, waitMs } for tests. Also: the in-process queue is keyed by the resolved lock path, the identity the disk lock uses; the two unlocked pre-checks carry a note on why their answers are consistent under contention (a request that finds nothing at the probe gets the answer it would have got had it run first; the check is repeated under the lock). test/withlock.test.js, new: a holder slower than the stale timeout keeps the lock and the second writer waits; a lock left by a dead holder is broken; a live lock never released ends in ELOCKED after waitMs. Copilot, second pass: two contenders could both judge a dead lock stale, the faster one break it and take a fresh lock, and the slower one then unlink that fresh lock. Pre-existing, but the PR widened its reach. breakStaleLock now moves the stale file aside with an atomic rename, compares the moved file's inode with the one observed, deletes it on a match and puts it back with link (which refuses to overwrite) on a mismatch. Test: eight contenders on a dead lock all run, never two at once, nothing left behind. Full suite on the branch: 1113 tests, 1113 pass, 0 fail.

Open Graph Description: Fixes #600. The bug If-Match and If-None-Match on PUT and DELETE were stat, compare, write, with nothing holding the resource in between. Two writers racing with the same, still valid, ETag both pa...

X Description: Fixes #600. The bug If-Match and If-None-Match on PUT and DELETE were stat, compare, write, with nothing holding the resource in between. Two writers racing with the same, still valid, ETag both pa...

Opengraph URL: https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.3

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:e717d729-693c-bc8f-31be-1d71f7ef5939
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id99DC:3AB37:835B43:AD5CFB:6B0398E2
html-safe-nonce4acb5c76e9dcbe68a6d1777513e8bb985f1aa9580fb6577c07ae8272e33a07fc
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OURDOjNBQjM3OjgzNUI0MzpBRDVDRkI6NkIwMzk4RTIiLCJ2aXNpdG9yX2lkIjoiNTI4NDYwNzQ4NTk3Njc0NjIxMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacb7ce2e0ac63a033bc0d51fb2fceada7e37f0f98897fe19a0f0fde5ae7b6d1f8b
hovercard-subject-tagpull_request:5151186359
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files
twitter:imagehttps://avatars.githubusercontent.com/u/65864?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/65864?s=400&v=4
og:image:altFixes #600. The bug If-Match and If-None-Match on PUT and DELETE were stat, compare, write, with nothing holding the resource in between. Two writers racing with the same, still valid, ETag both pa...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/JavaScriptSolidServer/JavaScriptSolidServer git https://github.com/JavaScriptSolidServer/JavaScriptSolidServer.git
octolytics-dimension-user_id205442424
octolytics-dimension-user_loginJavaScriptSolidServer
octolytics-dimension-repository_id958025407
octolytics-dimension-repository_nwoJavaScriptSolidServer/JavaScriptSolidServer
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id958025407
octolytics-dimension-repository_network_root_nwoJavaScriptSolidServer/JavaScriptSolidServer
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FJavaScriptSolidServer%2FJavaScriptSolidServer%2Fpull%2F638%2Ffiles
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%2FJavaScriptSolidServer%2FJavaScriptSolidServer%2Fpull%2F638%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=JavaScriptSolidServer%2FJavaScriptSolidServer
Reloadhttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files
Reloadhttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files
Reloadhttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files
JavaScriptSolidServerhttps://github.com/JavaScriptSolidServer
JavaScriptSolidServerhttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer
Codehttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer
Issues165 (165)https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues
Pull requests14 (14)https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pulls
Actionshttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/actions
Projectshttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/projects
Security and qualityhttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/security
Insightshttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/insights
Sign up for GitHub https://github.com/signup?return_to=%2FJavaScriptSolidServer%2FJavaScriptSolidServer%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FJavaScriptSolidServer%2FJavaScriptSolidServer%2Fissues%2Fnew%2Fchoose
melvincarvalhohttps://github.com/melvincarvalho
gh-pageshttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/tree/gh-pages
fix/600-conditional-write-lockhttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/tree/fix/600-conditional-write-lock
Conversation 4 https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638
Commits 4 https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/commits
Checks 0 https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/checks
Files changed https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files
Please reload this pagehttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files
Conditional writes are atomic: PUT and DELETE run under the per-resource queue and lock (#600) https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#top
Show all changes 4 commits https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files
4f05c44 Conditional writes are atomic: PUT and DELETE run under the per-resou… melvincarvalho Nov 4, 2026 https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/commits/4f05c44c0f5bb653e48dd5d64411cca50a50fb7f
f8fff8a Review follow-ups (#600): the lock holder heartbeats, so a slow write… melvincarvalho Nov 4, 2026 https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/commits/f8fff8ac655b66b220e782d4fac1886107932cbe
e47d44f Break a stale lock by rename and inode check, never by a blind unlink… melvincarvalho Nov 4, 2026 https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/commits/e47d44fc54e84a84de7fb080fc8654005fbfa95b
d445490 Merge remote-tracking branch 'origin/gh-pages' into fix/600-condition… melvincarvalho Nov 4, 2026 https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/commits/d4454905e62ff126771f26dc6f57ef6bdda789ae
Clear filters https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files
Please reload this pagehttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files
Please reload this pagehttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files
security.md https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-2c506cc756a5333f8fb5acb850d443980706602048f9ddb3dc515abacbfbce6a
resource.js https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-8cbec772075fe897baa646a65a10f462cfeb16773af9d25bddf0b4eeb7424aad
filesystem.js https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-2aeb4427dafb4f1584325a8b6275483ab35a386063a3b32ed64aff66ac4c223c
conditional-race.test.js https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-9b51d38d156a98b0a62955a8ca02a73161e1e404e7c0a95d45435b6a2433ff4f
withlock.test.js https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-17936544c3e4447013aee5e35c616aab78156a8a85790a3dd6a0162069914358
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/blob/gh-pages/.github/CODEOWNERS#L12
docs/security.mdhttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-2c506cc756a5333f8fb5acb850d443980706602048f9ddb3dc515abacbfbce6a
View file https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/blob/d4454905e62ff126771f26dc6f57ef6bdda789ae/docs/security.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/{{ revealButtonHref }}
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-2c506cc756a5333f8fb5acb850d443980706602048f9ddb3dc515abacbfbce6a
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-2c506cc756a5333f8fb5acb850d443980706602048f9ddb3dc515abacbfbce6a
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/blob/gh-pages/.github/CODEOWNERS#L12
src/handlers/resource.jshttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-8cbec772075fe897baa646a65a10f462cfeb16773af9d25bddf0b4eeb7424aad
View file https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/blob/d4454905e62ff126771f26dc6f57ef6bdda789ae/src/handlers/resource.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/{{ revealButtonHref }}
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-8cbec772075fe897baa646a65a10f462cfeb16773af9d25bddf0b4eeb7424aad
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-8cbec772075fe897baa646a65a10f462cfeb16773af9d25bddf0b4eeb7424aad
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-8cbec772075fe897baa646a65a10f462cfeb16773af9d25bddf0b4eeb7424aad
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-8cbec772075fe897baa646a65a10f462cfeb16773af9d25bddf0b4eeb7424aad
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-8cbec772075fe897baa646a65a10f462cfeb16773af9d25bddf0b4eeb7424aad
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-8cbec772075fe897baa646a65a10f462cfeb16773af9d25bddf0b4eeb7424aad
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-8cbec772075fe897baa646a65a10f462cfeb16773af9d25bddf0b4eeb7424aad
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-8cbec772075fe897baa646a65a10f462cfeb16773af9d25bddf0b4eeb7424aad
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/blob/gh-pages/.github/CODEOWNERS#L12
src/storage/filesystem.jshttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-2aeb4427dafb4f1584325a8b6275483ab35a386063a3b32ed64aff66ac4c223c
View file https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/blob/d4454905e62ff126771f26dc6f57ef6bdda789ae/src/storage/filesystem.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/{{ revealButtonHref }}
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-2aeb4427dafb4f1584325a8b6275483ab35a386063a3b32ed64aff66ac4c223c
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-2aeb4427dafb4f1584325a8b6275483ab35a386063a3b32ed64aff66ac4c223c
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-2aeb4427dafb4f1584325a8b6275483ab35a386063a3b32ed64aff66ac4c223c
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-2aeb4427dafb4f1584325a8b6275483ab35a386063a3b32ed64aff66ac4c223c
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/blob/gh-pages/.github/CODEOWNERS#L12
test/conditional-race.test.jshttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files#diff-9b51d38d156a98b0a62955a8ca02a73161e1e404e7c0a95d45435b6a2433ff4f
View file https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/blob/d4454905e62ff126771f26dc6f57ef6bdda789ae/test/conditional-race.test.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/{{ revealButtonHref }}
Please reload this pagehttps://github.com/JavaScriptSolidServer/JavaScriptSolidServer/pull/638/files
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

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.