oven-sh / bun

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

Segfault when using bun build #12456

Open mProjectsCode opened 3 weeks ago

mProjectsCode commented 3 weeks ago

How can we reproduce the crash?

idk it happens when i tested bun build instead of esbuild to build my project. Here is my build config.

await Bun.build({
    banner: {
        js: banner,
    },
    entryPoints: ['packages/obsidian/src/main.ts'],
    bundle: true,
    external: [
        'obsidian',
        'electron',
        '@codemirror/autocomplete',
        '@codemirror/collab',
        '@codemirror/commands',
        '@codemirror/language',
        '@codemirror/lint',
        '@codemirror/search',
        '@codemirror/state',
        '@codemirror/view',
        '@lezer/common',
        '@lezer/highlight',
        '@lezer/lr',
        ...builtins,
    ],
    format: 'esm',
    target: 'browser',
    logLevel: 'info',
    sourcemap: "none",
    treeShaking: true,
    outfile: 'main.js',
    minify: true,
    metafile: true,
    define: {
        MB_GLOBAL_CONFIG_DEV_BUILD: 'false',
    },
    plugins: [
        // @ts-ignore
        esbuildSvelte({
            compilerOptions: { css: 'injected', dev: false, sveltePath: 'svelte' },
            preprocess: sveltePreprocess(),
            filterWarnings: warning => {
                // we don't want warnings from node modules that we can do nothing about
                return !warning.filename?.includes('node_modules');
            },
        }),
    ],
});

Relevant log output

Bun v1.1.18 (5a0b9352) Linux x64
WSL Kernel v5.15.153 | glibc v2.39
Args: "bun" "run" "automation/build/bun_test.ts"
Features: jsc bunfig transpiler_cache tsconfig(2)
Builtins: "bun:main" "node:fs" "node:module" "node:path" "node:string_decoder" "node:util" "node:util/types"
Elapsed: 114ms | User: 76ms | Sys: 43ms
RSS: 1.07GB | Peak: 0.16GB | Commit: 1.07GB | Faults: 3

panic(main thread): Segmentation fault at address 0x4
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.18/lr15a0b935AiigggF2stknE+xpRk866qE26v5qE2+m8qEirg5pEsxxonFqp/s8E_ygws9DA2AI

Illegal instruction

Stack Trace (bun.report)

Bun v1.1.18 (5a0b935) on linux x86_64 [RunCommand]

Segmentation fault at address 0x00000004

mProjectsCode commented 3 weeks ago

This still happens on the latest canary, here is the extra CPU info CPU: sse42 popcnt avx avx2

mProjectsCode commented 2 weeks ago

Still happens with bun 1.1.20