webcontainer-core icon indicating copy to clipboard operation
webcontainer-core copied to clipboard

Building issue, "fatal error: too many writes on closed pipe"

Open HyCore opened this issue 1 year ago • 0 comments

Describe the bug

At some point when tying to read any file change it seems to die. ENOENT: no such file or directory, read] { code: 'ENOENT', errno: -2, path: undefined, syscall: 'read' } This exact block code is the second before it crashes.

Here is the stacktrace: `fatal error: too many writes on closed pipe

goroutine 6 [running]: runtime.throw({0xa15cc, 0x1e}) runtime/panic.go:1047 +0x3 fp=0x83aed8 sp=0x83aeb0 pc=0x12250003 os.sigpipe() runtime/os_js.go:144 +0x2 fp=0x83aef0 sp=0x83aed8 pc=0x13b70002 os.epipecheck(...) os/file_unix.go:224 os.(*File).Write(0x80c020, {0x9ff000, 0x14c, 0x200}) os/file.go:183 +0x2d fp=0x83af78 sp=0x83aef0 pc=0x160f002d main.runService.func1() github.com/evanw/esbuild/cmd/esbuild/service.go:99 +0x7 fp=0x83afe0 sp=0x83af78 pc=0x1fe30007 runtime.goexit() runtime/asm_wasm.s:399 +0x1 fp=0x83afe8 sp=0x83afe0 pc=0x14070001 created by main.runService github.com/evanw/esbuild/cmd/esbuild/service.go:97 +0x1e

goroutine 1 [chan receive]: runtime.gopark(0xba280, 0x834178, 0xe, 0x17, 0x2) runtime/proc.go:381 +0x28 fp=0x85fbd8 sp=0x85fbb0 pc=0x124c0028 runtime.chanrecv(0x834120, 0x0, 0x1) runtime/chan.go:583 +0x7f fp=0x85fc60 sp=0x85fbd8 pc=0x106d007f runtime.chanrecv1(0x834120, 0x0) runtime/chan.go:442 +0x2 fp=0x85fc88 sp=0x85fc60 pc=0x106b0002 github.com/evanw/esbuild/internal/helpers.(*ThreadSafeWaitGroup).Wait(...) github.com/evanw/esbuild/internal/helpers/waitgroup.go:36 main.runService.func2() github.com/evanw/esbuild/cmd/esbuild/service.go:114 +0x8 fp=0x85fca8 sp=0x85fc88 pc=0x1fe20008 main.runService(0x1) github.com/evanw/esbuild/cmd/esbuild/service.go:160 +0x5c fp=0x85fdf0 sp=0x85fca8 pc=0x1fe0005c main.main() github.com/evanw/esbuild/cmd/esbuild/main.go:240 +0xa0 fp=0x85ff88 sp=0x85fdf0 pc=0x1fd900a0 runtime.main() runtime/proc.go:250 +0x32 fp=0x85ffe0 sp=0x85ff88 pc=0x12460032 runtime.goexit() runtime/asm_wasm.s:399 +0x1 fp=0x85ffe8 sp=0x85ffe0 pc=0x14070001

goroutine 2 [force gc (idle)]: runtime.gopark(0xba418, 0x3e8840, 0x11, 0x14, 0x1) runtime/proc.go:381 +0x28 fp=0x828fb8 sp=0x828f90 pc=0x124c0028 runtime.goparkunlock(...) runtime/proc.go:387 runtime.forcegchelper() runtime/proc.go:305 +0x1f fp=0x828fe0 sp=0x828fb8 pc=0x1249001f runtime.goexit() runtime/asm_wasm.s:399 +0x1 fp=0x828fe8 sp=0x828fe0 pc=0x14070001 created by runtime.init.5 runtime/proc.go:293 +0x2

goroutine 3 [GC sweep wait]: runtime.gopark(0xba418, 0x3e8bc0, 0xc, 0x14, 0x1) runtime/proc.go:381 +0x28 fp=0x829798 sp=0x829770 pc=0x124c0028 runtime.goparkunlock(...) runtime/proc.go:387 runtime.bgsweep(0x82e000) runtime/mgcsweep.go:319 +0x21 fp=0x8297d0 sp=0x829798 pc=0x11790021 runtime.gcenable.func1() runtime/mgc.go:178 +0x2 fp=0x8297e0 sp=0x8297d0 pc=0x110d0002 runtime.goexit() runtime/asm_wasm.s:399 +0x1 fp=0x8297e8 sp=0x8297e0 pc=0x14070001 created by runtime.gcenable runtime/mgc.go:178 +0x8

goroutine 4 [GC scavenge wait]: runtime.gopark(0xba418, 0x3e8e00, 0xd, 0x14, 0x2) runtime/proc.go:381 +0x28 fp=0x829f80 sp=0x829f58 pc=0x124c0028 runtime.goparkunlock(...) runtime/proc.go:387 runtime.(*scavengerState).park(0x3e8e00) runtime/mgcscavenge.go:400 +0xd fp=0x829fa8 sp=0x829f80 pc=0x1160000d runtime.bgscavenge(0x82e000) runtime/mgcscavenge.go:633 +0x8 fp=0x829fd0 sp=0x829fa8 pc=0x11650008 runtime.gcenable.func2() runtime/mgc.go:179 +0x2 fp=0x829fe0 sp=0x829fd0 pc=0x110c0002 runtime.goexit() runtime/asm_wasm.s:399 +0x1 fp=0x829fe8 sp=0x829fe0 pc=0x14070001 created by runtime.gcenable runtime/mgc.go:179 +0xe

goroutine 5 [finalizer wait]: runtime.gopark(0xba2b8, 0x405ab0, 0x10, 0x14, 0x1) runtime/proc.go:381 +0x28 fp=0x828738 sp=0x828710 pc=0x124c0028 runtime.runfinq() runtime/mfinal.go:193 +0x1f fp=0x8287e0 sp=0x828738 pc=0x1104001f runtime.goexit() runtime/asm_wasm.s:399 +0x1 fp=0x8287e8 sp=0x8287e0 pc=0x14070001 created by runtime.createfing runtime/mfinal.go:163 +0xd

goroutine 7 [waiting]: runtime.gopark(0x0, 0x0, 0x0, 0x0, 0x1) runtime/proc.go:381 +0x28 fp=0x82af90 sp=0x82af68 pc=0x124c0028 runtime.handleEvent() runtime/lock_js.go:257 +0x1b fp=0x82afe0 sp=0x82af90 pc=0x10a3001b runtime.goexit() runtime/asm_wasm.s:399 +0x1 fp=0x82afe8 sp=0x82afe0 pc=0x14070001 created by runtime.beforeIdle runtime/lock_js.go:207 +0x1a

goroutine 8 [sleep]: runtime.gopark(0xba458, 0x832190, 0x13, 0x13, 0x1) runtime/proc.go:381 +0x28 fp=0x825768 sp=0x825740 pc=0x124c0028 time.Sleep(0x3b9aca00) runtime/time.go:195 +0x1b fp=0x8257a0 sp=0x825768 pc=0x13d6001b main.runService.func3() github.com/evanw/esbuild/cmd/esbuild/service.go:124 +0x5 fp=0x8257e0 sp=0x8257a0 pc=0x1fe10005 runtime.goexit() runtime/asm_wasm.s:399 +0x1 fp=0x8257e8 sp=0x8257e0 pc=0x14070001 created by main.runService github.com/evanw/esbuild/cmd/esbuild/service.go:122 +0x41

goroutine 434 [chan receive]: runtime.gopark(0xba280, 0x835fd8, 0xe, 0x17, 0x2) runtime/proc.go:381 +0x28 fp=0x10343e8 sp=0x10343c0 pc=0x124c0028 runtime.chanrecv(0x835f80, 0x1034878, 0x1) runtime/chan.go:583 +0x7f fp=0x1034470 sp=0x10343e8 pc=0x106d007f runtime.chanrecv1(0x835f80, 0x1034878) runtime/chan.go:442 +0x2 fp=0x1034498 sp=0x1034470 pc=0x106b0002 github.com/evanw/esbuild/internal/bundler.(*scanner).scanAllDependencies(0xbe0900) github.com/evanw/esbuild/internal/bundler/bundler.go:2003 +0x24 fp=0x10349b0 sp=0x1034498 pc=0x1e580024 github.com/evanw/esbuild/internal/bundler.ScanBundle(0x0, {0x931a40, 0xbd8678, 0xbd8690, 0xbad2e0, 0x5, 0xbea690}, {0x137058, 0xbad480}, 0xa01e00, ...) github.com/evanw/esbuild/internal/bundler/bundler.go:1352 +0x84 fp=0x1035078 sp=0x10349b0 pc=0x1e430084 github.com/evanw/esbuild/pkg/api.rebuildImpl({0xa01e00, {0xbd8510, 0x1, 0x1}, {0x0, 0x0, 0x0}, {0x0, 0x1, 0x2, ...}, ...}, ...) github.com/evanw/esbuild/pkg/api/api_impl.go:1456 +0x11 fp=0x10361e0 sp=0x1035078 pc=0x1f830011 github.com/evanw/esbuild/pkg/api.(*internalContext).rebuild(0x904500) github.com/evanw/esbuild/pkg/api/api_impl.go:975 +0xe fp=0x10376a0 sp=0x10361e0 pc=0x1f77000e github.com/evanw/esbuild/pkg/api.(*internalContext).Rebuild(0x904500) github.com/evanw/esbuild/pkg/api/api_impl.go:1036 +0x2 fp=0x1037eb0 sp=0x10376a0 pc=0x1f790002 main.(*serviceType).handleIncomingPacket.func5() github.com/evanw/esbuild/cmd/esbuild/service.go:293 +0x8 fp=0x1037fe0 sp=0x1037eb0 pc=0x1ffb0008 runtime.goexit() runtime/asm_wasm.s:399 +0x1 fp=0x1037fe8 sp=0x1037fe0 pc=0x14070001 created by main.(*serviceType).handleIncomingPacket github.com/evanw/esbuild/cmd/esbuild/service.go:290 +0x14f

goroutine 78 [GC worker (idle)]: runtime.gopark(0xba2d0, 0xbb4c20, 0x1a, 0x14, 0x0) runtime/proc.go:381 +0x28 fp=0x82b758 sp=0x82b730 pc=0x124c0028 runtime.gcBgMarkWorker() runtime/mgc.go:1275 +0x1f fp=0x82b7e0 sp=0x82b758 pc=0x1118001f runtime.goexit() runtime/asm_wasm.s:399 +0x1 fp=0x82b7e8 sp=0x82b7e0 pc=0x14070001 created by runtime.gcBgMarkStartWorkers runtime/mgc.go:1199 +0x3

goroutine 490 [chan receive]: runtime.gopark(0xba280, 0xaa7018, 0xe, 0x17, 0x2) runtime/proc.go:381 +0x28 fp=0xa30258 sp=0xa30230 pc=0x124c0028 runtime.chanrecv(0xaa6fc0, 0xa30388, 0x1) runtime/chan.go:583 +0x7f fp=0xa302e0 sp=0xa30258 pc=0x106d007f runtime.chanrecv1(0xaa6fc0, 0xa30388) runtime/chan.go:442 +0x2 fp=0xa30308 sp=0xa302e0 pc=0x106b0002 syscall.fsCall({0x931cc, 0x5}, {0xa30420, 0x1, 0x1}) syscall/fs_js.go:520 +0x13 fp=0xa303d8 sp=0xa30308 pc=0x15a70013 syscall.Close(0xa) syscall/fs_js.go:122 +0x6 fp=0xa30438 sp=0xa303d8 pc=0x15960006 internal/poll.(*FD).destroy(0xa015c0) internal/poll/fd_unix.go:84 +0x6 fp=0xa30468 sp=0xa30438 pc=0x15f40006 internal/poll.(*FD).decref(0xa015c0) internal/poll/fd_mutex.go:213 +0x6 fp=0xa30488 sp=0xa30468 pc=0x15f10006 internal/poll.(*FD).Close(0xa015c0) internal/poll/fd_unix.go:107 +0x10 fp=0xa304b8 sp=0xa30488 pc=0x15f50010 os.(*file).close(0xa015c0) os/file_unix.go:286 +0x13 fp=0xa30508 sp=0xa304b8 pc=0x161d0013 os.(*File).Close(0x80c828) os/file_posix.go:25 +0x3 fp=0xa30528 sp=0xa30508 pc=0x16170003 os.ReadFile.func1() os/file.go:679 +0x2 fp=0xa30548 sp=0xa30528 pc=0x16150002 os.ReadFile({0x814a00, 0x42}) os/file.go:710 +0x2b fp=0xa305f0 sp=0xa30548 pc=0x1614002b io/ioutil.ReadFile(...) io/ioutil/ioutil.go:37 github.com/evanw/esbuild/internal/fs.(*realFS).ReadFile(0x99ec80, {0x814a00, 0x42}) github.com/evanw/esbuild/internal/fs/fs_real.go:202 +0x8 fp=0xa30708 sp=0xa305f0 pc=0x1d780008 github.com/evanw/esbuild/internal/fs.(*zipFS).ReadFile(0xbad480, {0x814a00, 0x42} ) github.com/evanw/esbuild/internal/fs/fs_zip.go:232 +0x10 fp=0xa307c8 sp=0xa30708 pc=0x1d940010 github.com/evanw/esbuild/internal/cache.(*FSCache).ReadFile(0xa01e00, {0x137058, 0xbad480}, {0x814a00, 0x42}) github.com/evanw/esbuild/internal/cache/cache_fs.go:39 +0xc fp=0xa308b0 sp=0xa307c8 pc=0x1dbc000c github.com/evanw/esbuild/internal/bundler.runOnLoadPlugins({0x10638c0, 0x2, 0x2}, {0x137058, 0xbad480}, 0xa01e00, {0x931a40, 0xbd8678, 0xbd8690, 0xbad2e0, ...}, ...) github.com/evanw/esbuild/internal/bundler/bundler.go:1089 +0x33 fp=0xa30f98 sp=0xa308b0 pc=0x1e3f0033 github.com/evanw/esbuild/internal/bundler.parseFile({{0x137058, 0xbad480}, {0x931a40, 0xbd8678, 0xbd8690, 0xbad2e0, 0x5, 0xbea690}, 0xbe0480, 0xa01e00, ...}) github.com/evanw/esbuild/internal/bundler/bundler.go:144 +0x9 fp=0xa33b38 sp=0xa30f98 pc=0x1e370009 github.com/evanw/esbuild/internal/bundler.(*scanner).maybeParseFile.func1() github.com/evanw/esbuild/internal/bundler/bundler.go:1475 +0x2 fp=0xa33fe0 sp=0xa33b38 pc=0x1e490002 runtime.goexit() runtime/asm_wasm.s:399 +0x1 fp=0xa33fe8 sp=0xa33fe0 pc=0x14070001 created by github.com/evanw/esbuild/internal/bundler.(*scanner).maybeParseFile github.com/evanw/esbuild/internal/bundler/bundler.go:1475 +0x97

goroutine 489 [chan receive]: runtime.gopark(0xba280, 0xaa6fb8, 0xe, 0x17, 0x2) runtime/proc.go:381 +0x28 fp=0xa28258 sp=0xa28230 pc=0x124c0028 runtime.chanrecv(0xaa6f60, 0xa28388, 0x1) runtime/chan.go:583 +0x7f fp=0xa282e0 sp=0xa28258 pc=0x106d007f runtime.chanrecv1(0xaa6f60, 0xa28388) runtime/chan.go:442 +0x2 fp=0xa28308 sp=0xa282e0 pc=0x106b0002 syscall.fsCall({0x931cc, 0x5}, {0xa28420, 0x1, 0x1}) syscall/fs_js.go:520 +0x13 fp=0xa283d8 sp=0xa28308 pc=0x15a70013 syscall.Close(0x9) syscall/fs_js.go:122 +0x6 fp=0xa28438 sp=0xa283d8 pc=0x15960006 internal/poll.(*FD).destroy(0xa01500) internal/poll/fd_unix.go:84 +0x6 fp=0xa28468 sp=0xa28438 pc=0x15f40006 internal/poll.(*FD).decref(0xa01500) internal/poll/fd_mutex.go:213 +0x6 fp=0xa28488 sp=0xa28468 pc=0x15f10006 internal/poll.(*FD).Close(0xa01500) internal/poll/fd_unix.go:107 +0x10 fp=0xa284b8 sp=0xa28488 pc=0x15f50010 os.(*file).close(0xa01500) os/file_unix.go:286 +0x13 fp=0xa28508 sp=0xa284b8 pc=0x161d0013 os.(*File).Close(0x80c800) os/file_posix.go:25 +0x3 fp=0xa28528 sp=0xa28508 pc=0x16170003 os.ReadFile.func1() os/file.go:679 +0x2 fp=0xa28548 sp=0xa28528 pc=0x16150002 os.ReadFile({0x814780, 0x48}) os/file.go:710 +0x2b fp=0xa285f0 sp=0xa28548 pc=0x1614002b io/ioutil.ReadFile(...) io/ioutil/ioutil.go:37 github.com/evanw/esbuild/internal/fs.(*realFS).ReadFile(0x99ec80, {0x814780, 0x48}) github.com/evanw/esbuild/internal/fs/fs_real.go:202 +0x8 fp=0xa28708 sp=0xa285f0 pc=0x1d780008 github.com/evanw/esbuild/internal/fs.(*zipFS).ReadFile(0xbad480, {0x814780, 0x48}) github.com/evanw/esbuild/internal/fs/fs_zip.go:232 +0x10 fp=0xa287c8 sp=0xa28708 pc=0x1d940010 github.com/evanw/esbuild/internal/cache.(*FSCache).ReadFile(0xa01e00, {0x137058, 0xbad480}, {0x814780, 0x48}) github.com/evanw/esbuild/internal/cache/cache_fs.go:39 +0xc fp=0xa288b0 sp=0xa287c8 pc=0x1dbc000c github.com/evanw/esbuild/internal/bundler.runOnLoadPlugins({0x10638c0` Thanks for any help provided.

Link to the blitz that caused the error

https://stackblitz.com/edit/github-6icyek?file=src%2Fpages%2Findex.astro

Steps to reproduce

Create a demo app, make a few changes, save.

Expected behavior

The app should build without error.

Parity with Local

Screenshots

image

Platform

Browser name  = Chrome
Full version  = 124.0.0.0
Major version = 124
navigator.appName = Netscape
navigator.userAgent = Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
performance.memory = {
  "totalJSHeapSize": 129275159,
  "usedJSHeapSize": 79644163,
  "jsHeapSizeLimit": 4294705152
}
Hash = 41fbae16

Additional context

No response

HyCore avatar Apr 26 '24 15:04 HyCore