oven-sh / bun

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

Local Host failure #12277

Closed KaiMckiernan closed 3 months ago

KaiMckiernan commented 3 months ago

How can we reproduce the crash?

server.js

let folder = "./"

let server = Bun.serve({
  async fetch (req) {
    let path = new URL(req.url).pathname;
    console.log(path);
    if (path === "/") path = "storage.html";
    let file = Bun.file(`${folder}/${path}`);
    if (await file.exists()) return new Response(file);
    return new Response('404');
  }
})
console.log(`Server running on ${server.url}`);

storage.html

<head>
    <title>Project tracker</title> <link rel="stylesheet" href="./styles.css">
</head>

<h1>HI hi</h1>

<form><input type="text"><input type="button" value="enter" onclick="webWorkerTest()"></form>

<script>

function webWorkerTest() {
    if(typeof(Worker) !== "undefined") {
        let w = new Worker("workers/baseLog.js");
        w.onmessage = function(event) {
            console.log(event.data);
            if(event.data === "finished") w.terminate()
        };
    } else {
        console.log("Sorry, your browser does not support Web Workers...");
    }
}

</script>

There was no file for workers/baseLog.js, and running it a second time makes it work. I don't know why it glitched.

Relevant log output

Bun v1.1.17 (bb66bba1) Windows x64
Args: "C:\Users\kaimc\.bun\bin\bun.exe" ".\server.js"
Features: jsc abort_signal http_server
Builtins: "bun:main"
Elapsed: 4708ms | User: 62ms | Sys: 109ms
RSS: 98.41MB | Peak: 98.73MB | Commit: 0.17GB | Faults: 24398

panic(main thread): Internal assertion failure
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:

Stack Trace (bun.report)

Bun v1.1.17 (bb66bba) on windows x86_64 [RunCommand]

panic: Internal assertion failure

cirospaciari commented 3 months ago

Fixed in https://github.com/oven-sh/bun/pull/12441