Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bun crashes when file is not available #11146

Open
agentquackyt opened this issue May 17, 2024 · 0 comments
Open

Bun crashes when file is not available #11146

agentquackyt opened this issue May 17, 2024 · 0 comments
Labels
crash An issue that could cause a crash

Comments

@agentquackyt
Copy link

How can we reproduce the crash?

Serving an not existing file

JavaScript/TypeScript code that reproduces the crash?

import { Logger } from "../../lib/logging";
import { Router } from "../../lib/route";
import { Config } from "../configuration/config";

let router_list: Router[] = [];

export let app = {
    use: (routes: Router) => {
        router_list.push(routes);
    }
}

const port = Config.server.port || 4000;
Logger.info("Starting server on port " + port);

export let server = Bun.serve({
    port: port,
    fetch(req: Request): Response | Promise<Response> | any {
        Logger.http(req);
        let url: string = new URL(req.url).pathname;
        for (let i = 0; i < router_list.length; i++) {
            const router = router_list[i];
            if(url.startsWith(router.getBaseRoute) || url.startsWith(router.getBaseRoute.slice(0, -1))) {
                let router_callback = router.run(req)
                if(router_callback != undefined) return router_callback;
            }
        }
        Logger.error("Fallback to default 404")
        return new Response(Bun.file("./frontend/views/404.html"), {status: 404});
    }
})

Relevant log output

PS Q:\UI Clones\html-css-projects\local-netflix\server> bun --hot index.ts
[info] Starting server on port 3000
GET http://localhost:3000/streams
GET http://localhost:3000/favicon.ico
ERROR: Fallback to default 404
============================================================
Bun v1.1.6 (e58d67b4) Windows x64
Args: "C:\Users\jonij\.bun\bin\bun.exe", "--hot", "index.ts"
Features: abort_signal http_server 
Builtins: "bun:main" 
Elapsed: 1925ms | User: 15ms | Sys: 0ms
RSS: 0.14GB | Peak: 0.14GB | Commit: 0.23GB | Faults: 33387

panic(main thread): Segmentation fault at address 0xFFFFFFFFFFFFFFFF
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.6 (e58d67b) on windows x86_64 [AutoCommand]

Segmentation fault at address 0xFFFFFFFFFFFFFFFF

@agentquackyt agentquackyt added the crash An issue that could cause a crash label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash An issue that could cause a crash
Projects
None yet
Development

No branches or pull requests

1 participant