Skip to content
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

Random "all goroutines are asleep - deadlock!" on a build #3635

Open
btakita opened this issue Feb 7, 2024 · 4 comments
Open

Random "all goroutines are asleep - deadlock!" on a build #3635

btakita opened this issue Feb 7, 2024 · 4 comments

Comments

@btakita
Copy link

btakita commented Feb 7, 2024

I have not seen this error before & cannot reproduce. The project I ran this on is https://github.com/btakita/briantakita.me-dev

git clone git@github.com:btakita/briantakita.me-dev.git
cd briantakita.me-dev
git submodule init
git submodule update
bun i
app--build

It uses rebuildjs, relysjs, & @rebuildjs/tailwindcss...all of which I wrote. The rebuildjs core is a reactive build, which include throw new Cancel, which cancels the existing build process a reactive memo (using rmemo, another library I wrote) starts a new build. I'm mentioning this because it's not a normal use case & it's possible some undiscovered concurrency issues can arise...as seems to be the case here.

fatal error: all goroutines are asleep - deadlock!

goroutine 1 [chan receive]:
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 +0x59
main.runService(0x1)
        github.com/evanw/esbuild/cmd/esbuild/service.go:160 +0x4ed
main.main()
        github.com/evanw/esbuild/cmd/esbuild/main.go:240 +0xa29

goroutine 18 [chan receive]:
main.runService.func1()
        github.com/evanw/esbuild/cmd/esbuild/service.go:98 +0x4a
created by main.runService
        github.com/evanw/esbuild/cmd/esbuild/service.go:97 +0x1e5

goroutine 19 [chan receive]:
main.(*serviceType).sendRequest(0xc000128030, {0x93c500, 0xc001652bd0})
        github.com/evanw/esbuild/cmd/esbuild/service.go:192 +0xfa
main.runService.func3()
        github.com/evanw/esbuild/cmd/esbuild/service.go:125 +0x39
created by main.runService
        github.com/evanw/esbuild/cmd/esbuild/service.go:122 +0x31c
@btakita
Copy link
Author

btakita commented Feb 7, 2024

Actually, another build is not started. There is only one call to esbuild_ctx.rebuild() on the production environment. Sorry about the misstatement above. The Cancel logic is contained within various rmemos which:

sync the concurrent browser + server builds → hold state derived from metafile.json → post-build work → modify the state → persist the new state to metafile.json.

The app build logic is in https://github.com/btakita/briantakita.me/blob/main/build.ts, where @btakita/briantakita.me is a submodule in the btakita/briantakita.me-dev project.

From an esbuild perspective, one thing that is unusual is that two concurrent .rebuild() calls occur...for the browser & server...with each build having multiple entry points.

@btakita
Copy link
Author

btakita commented Feb 11, 2024

Environment

Linux 6.7.2-arch1-1 x86_64 unknown
bun 1.0.26

@XhstormR
Copy link

XhstormR commented May 2, 2024

I have the same issue here when i start the dev angular server.

=> bun start
$ ng serve
Initial chunk files | Names               |   Raw size
styles.css          | styles              |   94.53 kB |
polyfills.js        | polyfills           |   83.60 kB |
main.js             | main                |    6.68 kB |
chunk-UGWGSAMD.js   | -                   |    2.31 kB |
chunk-EANWZMW4.js   | -                   | 1023 bytes |

                    | Initial total       |  188.12 kB

Lazy chunk files    | Names               |   Raw size
chunk-I236AL25.js   | dashboard-component |   33.66 kB |
chunk-CMETQZE2.js   | home-component      |   11.36 kB |
chunk-KVA7RMZL.js   | -                   |    9.16 kB |

Application bundle generation complete. [4.077 seconds]

Watch mode enabled. Watching for file changes...
  ➜  Local:   http://localhost:4200/
  ➜  press h + enter to show help
q
fatal error: all goroutines are asleep - deadlock!

goroutine 1 [chan receive]:
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 +0x59
main.runService(0x1)
        github.com/evanw/esbuild/cmd/esbuild/service.go:160 +0x4ed
main.main()
        github.com/evanw/esbuild/cmd/esbuild/main.go:240 +0xa29

goroutine 4 [chan receive]:
main.runService.func1()
        github.com/evanw/esbuild/cmd/esbuild/service.go:98 +0x4a
created by main.runService
        github.com/evanw/esbuild/cmd/esbuild/service.go:97 +0x1e5

goroutine 5 [chan receive]:
main.(*serviceType).sendRequest(0xc00017c090, {0x1540680, 0xc000ad3e00})
        github.com/evanw/esbuild/cmd/esbuild/service.go:192 +0xfa
main.runService.func3()
        github.com/evanw/esbuild/cmd/esbuild/service.go:125 +0x39
created by main.runService
        github.com/evanw/esbuild/cmd/esbuild/service.go:122 +0x31c

@MrP
Copy link

MrP commented May 11, 2024

I have the same issue on an angular build, @XhstormR, on a Linux Azure Pipeline build. Did you ever find out what's going on?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants