https://gitlab.synchro.net/main/sbbs/-/commit/c64622440386178e4a2f3a32
Modified Files:
exec/load/xjs.js
Log Message:
xjs: fix cold-cache recompile race in xjs_compile()
Concurrent web requests on a cold .xjs.ssjs cache could observe the file mid-regeneration: it was file_remove()'d and recompiled in place, leaving
it absent for the whole compile and racing concurrent load()/js.exec()
into "Script file ... does not exist" and "creating ... No such file or directory" (errno 2) errors (seen on vert/cvs webv4: index.xjs,
components, sidebar, pages/000-home).
Compile to a unique temp file and atomically rename into place
(atomic-replace on POSIX; on Win32, where rename won't overwrite, keep an up-to-date target and discard the redundant temp). Also use strict '<'
for the staleness check so a same-second cache isn't recompiled.
Race latent since ca76b74ba9 (2012).
Co-Authored-By: Claude Opus 4.8 (1M context) <
noreply@anthropic.com>
--- SBBSecho 3.37-Linux
* Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)