Skip to content

Re-enable unref in Deno#3701

Open
lucacasonato wants to merge 2 commits intoevanw:mainfrom
lucacasonato:re_enable_ef
Open

Re-enable unref in Deno#3701
lucacasonato wants to merge 2 commits intoevanw:mainfrom
lucacasonato:re_enable_ef

Conversation

@lucacasonato
Copy link
Copy Markdown
Contributor

@lucacasonato lucacasonato commented Mar 15, 2024

This re-enables unref-by-default in Deno, and fixes the event loop starvation issue by explicitly re-ref'ing the esbuild sub-process when a user calls stop().

Background: #3682 (comment)

This re-enables unref-by-default in Deno, and fixes the event loop starvation issue by explicitly re-ref'ing the esbuild sub-process when a user calls `stop()`.
Comment thread lib/deno/mod.ts
Comment on lines +214 to +217
// Ref the child process again, so that a user calling `close()` can await
// the returned promise without the event loop starving because there are
// no more ref'd async tasks.
child.ref()
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only new code. All other code is just a revert of 116f63e.

Comment thread lib/shared/types.ts
Comment on lines +680 to +684
// You may also start esbuild once at the top level of your test suite (by
// calling `initialize()`) instead of starting and stopping the esbuild process
// for every test. This will not interfere with the resource sanitizer, and will
// improve the efficiency of your tests because the esbuild process can be
// reused between tests.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added this paragraph to explain that you may also start esbuild outside of a Deno.test call to avoid the resource sanitizer flagging it.

@lucacasonato
Copy link
Copy Markdown
Contributor Author

@evanw Could you take a look at this?

@gmzacharydovel
Copy link
Copy Markdown

Just a heads up, I wouldn't be surprised if error about not being able to initialize esbuild bin folder are related to this because things are running when they shouldn't be running. It looks like some kind of race condition in that case.

denoland/deno#29645

@marvinhagemeister
Copy link
Copy Markdown

@gmzacharydovel the issue you liked to is an issue with deno install. It's not an issue with esbuild.

@gmzacharydovel
Copy link
Copy Markdown

@marvinhagemeister I want to believe that, but it is happening on a already installed project. Furthermore, the error disappears/appears in ways that make it looks like a race condition.

I appreciate that being raised and I'll try to keep my eye out if Deno is trying to do some kind of hidden install process, but I have my doubts.

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

Successfully merging this pull request may close these issues.

3 participants