oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
72.25k stars 2.58k forks source link

Chances of getting a segmentation fault at address 0xFFFFFFFFFFFFFFFF when opening a websocket (connecting to MongoDB and Discord) #10695

Open Sayrix opened 2 months ago

Sayrix commented 2 months ago

How can we reproduce the crash?

Windows 11 23H2 22631.3527 Bun 1.1.6 discord.js@14.14.1 mongodb@6.5.0

import * as Discord from "discord.js";
import { Db, MongoClient, ServerApiVersion } from "mongodb";

const client = new Discord.Client({
    intents: ["Guilds"],
    shards: "auto",
}) as Client;
const cache = new NodeCache();
const mongodb = new MongoClient(
    "mongodb+srv://URL_REDACTED/?retryWrites=true&w=majority",
    {
        serverApi: {
            version: ServerApiVersion.v1,
            strict: true,
            deprecationErrors: true,
        },
    }
);

mongodb.connect();
client.login(process.env.DISCORD_TOKEN as string);

Video of me getting the error, and sometimes not.

https://github.com/oven-sh/bun/assets/43046854/b94837f1-ee2c-49b3-b130-a6549362ed13

Relevant log output

No response

Stack Trace (bun.report)

Bun v1.1.6 (e58d67b) on windows x86_64 [AutoCommand]

Segmentation fault at address 0xFFFFFFFFFFFFFFFF

Sayrix commented 2 months ago

The bug is still here in 1.1.7

Bun v1.1.7 (b0b7db5) on windows x86_64 [AutoCommand]

Segmentation fault at address 0xFFFFFFFFFFFFFFFF


Args: "C:\Users\Sayrix\.bun\bin\bun.exe", "."
Features: jsc Bun.stdin(2) dotenv transpiler_cache(5) tsconfig(8) WebSocket(3) 
Builtins: "bun:main" "node:buffer" "node:crypto" "node:dns" "node:events" "node:fs" "node:fs/promises" "node:http" "node:net" "node:os" "node:path" "node:stream" "node:string_decoder" "node:timers" "node:timers/promises" "node:tls" "node:url" "node:util" "node:util/types" "node:zlib" "node:worker_threads" "undici" "ws" 
Elapsed: 5455ms | User: 78ms | Sys: 15ms
RSS: 0.26GB | Peak: 0.26GB | Commit: 0.32GB | Faults: 62872

panic(main thread): Segmentation fault at address 0xFFFFFFFFFFFFFFFF
oh no: Bun has crashed. This indicates a bug in Bun, not your code.```
Sayrix commented 3 weeks ago

Hi, i stopped getting the error on Bun 1.1.17 Windows 11 23H2 22631.3737 x64 but now i have it on Bun 1.1.17 Ubuntu 22.04.4 LTS aarch64

Stack Trace (bun.report)

Bun v1.1.17 (bb66bba) on linux aarch64 [AutoCommand]

Segmentation fault at address 0x0000001A

Features: jsc, Bun.stdin, fetch, http_server, transpiler_cache, tsconfig_paths, tsconfig, WebSocket