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

Referencing setImmediate prevents a Deno process from finishing #80

Open
wvbe opened this issue Jul 9, 2022 · 0 comments
Open

Referencing setImmediate prevents a Deno process from finishing #80

wvbe opened this issue Jul 9, 2022 · 0 comments

Comments

@wvbe
Copy link

wvbe commented Jul 9, 2022

I found this issue working with Deno (v1.23.3) and another library that has a transitive dependency on setimmediate. That bug report is here.

The bug is that if setimmediate is referenced in a Deno script, the deno script will never finish the process normally. Instead, Deno.exit() (similar to NodeJS process.exit()) must be called.

To reproduce:

  • Have Deno installed, or run it from a Docker container (eg. docker run -it --init denoland/deno:ubuntu sh)
  • Create a test.ts file with the following contents:
    import * as setImmediate from 'https://raw.githubusercontent.com/YuzuJS/setImmediate/master/setImmediate.js';
    console.log('End of program', setImmediate);
  • Run using deno run test.ts

Expected:

  • "End of program Module {}" is logged to console
  • The Deno process exits.

Observed:

  • "End of program Module {}" is logged to console
  • The Deno process never exits. It continues to idle.

I'm pretty sure this is caused by the opening of a MessageChannel and setting a message listener for one of the ports; https://github.com/YuzuJS/setImmediate/blob/master/setImmediate.js#L126

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

1 participant