-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Process hanging when upgrading esbuild
to 0.15.13+
#2727
Comments
If it helps, I'm happy to screenshare my reproduction since its a bit involved to go through all the steps. |
I'm unable to reproduce this given these instructions. When I try it, I get this error message when running
Running |
Update: I was able to reproduce with a simple Remix app, so updated the repro instructions to use the "Just the basics" option when creating the dummy app. Note that the problem occurs even if you swap out I'll work on getting a screen recording as well. |
Another thing I've noticed is that if I add: let open = {
handles: process._getActiveHandles(),
requests: process._getActiveRequests(),
} just before the |
I can confirm. I'm maintaining a plugin for the scenario tests for I try to find some time looking a bit deeper into the issue if no one beats me to it. |
Here's a screen recording of the repro: https://www.youtube.com/watch?v=jNr3HvZW18Y Note that if I set breakpoints and wait a bit before clicking "continue" at the breakpoint, then esbuild doesn't hang. But if I don't set breakpoints or click "continue" quickly, then esbuild does hang. So seems like a race condition. |
I still can't reproduce the deadlock, but I can reproduce the hang. Here's a reduced test case: require('fs').writeFileSync(__dirname + '/foo.js', `
require('esbuild').build({
incremental: true, // This must be set to true
}).then(() => {
console.log('success')
process.exit(0)
})
`)
require('child_process').execFileSync('node', [__dirname + '/foo.js'], {
stdio: [
'inherit',
'inherit',
'pipe', // This must not be 'inherit'
],
}) This exits with |
The problem is that the fix for #2485 accidentally disabled the keep-alive ping of the parent process. So when the parent process exits without explicitly terminating esbuild, esbuild now doesn't detect that it's no longer needed and stays running. I'm thinking about what to do about this. |
Yea I've been imprecise and using "deadlock" and "hang" interchangeably here. The hanging is reproducible, but I've only seen the deadlock sporadically as I try experimenting with my setup. Thanks for looking into this! 🙏 |
esbuild
to 0.15.13+esbuild
to 0.15.13+
The Remix compiler uses esbuild v0.15.12. When we try to upgrade to 0.15.13 or newer, our CLI tests that call the compiler hang indefinitely. This may be related to the deadlock fixes in 0.15.13.
Specifically, this race condition occurs only when we run the CLI (and consequently,
esbuild
) within a spawned process. It hangs everytime I run our compiler in this way. I tried to reproduce with a simpler setup, but can't get the race condition to appear reliably.Even though I see that my
console.log
s afterawait esbuild.build(...)
are outputting to the debug console, the node process hangs onprocess.exit()
If I throw an error right before my
process.exit()
call in the CLI, I see Go deadlock errors:I also see an
esbuild
process lingering on my system:Manually killing the esbuild process lets the node process resume and finish.
Note that esbuild is already done building by the time it hangs, so when esbuild is killed it has already written the output to disk.
Reproduce
1 Setup dummy Remix project
2 Setup Remix repo
3 Run script
Then create a
script.js
with the following contents:Then run the script:
node ./script ../my-remix-app
Running with
main1
works great, but runningmain2
hangs.The text was updated successfully, but these errors were encountered: