worker: perform initial port.unref() before preload modules
The refcount of the internal communication port is relevant for
stdio, but the port.unref()
call effectively resets any .ref()
calls happening during stdio operations happening before it.
Therefore, do the .unref()
call before loading preload modules,
which may cause stdio operations.
Fixes: https://github.com/nodejs/node/issues/31777
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines