https/http2: random crashes on macOS with simple server #34854
Closed
Description
- Version: v14.8.0
- Platform: macOS 10.15.6
- Subsystem: http2, https
What steps will reproduce the bug?
const cert = `-----BEGIN CERTIFICATE-----
MIIBtTCCAVugAwIBAgIUH0XFx/3Z45cPbceJL2ROh32MaeIwCgYIKoZIzj0EAwIw
DTELMAkGA1UEAwwCc3MwIBcNMjAwODIwMTI1MDAyWhgPMjEyMDA3MjcxMjUwMDJa
MA0xCzAJBgNVBAMMAnNzMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEhWfkYTyp
AysamlBfzKnSEiudcl/c702qC55wJH/4MgFHvYBW95v8KZpVfpCBp/R+liELOZhD
UWVSsMaDjCf5NKOBljCBkzAdBgNVHQ4EFgQUm9b/hx605s6u9ndSGURgSXUKWygw
HwYDVR0jBBgwFoAUm9b/hx605s6u9ndSGURgSXUKWygwDwYDVR0TAQH/BAUwAwEB
/zANBgNVHREEBjAEggJzczAxBgNVHSUEKjAoBggrBgEFBQcDAQYIKwYBBQUHAwIG
CCsGAQUFBwMDBggrBgEFBQcDCDAKBggqhkjOPQQDAgNIADBFAiBfedlcz/vPsug6
zjsXuqldmcBLlcXJJDo/uZJaIhsuxQIhAJbNenmFGPK9yEs84QPmVQmwUQs6RSWh
nEaZwr7pmRni
-----END CERTIFICATE-----`;
const key = `-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgpI25EhAFjYbx2PB6
eYx3OWRk2AyxV8GUR2o4JpCU4xWhRANCAASFZ+RhPKkDKxqaUF/MqdISK51yX9zv
TaoLnnAkf/gyAUe9gFb3m/wpmlV+kIGn9H6WIQs5mENRZVKwxoOMJ/k0
-----END PRIVATE KEY-----`;
require("https").createServer({key, cert}, (_, res) => {
res.write("ok");
res.end();
}).listen(4000);
Save and run the script and in a second terminal create some load:
npx autocannon -d 5 -c 300 -p 10 https://localhost:4000
Server should consistently crash within a few seconds.
How often does it reproduce? Is there a required condition?
Every time
What is the expected behavior?
To not crash
What do you see instead?
It will crash with seemingly random crash signatures. Some examples:
node(74236,0x10a8e7dc0) malloc: Incorrect checksum for freed object 0x106920440: probably modified after being freed.
Corrupt value: 0x7b0a0d30310a0d0a
node(74236,0x10a8e7dc0) malloc: *** set a breakpoint in malloc_error_break to debug
[1] 74236 abort node try.js
node(74448,0x108606dc0) malloc: *** error for object 0x1068189fb: pointer being freed was not allocated
node(74448,0x108606dc0) malloc: *** set a breakpoint in malloc_error_break to debug
[1] 74448 abort node try.js
[1] 74410 illegal hardware instruction node try.js
[1] 74874 segmentation fault node try.js
Additional information
I don't see the crashes when using http
, only when using https
or http2
modules. Also I could not reproduce on Linux or Windows. Node was installed using Homebrew.
Crash does not happen with res.end("ok")
, only with res.write("ok"); res.end()
.
Activity