-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
worker: only unref port for stdin if we ref’ed it before #28153
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
cjihrig
approved these changes
Jun 10, 2019
Trott
approved these changes
Jun 10, 2019
chjj
added a commit
to chjj/bthreads
that referenced
this pull request
Jun 11, 2019
BridgeAR
approved these changes
Jun 11, 2019
addaleax
added
the
author ready
PRs that have at least one approval, no pending requests for changes, and a CI started.
label
Jun 19, 2019
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Landed in d5cf51d |
Trott
pushed a commit
to Trott/io.js
that referenced
this pull request
Jun 20, 2019
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 PR-URL: nodejs#28153 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
This failed in Travis for a new PR (#28327): https://travis-ci.com/nodejs/node/jobs/209729625#L265-L296 === release test-worker-no-stdin-stdout-interaction ===
Path: parallel/test-worker-no-stdin-stdout-interaction
--- stderr ---
assert.js:89
throw new AssertionError(obj);
^
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
1 !== 0
at Worker.<anonymous> (/home/travis/build/nodejs/node/test/parallel/test-worker-no-stdin-stdout-interaction.js:11:12)
at Worker.<anonymous> (/home/travis/build/nodejs/node/test/common/index.js:374:15)
at Worker.emit (events.js:200:13)
at Worker.[kOnExit] (internal/worker.js:165:10)
at Worker.<computed>.onexit (internal/worker.js:116:51) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: 1,
expected: 0,
operator: 'strictEqual'
}
--- stdout ---
processing(0)
processing(1)
processing(2)
processing(3)
Command: out/Release/node /home/travis/build/nodejs/node/test/parallel/test-worker-no-stdin-stdout-interaction.js
===
=== 1 tests failed
=== |
@richardlau Since we added all that fancy stages + caching stuff to Travis, having newly added tests fail is something that happens from time to time (presumably because the wrong, old binary is cached or something), so I wouldn’t worry about it unless it turns up repeatedly… |
targos
pushed a commit
that referenced
this pull request
Jul 2, 2019
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 <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
targos
added a commit
that referenced
this pull request
Jul 2, 2019
Notable changes: * build: * Experimental support for building Node.js on MIPS architecture is back. #27992 * child_process: * The promisified versions of `child_process.exec` and `child_process.execFile` now both return a `Promise` which has the child instance attached to their `child` property. #28325 * deps: * Updated libuv to 1.30.0. #28449 * Support for the Haiku platform has been added. * The maximum `UV_THREADPOOL_SIZE` has been increased from 128 to 1024. * `uv_fs_copyfile()` now works properly when the source and destination files are the same. * process: * A new method, `process.resourceUsage()` was added. It returns resource usage for the current process, such as CPU time. #28018 * src: * Fixed an issue related to stdio that could lead to a crash of the process in some circumstances. #28490 * stream: * Added a `writableFinished` property to writable streams. It indicates that all the data has been flushed to the underlying system. #28007 * worker: * Fixed an issue that prevented worker threads to listen for data on stdin. #28153 PR-URL: #28508
targos
added a commit
that referenced
this pull request
Jul 2, 2019
Notable changes: * build: * Experimental support for building Node.js on MIPS architecture is back. #27992 * child_process: * The promisified versions of `child_process.exec` and `child_process.execFile` now both return a `Promise` which has the child instance attached to their `child` property. #28325 * deps: * Updated libuv to 1.30.0. #28449 * Support for the Haiku platform has been added. * The maximum `UV_THREADPOOL_SIZE` has been increased from 128 to 1024. * `uv_fs_copyfile()` now works properly when the source and destination files are the same. * process: * A new method, `process.resourceUsage()` was added. It returns resource usage for the current process, such as CPU time. #28018 * src: * Fixed an issue related to stdio that could lead to a crash of the process in some circumstances. #28490 * stream: * Added a `writableFinished` property to writable streams. It indicates that all the data has been flushed to the underlying system. #28007 * worker: * Fixed an issue that prevented worker threads to listen for data on stdin. #28153 * meta: * Added Jiawen Geng (https://github.com/gengjiawen) to collaborators. #28322 PR-URL: #28508
targos
added a commit
that referenced
this pull request
Jul 2, 2019
Notable changes: * build: * Experimental support for building Node.js on MIPS architecture is back. #27992 * child_process: * The promisified versions of `child_process.exec` and `child_process.execFile` now both return a `Promise` which has the child instance attached to their `child` property. #28325 * deps: * Updated libuv to 1.30.1. #28449, #28511 * Support for the Haiku platform has been added. * The maximum `UV_THREADPOOL_SIZE` has been increased from 128 to 1024. * `uv_fs_copyfile()` now works properly when the source and destination files are the same. * process: * A new method, `process.resourceUsage()` was added. It returns resource usage for the current process, such as CPU time. #28018 * src: * Fixed an issue related to stdio that could lead to a crash of the process in some circumstances. #28490 * stream: * Added a `writableFinished` property to writable streams. It indicates that all the data has been flushed to the underlying system. #28007 * worker: * Fixed an issue that prevented worker threads to listen for data on stdin. #28153 * meta: * Added Jiawen Geng (https://github.com/gengjiawen) to collaborators. #28322 PR-URL: #28508
targos
added a commit
that referenced
this pull request
Jul 3, 2019
Notable changes: * build: * Experimental support for building Node.js on MIPS architecture is back. #27992 * child_process: * The promisified versions of `child_process.exec` and `child_process.execFile` now both return a `Promise` which has the child instance attached to their `child` property. #28325 * deps: * Updated libuv to 1.30.1. #28449, #28511 * Support for the Haiku platform has been added. * The maximum `UV_THREADPOOL_SIZE` has been increased from 128 to 1024. * `uv_fs_copyfile()` now works properly when the source and destination files are the same. * process: * A new method, `process.resourceUsage()` was added. It returns resource usage for the current process, such as CPU time. #28018 * src: * Fixed an issue related to stdio that could lead to a crash of the process in some circumstances. #28490 * stream: * Added a `writableFinished` property to writable streams. It indicates that all the data has been flushed to the underlying system. #28007 * worker: * Fixed an issue that prevented worker threads to listen for data on stdin. #28153 * meta: * Added Jiawen Geng (https://github.com/gengjiawen) to collaborators. #28322 PR-URL: #28508
This was referenced Jul 3, 2019
🙌 ty! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
author ready
PRs that have at least one approval, no pending requests for changes, and a CI started.
worker
Issues and PRs related to Worker support.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 prematurelyended because stdin was not enabled by the parent thread.
In that case, we should not call
.unref()
for stdin if we did notalso call
.ref()
for it before.Fixes: #28144
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes