-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 crashing when trying to await Bun.write
inside test function
#12360
Comments
here is the source code that contains the code. https://github.com/karlrobeck/Bun-write-error-test i also tried the repo to my arch wsl to see if i can also reproduce the error. weird thing is that on my wsl system. it doesnt reproduce the error only on my windows system. Arch wsl Bun 1.1.17 windows 10 Bun 1.1.18 Arch wsl Bun 1.1.18 (i upgraded it) |
Thank you. I am able to reproduce this on Windows. index.test.ts:
✓ validate executable given in the config using `validatePath`: invalid value [0.20ms]
============================================================
Bun Canary v1.1.10-canary.1 (6566b8a6) Windows x64
Args: "C:\Users\window\.bun\bin\bun.exe", "test"
Features: jsc tsconfig
Elapsed: 36ms | User: 0ms | Sys: 0ms
RSS: 130.40MB | Peak: 130.40MB | Commit: 0.22GB | Faults: 32090
panic(main thread): Internal assertion failure
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.10/wt16566b8aAiggggEgz+6L+zhxIwgq5F+hwCi55nbm9izQyu3hI+4m4Ti25pL2j461CA0eNrzzCtJLcpLzFFILC5OLSrJzM9TSEvMzCktSgUAiSkKPg
PS C:\Temp\Bun-write-error-test> bun test^C
PS C:\Temp\Bun-write-error-test> bun-debug test
[SYS] NtCreateFile(80[cwd handle], \??\C:\Temp\Bun-write-error-test\bunfig.toml) = OBJECT_NAME_NOT_FOUND (file) = 12297829382473034410
bun test v1.1.19 (60d8e97c)
[SYS] NtCreateFile([invalid_fd], \??\C:\) = SUCCESS (dir) = 476
[SYS] NtQueryDirectoryFile(476[\Device\HarddiskVolume3\]) = 4270
[SYS] NtQueryDirectoryFile(476[\Device\HarddiskVolume3\]) = 0
[SYS] NtCreateFile([invalid_fd], \??\C:\Temp) = SUCCESS (dir) = 592
[SYS] NtQueryDirectoryFile(592[\Device\HarddiskVolume3\Temp]) = 2314
[SYS] NtQueryDirectoryFile(592[\Device\HarddiskVolume3\Temp]) = 0
[SYS] NtCreateFile([invalid_fd], \??\C:\Temp\Bun-write-error-test) = SUCCESS (dir) = 596
[SYS] NtQueryDirectoryFile(596[\Device\HarddiskVolume3\Temp\Bun-write-error-test]) = 922
[SYS] NtQueryDirectoryFile(596[\Device\HarddiskVolume3\Temp\Bun-write-error-test]) = 0
[SYS] GetFinalPathNameByHandle(anyopaque@254)
[SYS] NtCreateFile(596[\Device\HarddiskVolume3\Temp\Bun-write-error-test], \??\C:\Temp\Bun-write-error-test\package.json) = SUCCESS (file) = 600
[SYS] close(600[\Device\HarddiskVolume3\Temp\Bun-write-error-test\package.json])
[SYS] GetFinalPathNameByHandle(anyopaque@254)
[SYS] NtCreateFile(596[\Device\HarddiskVolume3\Temp\Bun-write-error-test], \??\C:\Temp\Bun-write-error-test\tsconfig.json) = SUCCESS (file) = 600
[SYS] close(600[\Device\HarddiskVolume3\Temp\Bun-write-error-test\tsconfig.json])
[SYS] NtCreateFile([invalid_fd], \??\C:\Temp\Bun-write-error-test) = SUCCESS (dir) = 612
[SYS] NtQueryDirectoryFile(612[\Device\HarddiskVolume3\Temp\Bun-write-error-test]) = 922
[SYS] NtQueryDirectoryFile(612[\Device\HarddiskVolume3\Temp\Bun-write-error-test]) = 0
index.test.ts:
[SYS] NtCreateFile(80[cwd handle], \??\C:\Temp\Bun-write-error-test\index.test.ts) = SUCCESS (file) = 632
[SYS] close(632[\Device\HarddiskVolume3\Temp\Bun-write-error-test\index.test.ts])
[SYS] NtCreateFile([invalid_fd], \??\C:\Temp) = SUCCESS (dir) = 672
[SYS] NtQueryDirectoryFile(672[\Device\HarddiskVolume3\Temp]) = 2314
[SYS] NtQueryDirectoryFile(672[\Device\HarddiskVolume3\Temp]) = 0
[SYS] NtCreateFile(80[cwd handle], \??\C:\Temp\Bun-write-error-test\index.ts) = SUCCESS (file) = 676
[SYS] close(676[\Device\HarddiskVolume3\Temp\Bun-write-error-test\index.ts])
[EventLoop] tickWithoutIdle
[jest] test("validate executable given in the config using `validatePath`: invalid value")
[EventLoop] enter() = 0
[alloc] new() = src.bun.js.webcore.blob.Blob.Store@50416340380
[alloc] new() = src.bun.js.webcore.blob.Blob@50416290500
[SYS] uv stat(C:\Temp\Bun-write-error-test\sample.exe) = -4058
[EventLoop] exit() = 0
✓ validate executable given in the config using `validatePath`: invalid value
[jest] test("validate executable given in the config using `validatePath`: expected real implementation")
[EventLoop] enter() = 0
[alloc] new() = src.bun.js.webcore.blob.Blob.Store@50416340460
[alloc] new() = src.bun.js.webcore.blob.Blob.Store@50416340540
[alloc] new() = src.bun.js.webcore.blob.WriteFile.WriteFileWindows@50416400380
[EventLoop] exit() = 0
[alloc] new() = src.bun.js.node.node_fs.Async.AsyncMkdirp@504162701b0
bun.assert(this.err == null);
^
C:\bun\src\bun.js\webcore\blob\WriteFile.zig:511:23: 0x7ff6fab541fa in onMkdirpComplete (bun-zig.o)
this.throw(err);
^
C:\bun\src\bun.js\event_loop.zig:218:66: 0x7ff6faaa8d69 in wrap (bun-zig.o)
@call(bun.callmod_inline, Callback, .{@as(*Type, @ptrCast(@alignCast(this.?)))});
^
C:\bun\src\bun.js\event_loop.zig:202:17: 0x7ff6f93c8982 in run (bun-zig.o)
callback(ctx.?);
^
C:\bun\src\bun.js\event_loop.zig:1035:28: 0x7ff6f93c1991 in tickQueueWithCount__anon_121510 (bun-zig.o)
any.run();
^
C:\bun\src\bun.js\event_loop.zig:1249:39: 0x7ff6f8de487a in tickWithCount (bun-zig.o)
return this.tickQueueWithCount("tasks");
^
C:\bun\src\bun.js\event_loop.zig:1473:42: 0x7ff6f8960605 in tick (bun-zig.o)
while (this.tickWithCount() > 0) : (this.global.handleRejectedPromises()) {
^
C:\bun\src\cli\test_command.zig:1256:44: 0x7ff6f9a62de8 in run (bun-zig.o)
vm.eventLoop().tick();
^
C:\bun\src\cli\test_command.zig:1143:32: 0x7ff6f93b26b8 in begin (bun-zig.o)
TestCommand.run(reporter, vm, files[files.len - 1].slice(), allocator, true) catch {};
^
PS C:\Temp\Bun-write-error-test> |
Open
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How can we reproduce the crash?
Hi, im trying to create a cli tool for executing .exe file on bun. i'm also trying to create a test for generating random .exe file so that my "validatePath" function could determine if that file path exist or not.
here is my validatePath function code
i have two test, the first one test for invalid input
and for the second test, it will now generate a .exe file or any file.
when running
bun test
. bun panics when trying to execute the second testafter further investigation. the main culprit on why bun is crashing is the
Bun.write
function.trying to await
Bun.write
when testing cause the Bun runtime to panic.Relevant log output
Stack Trace (bun.report)
Bun v1.1.18 (
5a0b935
) on windows x86_64 [TestCommand]panic: Internal assertion failure
debug.zig:439
:panicExtra
bun.zig:3258
:assertionFailure
bindings.zig:2713
:getSourceCode
event_loop.zig:1010
:tickQueueWithCount
event_loop.zig:1465
:tick
javascript.zig:809
:get
test_command.zig:1138
:begin
Ref.h:48
:WTF::DefaultRefDerefTraits<WTF::StringImpl>::refIfNotNull
test_command.zig:1147
:runAllTests
test_command.zig:918
:exec
The text was updated successfully, but these errors were encountered: