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
We set the `kStartedReading` flag from `_read()` for Worker stdio,
and then `ref()` the port.
However, the `.on('end')` handler is also attached when `._read()`
is not called, e.g. when `process.stdin` inside a Worker is prematurely
ended because stdin was not enabled by the parent thread.
In that case, we should not call `.unref()` for stdin if we did not
also call `.ref()` for it before.
Fixes: nodejs#28144
We set the `kStartedReading` flag from `_read()` for Worker stdio,
and then `ref()` the port.
However, the `.on('end')` handler is also attached when `._read()`
is not called, e.g. when `process.stdin` inside a Worker is prematurely
ended because stdin was not enabled by the parent thread.
In that case, we should not call `.unref()` for stdin if we did not
also call `.ref()` for it before.
Fixes: #28144
PR-URL: #28153
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Description
When a worker thread tries to listen for data on stdin, it gets killed.
Not even finally blocks get called.
Environment
worker_thread
Example
A worker is started, it prints "processing" 10 times:
Now we uncomment the line that listens for data, it gets killed after 2 or 3 iterations (on my machine, guessing quicker on faster machines):
Expected Behaviour
finally
blocks (omitted from my example to keep it short/focused)The text was updated successfully, but these errors were encountered: