Skip to content

Bun v1.0.15 crashes building a small AWS CDK stack #7459

Closed as not planned
Closed as not planned
@asilvas

Description

@asilvas

What version of Bun is running?

1.0.15+b3bdf22eb (was also able to repro with a 16 canary)

What platform is your computer?

Linux 6.2.0-37-generic x86_64 x86_64

What steps can reproduce the bug?

// test.ts
import { Stack } from 'aws-cdk-lib';

export class TestStack extends Stack {
  constructor(scope, id) {
    super(scope, id);
  }
}
bun build ./test.ts

What is the expected behavior?

Builds, no crash. Worked fine in v1.0.14 and earlier.

What do you see instead?

Segmentation fault (core dumped)

I've tried gdb and valgrind as well to try and get more details, but didn't notice anything useful.

valgrind -v bun build ./test.ts
==66428== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==66428==  Access not within mapped region at address 0xC15C068
==66428==    at 0x346BFD5: ??? (in /home/user/.bun/bin/bun)
==66428==  If you believe this happened as a result of a stack
==66428==  overflow in your program's main thread (unlikely but
==66428==  possible), you can try to increase the size of the
==66428==  main thread stack using the --main-stacksize= flag.
==66428==  The main thread stack size used in this run was 18446744073709551615.

And using the core dump gdb doesn't show anything useful:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00005569b34dfd0b in ?? ()
[Current thread is 1 (Thread 0x7f19635fd6c0 (LWP 66642))]
(gdb) bt
#0  0x00005569b34dfd0b in ?? ()
#1  0x00005569b34e0009 in ?? ()
#2  0x00005569b34e0009 in ?? ()

and last few lines:

#507 0x00005569b323857c in ?? ()
#508 0x00005569b303e2d5 in ?? ()
#509 0x00005569b3039e98 in ?? ()
#510 0x00005569b3123ccb in ?? ()
#511 0x00005569b2ab3efb in ?? ()
#512 0x00005569b2e9df26 in ?? ()
#513 0x00007f1963a8f6ba in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:444
#514 0x00007f1963b1e0d0 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Additional information

I've tried numerous workarounds to try and narrow it further, but no luck. Simply extending CDK Stack class is all it takes. I've tried older CDK versions, resetting tsconfig.json, reinstalling packages (via bun and npm).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbundlerSomething to do with the bundlercrashAn issue that could cause a crashregression

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions