oven-sh / bun

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

Crash report #11203

Closed MRDGH2821 closed 4 months ago

MRDGH2821 commented 4 months ago

How can we reproduce the crash?

  1. Ensure you have Docker installed in Windows with WSL integration on.
  2. Open WSL in VS Code
  3. Open a folder in VS Code
  4. put this file in folder: 2024-05-20-23-12-main-seelie.json & my code
  5. Open folder in dev container (Used this template from here
  6. Run the code
  7. Code crashed

JavaScript/TypeScript code that reproduces the crash?

const seelie = require('./2024-05-20-23-12-main-seelie.json')
import {$} from 'bun';
seelie.goals.forEach(goal => {
    if (goal.type != 'Talent') {
        return;
    }

    goal.normal.goal = goal.normal.goal < 9 ? 9 : goal.normal.goal;
    goal.skill.goal = goal.skill.goal < 9 ? 9 : goal.skill.goal;
    goal.burst.goal = goal.burst.goal < 9 ? 9 : goal.burst.goal;
})

await $`${JSON.stringify(seelie, null, 2)} > modified.json`

Relevant log output

const seelie = require('./2024-05-20-23-12-main-seelie.json')
import {$} from 'bun';
seelie.goals.forEach(goal => {
    if (goal.type != 'Talent') {
        return;
    }

    goal.normal.goal = goal.normal.goal < 9 ? 9 : goal.normal.goal;
    goal.skill.goal = goal.skill.goal < 9 ? 9 : goal.skill.goal;
    goal.burst.goal = goal.burst.goal < 9 ? 9 : goal.burst.goal;
})

await $`${JSON.stringify(seelie, null, 2)} > modified.json`

Stack Trace (bun.report)

Bun v1.1.8 (89d2580) on linux x86_64_baseline [AutoCommand]

Segmentation fault at address 0x00000000

Jarred-Sumner commented 4 months ago

Debug build stack trace:

 bun-debug wat.js
============================================================
Bun v1.1.9 (ff1db36a) macOS Silicon
Args: "bun-debug", "wat.js"
Features: jsc Bun.stderr Bun.stdout bunfig shell 
Builtins: "bun:main" 
Elapsed: 59ms | User: 42ms | Sys: 46ms
RSS: 66.81MB | Peak: 66.81MB | Commit: 1.07GB | Faults: 64

panic(main thread): reached unreachable code
/Users/jarred/Code/bun/src/bun.zig:3196:43: 0x104b2ea97 in assert (bun-zig)
        if (comptime Environment.isDebug) unreachable;
                                          ^
/Users/jarred/Code/bun/src/bun.zig:391:50: 0x104b88a03 in copy__anon_54511 (bun-zig)
    if (comptime Environment.allow_assert) assert(dest.len >= src.len);
                                                 ^
/Users/jarred/Code/bun/src/which.zig:8:13: 0x1050eef2f in isValid (bun-zig)
    bun.copy(u8, buf[segment.len + 1 ..], bin);
            ^
/Users/jarred/Code/bun/src/which.zig:57:20: 0x104ce523b in which (bun-zig)
        if (isValid(buf, segment, bin)) |len| {
                   ^
/Users/jarred/Code/bun/src/shell/interpreter.zig:4624:39: 0x10692fc1f in initSubproc (bun-zig)
                const resolved = which(&path_buf, spawn_args.PATH, spawn_args.cwd, first_arg_real) orelse blk: {
                                      ^
/Users/jarred/Code/bun/src/shell/interpreter.zig:4495:29: 0x1064ed513 in transitionToExecStateAndYield (bun-zig)
            this.initSubproc();
                            ^
/Users/jarred/Code/bun/src/shell/interpreter.zig:4449:63: 0x10605b98b in next (bun-zig)
                            this.transitionToExecStateAndYield();
                                                              ^
/Users/jarred/Code/bun/src/shell/interpreter.zig:4547:26: 0x106964baf in childDone (bun-zig)
                this.next();
                         ^
/Users/jarred/Code/bun/src/shell/interpreter.zig:11689:37: 0x1065538cb in childDone__anon_298706 (bun-zig)
                    casted.childDone(child_ptr, exit_code);
                                    ^
/Users/jarred/Code/bun/src/shell/interpreter.zig:1916:38: 0x1060c6feb in next (bun-zig)
                this.parent.childDone(this, 0);
                                     ^

fish: Job 1, 'bun-debug wat.js' terminated by signal SIGTRAP (Trace or breakpoint trap)

@paperdave: note how the reported stacktrace here shows URLParser but the actual bug is not related to the URL parser