You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{test}from'bun:test';test('crash',async()=>{constpublicAddress=newURL('https://1.1.1.1:3000');constsocket=newWebSocket(publicAddress.toString());// crashes -- comment this out to see the test passsocket.close();});
Environment
Bun version: 1.2.2-canary.9
OS: Linux x64 (Kernel v6.12.9)
CPU Features: sse42 popcnt avx avx2
Steps to Reproduce
Create a new file crash.test.js with the code above
Run bun test crash.test.js
Expected Behavior
The WebSocket should handle the invalid connection gracefully, either:
Throwing a network error
Failing to connect but allowing close() to be called
Returning a rejected promise
Actual Behavior
Bun crashes with a segmentation fault at address 0x0
Relevant log output
bun test v1.2.2-canary.9 (aac951bd)
bundled.crash.test.js:
============================================================
Bun Canary v1.2.2-canary.9 (aac951bd) Linux x64
Linux Kernel v6.12.9 | glibc v2.40
CPU: sse42 popcnt avx avx2
Args: "/home/awt/Downloads/cursor-0.45.8-build-250201b44xw1x2k-x86_64.AppImage""test""bundled.crash.test.js"
Features: WebSocket jsc
Elapsed: 16ms | User: 8ms | Sys: 21ms
RSS: 1.07GB | Peak: 40.28MB | Commit: 1.07GB | Faults: 0
panic(main thread): Segmentation fault at address 0x0
oh no: Bun has crashed. This indicates a bug in Bun, not your code.
To send a redacted crash report to Bun's team,please file a GitHub issue using the link below: https://bun.report/1.2.2/lt2aac951bAwggEo2rnoE+5+P27l24DigkxkE_g2qr9Dghir9Dg2qr9Dmsoj9Duk6x8EA2AA
How can we reproduce the crash?
Description
Bun crashes with a segmentation fault when attempting to close a WebSocket connection to an invalid/unreachable URL.
Minimal Reproduction
Since you insist: REPRO-REPO
Environment
Steps to Reproduce
crash.test.js
with the code abovebun test crash.test.js
Expected Behavior
The WebSocket should handle the invalid connection gracefully, either:
close()
to be calledActual Behavior
Bun crashes with a segmentation fault at address 0x0
Relevant log output
Stack Trace (bun.report)
bun.report comes up with internal server error
https://bun.report/1.2.2/lt2aac951bAwggEo2rnoE+5+P27l24DigkxkE_g2qr9Dghir9Dg2qr9Dmsoj9Duk6x8EA2AA
The text was updated successfully, but these errors were encountered: