Closed webcarrot closed 1 year ago
I also noticed some segmentation fault errors during unit test runs.
They are quite strange - I will try to debug them.
import { App } from 'uWebSockets.js';
const server = App();
const PORT = 8080;
server.get('/*', (res, req) => {
console.log('Req start');
res.onAborted(() => {
console.log('Aborted');
});
setImmediate(() => {
res.cork(() => {
res.writeStatus('200 OK');
res.writeHeader('content-type', 'application/octet-stream');
res.end(Buffer.allocUnsafe(16388));
console.log('Req end');
});
});
});
server.listen(PORT, () => {
console.log(`Start on: ${PORT}`);
});
console.log(`Please open http://127.0.0.1:${PORT}/`);
Start on: 8080
Please open http://127.0.0.1:8080/
Req start
Req end
[1] 74109 segmentation fault node test.mjs
Looks like from now we should just wrap everything with res.cork
? 🙄 :
server.get('/*', (res, req) => {
res.cork(() => {
console.log('Req start');
res.onAborted(() => {
console.log('Aborted');
});
setImmediate(() => {
res.writeStatus('200 OK');
res.writeHeader('content-type', 'application/octet-stream');
res.end(Buffer.allocUnsafe(16388));
console.log('Req end');
});
});
});
What Node.js version has the problems? Nothing should have changed for older Node.js versions. Can you confirm that only Node.js 20 has the problems?
Node v18.16.0
Also in v16.15.0 and v20.0.0
Is this crash new for v20.22 or did it exit in prior versions?
Ah okay I can reproduce the crash from v20.21.0 and forwards but not before. So something broke recently
Should be fixed in next release, waiting for CI
Confirmed fixed, thanks for reporting. Will release any time now
package.json
provided byv20.22.0
looks like: