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

Bug: Spawned child process with hardhat-tracer does not exit #57

Open
hwrdtm opened this issue Jul 19, 2023 · 1 comment
Open

Bug: Spawned child process with hardhat-tracer does not exit #57

hwrdtm opened this issue Jul 19, 2023 · 1 comment

Comments

@hwrdtm
Copy link

hwrdtm commented Jul 19, 2023

What

When I'm spawning a child process to run with the HRE, eg. npx hardhat run someRandomScript.ts, and with the hardhat-tracer imported in the hardhat.config.ts, I get a different behavior than without the tracer module imported. The different behavior is that, with the tracer imported, the child process does not exit.

Steps To Reproduce

  1. Create a file called someRandomScript.ts in a hardhat project:
// someRandomScript.ts
console.log("THIS");
  1. Run with npx hardhat run scripts/thing.ts
  2. Observe the script just hang.
  3. Comment out the console.log
  4. Run with the same command in step 2.
  5. Observe the script exit gracefully.

Versions

  • hardhat@2.15.0
  • hardhat-tracer@2.5.1
  • node@18.15.0
  • yarn@1.22.19

Platform

Macbook Pro 2021
Chip: Apple M1 Pro
OS: macOS Ventura 13.3

@zemse
Copy link
Owner

zemse commented Aug 8, 2023

This is a behaviour of nodejs when async tasks are not completed or get hanged. There are quite a lot of async tasks, I'll look into this issue which one gets hanged.

But if you are blocked by this problem, as a workaround you can add to the end of someRandomScript.ts:

// .. after your code runs:
process.exit() // this will stop the process ignoring any background pending async tasks if any

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

2 participants