You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@swc/wasm appears to delay the graceful shutdown of a node process once it's loaded.
Input code
node -e 'require("@swc/wasm"); console.log("done. Should ideally terminate immediately but is somehow delayed by @swc/wasm")'
The node process remains running for about 5 seconds after the log statement. I'm not sure if @swc/wasm is setting some sort of timer or why the process is staying up.
Expected behavior
node process gracefully terminates immediately after the log statement.
Version
The version of @swc/wasm: 1.2.45
OS: Ubuntu Linux
node: v14.15.3
I don't think that is the issue, because I can invoke transformSync to prove that the WASM is executable much earlier. Also, if it were an issue with async compilation, that would mean that WASM takes a full 5 seconds to load, which I think we can agree seems very wrong.
Here is the updated reproduction. It uses transformSync, then logs the date. Then the process waits 5 seconds before terminating, at which point a subsequent process logs the date again. This shows the magnitude of the delay.
Activity
Brooooooklyn commentedon Jan 23, 2021
I think this may be a wasm problem, wasm needs to be read, loaded and parsed asynchronously, and perhaps this process cannot be interrupted
cspotcode commentedon Jan 23, 2021
I don't think that is the issue, because I can invoke
transformSyncto prove that the WASM is executable much earlier. Also, if it were an issue with async compilation, that would mean that WASM takes a full 5 seconds to load, which I think we can agree seems very wrong.Here is the updated reproduction. It uses
transformSync, then logs the date. Then the process waits 5 seconds before terminating, at which point a subsequent process logs the date again. This shows the magnitude of the delay.Sample output:
yisibl commentedon Jan 5, 2023
It looks like it's been greatly improved in Node.js 18.3.0, so you can try it out.
nodejs/node#36616 (comment)