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

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

Open
amrgamal97 opened this issue Feb 8, 2024 · 9 comments
Open

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

amrgamal97 opened this issue Feb 8, 2024 · 9 comments

Comments

@amrgamal97
Copy link

The error occurs consistently when attempting to build the Angular v17 project on the DigitalOcean server.
No issues encountered when building the project locally.

steps I take:

sudo git clone https://github.com/amrgamal97/myprj.git
sudo npm install
sudo ng build

error message:

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
Killed

Environment:


Angular CLI: 17.1.0
Node: 20.9.0
Package Manager: npm 10.1.0
OS: win32 x64

please fix it ASAP.

@btakita
Copy link

btakita commented Feb 12, 2024

@amrgamal97 I have a seen a similar issue, though it is intermittent for me. At one point, I got it consistently, but after updating my submodules & another bun install, the error stopped. Are you using a monorepo? One possibility I'm exploring is that there are different copies of esbuild in different node_modules directories in the monorepo.

@danielrozenberg
Copy link

We're seeing this in our project when running on Linux, it seems to happen almost every time with Node 20.11.0, and almost not at all (but still sometimes) with Node 18.19.1 or Node 20.11.1

@erwinmombay
Copy link

we're also seeing this in our environment:

stack trace:

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(0xc000228030, {0x93c580, 0xc0004f7170})
	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
Operating System: Ubuntu 20.04.6 LTS
OSType: linux

@csbenjamin
Copy link

I am also encountering the fatal error: all goroutines are asleep - deadlock! issue while using esbuild in my development environment. I am working on a Mac M1 Pro Max and facing this deadlock issue specifically when I have an Angular server running alongside multiple Node.js projects using webpack --watch. The deadlock occurs during the build process of an Angular application.

Interestingly, when I stop the Angular server and the webpack --watch processes, the build completes successfully without any errors. This seems to suggest some sort of resource contention or deadlock situation arising due to the concurrent execution of these processes.

Additionally, it's worth noting that my setup involves building the Angular application (version 17.1.3) inside a Docker container based on the node:18.17.1 image. This setup has worked well for me until I encountered this deadlock issue with esbuild.

I am looking for any guidance or suggestions on how to resolve or work around this issue. Has anyone else experienced something similar in a Dockerized environment, particularly with the mentioned versions of Node.js and Angular, on a Mac M1 Pro Max? Any insights or recommendations would be greatly appreciated.

Thank you in advance for your assistance.

@anlud
Copy link

anlud commented Mar 12, 2024

This error occurred for me around 50% of the cases when I was building our Angular project within a docker container.
There was not really a pattern on when it would happen.
After increasing the available memory of the docker runtime from 4GB to 8GB of RAM the error did not occur anymore.

So this deadlock might be related to the available system memory running out.

@UmairMirza1
Copy link

#3636 (comment)

This solved my issue. I was running into the same stack trace with the error.

fatal error: all goroutines are asleep - deadlock!

I was building locally on M1 pro 16GB where everything was working fine but the build was failing on VM.
Upgraded VM from 4GB to 8GB RAM and it seems to be fine now

@btakita
Copy link

btakita commented Apr 13, 2024

I have plenty of available memory. But it's now happening consistently on my build.

Edit: It was due to timeouts being triggered. Due to tailwind taking a very long time.

@XhstormR
Copy link

XhstormR commented May 2, 2024

I agree with btakita, i have enough memory also encountered this bug, this bug takes some time to occur.

@meDavidNS
Copy link

Thanks to a comment from @kentcdodds #3287 (comment) I was able to fix the same error in our pipelines that use playwright bdd tests after starting the angular dev server (using vite/esbuild under the hood). I added a --watch=false and deadlocks were never to be seen again.

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

9 participants