oven-sh / bun

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

Bun Crashed #12102

Open nushankodikara opened 2 weeks ago

nushankodikara commented 2 weeks ago

How can we reproduce the crash?

I have compiled the following docker image and while running it got this error on Fedora Server Linux localhost.localdomain 6.9.4-200.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 12 13:33:34 UTC 2024 x86_64 GNU/Linux https://hub.docker.com/r/nushankodi/nutrimax-search

Relevant log output

============================================================
Bun v1.1.16 (bf7b327f) Linux x64 (baseline)
Args: "bun" "src/index.tsx"
Features: jsc tsconfig 
Builtins: "bun:main" 
Elapsed: 19ms | User: 29ms | Sys: 25ms
RSS: 1.07GB | Peak: 38.76MB | Commit: 1.07GB | Faults: 0
panic(main thread): Illegal instruction at address 0x556EBD52AFAB
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.1.16/Ba1bf7b327AiggggE+1mOgrmjjDyqn4gDyp93gD8z3/hE+4hl+Dy264iF_6t/98D6t/98DA382qBrlo11iC
============================================================
Bun v1.1.16 (bf7b327f) Linux x64 (baseline)
Args: "bun" "src/index.tsx"
Features: jsc tsconfig 
Builtins: "bun:main" 
Elapsed: 102ms | User: 32ms | Sys: 26ms
RSS: 1.07GB | Peak: 35.40MB | Commit: 1.07GB | Faults: 14
panic(main thread): Illegal instruction at address 0x564A4D231FAB
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.1.16/Ba1bf7b327AiggggE+1mOgrmjjDyqn4gDyp93gD8z3/hE+4hl+Dy264iF_6t/98D6t/98DA30krB26vsktC

Stack Trace (bun.report)

Bun v1.1.16 (bf7b327) on linux x86_64_baseline [AutoCommand]

Illegal instruction at address 0x564A4D231FAB

Jarred-Sumner commented 2 weeks ago

When running bundled code, one interesting thing: the code infinite loops in Html.createElement:

// node_modules/@elysiajs/html/dist/h.js
var exports_h = {};
__export(exports_h, {
  createElement: () => {
    {
      return createElement;
    }
  },
});
var html = __toESM(require_html(), 1);
var createElement = (name, attrs, ...children) => {
  const { $elysia, ...attr } = attrs ?? {};
  const a2 = html.createElement(name, attr, ...children);
  return a2;
};

Earlier:

// node_modules/@elysiajs/html/dist/index.js
var import_html = __toESM(require_html(), 1);
Html.createElement = createElement;

I believe that is a bundler bug (cc @paperdave)

But, this error does not occur when run directly. Only when running bun build on the src/index.tsx file.

I'm not yet able to reproduce this crash, unfortunately