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{spawn}from"bun";constcpus=navigator.hardwareConcurrency;// Number of CPU coresconstworkers=newArray(cpus);// const workers = new Array(16);for(leti=0;i<cpus;i++){workers[i]=spawn({cmd: ["bun","./src/index.ts"],stdout: "inherit",stderr: "inherit",stdin: "inherit"});}functionkill(){for(constworkerofworkers){worker.kill();}}process.on("SIGINT",kill);process.on("exit",kill);console.log(`Started ${cpus} worker processes`);
index.ts
import{PrismaClient}from"@prisma/client";import{RequestRecievedEvent,Route}from"./system/requestHandler";exportconstprisma=newPrismaClient();exportconstPORT=process.env.PORT||"3000";constworkerId=Math.random().toString(36).slice(2);constserver=Bun.serve({port: Number(PORT),reusePort: true,// Enable port sharing between processesfetch(request,server){returnRequestRecievedEvent(request);}});awaitimport("./routes");console.log(`Worker ${workerId} started on ${server.hostname}:${server.port}`);
Hit the API endpoint as hard as possible from multiple threads and it will happen randomly.
OS: Debian 12
bun --version: 1.1.45
Relevant log output
Forgot to copy it before console clear but it was Memory adress error and Its a bun error please report it text.
Stack Trace (bun.report)
Bun v1.1.42 (50eec00) on linux x86_64 [AutoCommand]
How can we reproduce the crash?
Just run the default multithreading example:
cluster.ts
index.ts
Hit the API endpoint as hard as possible from multiple threads and it will happen randomly.
OS: Debian 12
bun --version: 1.1.45
Relevant log output
Stack Trace (bun.report)
Bun v1.1.42 (
50eec00
) on linux x86_64 [AutoCommand]Segmentation fault at address 0x00000000
??
??
??
??
??
??
??
??
??
??
Features: process_dlopen, dotenv, fetch, http_server, jsc, transpiler_cache, tsconfig, tsconfig
The text was updated successfully, but these errors were encountered: