GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: fix worker send error by gireeshpunathil · Pull Request #20973 · nodejs/node

Conversation

@gireeshpunathil

@gireeshpunathil gireeshpunathil commented May 26, 2018

Copy link
Copy Markdown
Member

In test-child-process-fork-closed-channel-segfault.js, race condition
is observed between the server getting closed and the worker sending
a message. Accommodate the potential errors.

Earlier, the same race was observed between the client and server
and was addressed through ignoring the relevant errors through error
handler. The same mechanism is re-used for worker too.

Refs: #3635 (comment)
Fixes: #20836

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Trott reacted with hooray emoji Trott reacted with heart emoji
All reactions
  • 🎉 1 reaction
  • ❤️ 1 reaction
@gireeshpunathil gireeshpunathil added the test Issues and PRs related to Node.js core tests and test infrastructure. label May 26, 2018
Trott
Trott approved these changes May 27, 2018
View reviewed changes
@Trott

Trott commented May 27, 2018

Copy link
Copy Markdown
Member

CI: https://ci.nodejs.org/job/node-test-pull-request/15111/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott Trott added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label May 27, 2018
@joyeecheung

joyeecheung commented May 27, 2018

Copy link
Copy Markdown
Member

From the CI:

not ok 51 parallel/test-child-process-fork-closed-channel-segfault
  ---
  duration_ms: 0.318
  severity: fail
  exitcode: 1
  stack: |-
    c:\workspace\node-test-binary-windows\test\parallel\test-child-process-fork-closed-channel-segfault.js:80
                throw err;
                ^
    
    Error: write EMFILE
        at ChildProcess.target._send (internal/child_process.js:741:20)
        at ChildProcess.target.send (internal/child_process.js:625:19)
        at Worker.send (internal/cluster/worker.js:40:28)
        at Socket.<anonymous> (c:\workspace\node-test-binary-windows\test\parallel\test-child-process-fork-closed-channel-segfault.js:46:16)
        at Object.onceWrapper (events.js:273:13)
        at Socket.emit (events.js:182:13)
        at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1147:10)
  ...
not ok 52 parallel/test-child-process-fork-net
  ---
  duration_ms: 0.320
  severity: fail
  exitcode: 1
  stack: |-
    PARENT: server listening
    CHILD: server listening
    CLIENT: connected
    PARENT: got connection
    CLIENT: connected
    CHILD: got connection
    CLIENT: closed
    CHILD: got connection
    CHILD: got connection
    CLIENT: closed
    CLIENT: connected
    CLIENT: connected
    CLIENT: closed
    CLIENT: closed
    PARENT: server closed
    testSocket, listening
    CHILD: got socket
    CLIENT: got data
    CLIENT: closed
    events.js:167
          throw er; // Unhandled 'error' event
          ^
    
    Error: write EPIPE
        at ChildProcess.target._send (internal/child_process.js:741:20)
        at ChildProcess.target.send (internal/child_process.js:625:19)
        at SocketListSend._request (internal/socket_list.js:20:16)
        at SocketListSend.close (internal/socket_list.js:40:10)
        at Server.close (net.js:1636:24)
        at Socket.<anonymous> (c:\workspace\node-test-binary-windows\test\parallel\test-child-process-fork-net.js:178:16)
        at Socket.emit (events.js:182:13)
        at TCP._handle.close [as _onclose] (net.js:596:12)
    Emitted 'error' event at:
        at process.nextTick (internal/child_process.js:745:39)
        at process._tickCallback (internal/process/next_tick.js:61:11)
  ...
gireeshpunathil reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gireeshpunathil
gireeshpunathil force-pushed the workererror branch from 2658ac4 to 6229b90 Compare May 27, 2018 09:50
@gireeshpunathil

gireeshpunathil commented May 27, 2018

Copy link
Copy Markdown
Member Author

for what this PR was raised, the same test failed!

good thing is that it precisely showed that fix did not work, the best CI run I have ever seen!

Looking at the failure and associated code, I see what is happening:

node/lib/internal/child_process.js

Lines 628 to 632 in 4f28015

if (typeof callback === 'function') {
process.nextTick(callback, ex);
} else {
process.nextTick(() => this.emit('error', ex));
}

the error in the child child_process.send is either emitted to its receiver and eventually to the worker object, if there is no callback supplied to send.

if callback is supplied, error is never emitted, instead passed to the callback.

So I should apply the error filter in the callback, not in the error handler.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gireeshpunathil

gireeshpunathil commented May 27, 2018

Copy link
Copy Markdown
Member Author

pushed commit to that effect and squashed with the last one, but noticed that the head commit has got associated with this one! how is that possible? what mess up I would have made?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gireeshpunathil gireeshpunathil mentioned this pull request May 27, 2018
Investigate test-child-process-fork-closed-channel-segfault #20836
Closed
@gireeshpunathil
gireeshpunathil force-pushed the workererror branch from 6229b90 to fb5ac32 Compare May 27, 2018 10:18
@gireeshpunathil

gireeshpunathil commented May 27, 2018

Copy link
Copy Markdown
Member Author

ok, forget the last comment - I actually over-squashed one extra commit into mine, fixed now.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gireeshpunathil

gireeshpunathil commented May 27, 2018

Copy link
Copy Markdown
Member Author

new CI: https://ci.nodejs.org/job/node-test-pull-request/15115/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gireeshpunathil

gireeshpunathil commented May 27, 2018

Copy link
Copy Markdown
Member Author

gist of CI:
free-bsd:

06:30:06 not ok 1744 parallel/test-trace-events-fs-sync
06:30:06   ---
06:30:06   duration_ms: 0.874
06:30:06   severity: fail
06:30:06   exitcode: 1
06:30:06   stack: |-
06:30:06     assert.js:80
06:30:06       throw new AssertionError(obj);
06:30:06       ^
06:30:06     
06:30:06     AssertionError [ERR_ASSERTION]: fs.sync.copyfile: 

windows:

ok 51 parallel/test-child-process-fork-closed-channel-segfault
  ---
  duration_ms: 0.426
  ...
not ok 52 parallel/test-child-process-fork-net
  ---
  duration_ms: 0.293
  severity: fail
  exitcode: 1
  stack: |-
    PARENT: server listening
...
    events.js:167
          throw er; // Unhandled 'error' event
          ^
    
    Error: write EPIPE
        at ChildProcess.target._send (internal/child_process.js:741:20)
        at ChildProcess.target.send (internal/child_process.js:625:19)
        at SocketListSend._request (internal/socket_list.js:20:16)
        at SocketListSend.close (internal/socket_list.js:40:10)
        at Server.close (net.js:1636:24)
        at Socket.<anonymous> (c:\workspace\node-test-binary-windows\test\parallel\test-child-process-fork-net.js:178:16)

first one is unrelated flake. the other failure (parallel/test-child-process-fork-net) fails with the same symptom as that of this test, and require the same patch. I suggested @mmarchini to address that based on the result of this.

In short, this PR is stable, and CI failures are unrelated.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott

Trott commented May 28, 2018

Copy link
Copy Markdown
Member

@nodejs/testing @nodejs/child_process

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

joyeecheung
joyeecheung approved these changes May 28, 2018
View reviewed changes
BridgeAR
BridgeAR reviewed May 28, 2018
View reviewed changes
Comment thread test/parallel/test-child-process-fork-closed-channel-segfault.js Outdated

@BridgeAR BridgeAR May 28, 2018

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am not mistaken the test actually does not work in case one of these errors pops up. So instead of ignoring the error, I would like to skip the test with a message. That way there is at least some kind of notification that the test actually did not work as expected.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@gireeshpunathil gireeshpunathil May 28, 2018

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BridgeAR : the sole purpose of the test is to make sure the channel field of a closed worker process is propery nullified (ref: #2847).

This is asserted after the first send causes the worker to exit and subsequently called back in the worker's closure callback

The race comes after: the second request can fail through a variety of reasons based on the state of the worker and the server, and their failure or success is immaterial to the test.

Hope this clarifies.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@BridgeAR BridgeAR May 28, 2018

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the error does not have any influence on the actual thing we want to test: great.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gireeshpunathil reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
bzoz
bzoz approved these changes May 28, 2018
View reviewed changes
cjihrig
cjihrig approved these changes May 28, 2018
View reviewed changes

@cjihrig cjihrig left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I think these should be written as assertions, rather than if statements with throws.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gireeshpunathil

gireeshpunathil commented May 28, 2018

Copy link
Copy Markdown
Member Author

thanks @cjihrig . Given that:

  • the introduced code is a replication of existing block in the same test,
  • the same pattern is required in a companion test parallel/test-child-process-fork-net
  • this has been failing with high frequency in CI recently,

I think it is worthwhile to go as is (fixing the issue at hand) and look at improvements later.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

maclover7
maclover7 approved these changes May 29, 2018
View reviewed changes

@maclover7 maclover7 left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM -- I'm personally in favor of getting this landed sooner rather than later since this fixes Windows CI breakage

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gireeshpunathil

gireeshpunathil commented May 29, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

@cjihrig - I know you approved it, but your suggestion with a should in it makes me flaky on landing this. can you please acknowledge or comment on my response? please let me know.

on a separate note: can anyone tell me the discrete steps for landing self PRs? I know the general landing procedure, but am looking for the merge, the purple button status. Last time I attempted it and created a mess!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gireeshpunathil gireeshpunathil mentioned this pull request May 29, 2018
fs: fix reads with pos > 4GB #21003
Closed
3 of 4 tasks
@bzoz

bzoz commented May 29, 2018

Copy link
Copy Markdown
Contributor

Try this: https://github.com/nodejs/node-core-utils/blob/master/docs/git-node.md it makes everything supereasy

mmarchini reacted with thumbs up emoji mmarchini and gireeshpunathil reacted with heart emoji
All reactions
  • 👍 1 reaction
  • ❤️ 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mmarchini
mmarchini approved these changes May 29, 2018
View reviewed changes

@mmarchini mmarchini left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

BTW, I ran a node-stress-single-test yesterday, and there were no failures out of 9999 runs :)

https://ci.nodejs.org/job/node-stress-single-test/1873/

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@joyeecheung

joyeecheung commented May 29, 2018

Copy link
Copy Markdown
Member

@bzoz The tool does not solve the merge status issue (but I guess if you reset your PR branch to the HEAD that you are about to push to master and force push to update the PR branch, then GitHub would recognize the PR has been merged?)

gireeshpunathil reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gireeshpunathil added a commit that referenced this pull request May 29, 2018
@gireeshpunathil
test: fix worker send error
397eceb
In test-child-process-fork-closed-channel-segfault.js, race condition
is observed between the server getting closed and the worker sending
a message. Accommodate the potential errors.

Earlier, the same race was observed between the client and server
and was addressed through ignoring the relevant errors through error
handler. The same mechanism is re-used for worker too.

The only difference is that the filter is applied at the callback
instead of at the worker's error listener.

Refs: #3635 (comment)
Fixes: #20836
PR-URL: #20973

Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
Reviewed-By: Matheus Marchini <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Bartosz Sosnowski <[email protected]>
@gireeshpunathil gireeshpunathil closed this May 29, 2018
@gireeshpunathil
gireeshpunathil force-pushed the workererror branch from fb5ac32 to 397eceb Compare May 29, 2018 12:57
@gireeshpunathil

gireeshpunathil commented May 29, 2018

Copy link
Copy Markdown
Member Author

Landed in 397eceb

Trott reacted with hooray emoji
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mmarchini mmarchini mentioned this pull request May 29, 2018
test: fix flaky test-child-process-fork-net #21012
Closed
2 of 4 tasks
mmarchini pushed a commit to mmarchini/node that referenced this pull request May 29, 2018
Matheus Marchini
test: fix flaky test-child-process-fork-net
bd3dc9d
Patch inspired on 397eceb to fix
flakyness on test-child-process-fork-net.

Ref: nodejs#20973
mmarchini pushed a commit to mmarchini/node that referenced this pull request May 29, 2018
Matheus Marchini
test: mark test-child-process-fork-net as flaky
65ca2fc
`flaky-test-child-process-fork-net` has been failing constantly for the
past few days, and all solutions suggestes so far were didn't work.
Marking it as faky while the issue is not fixed.

Ref: nodejs#21012
Ref: nodejs#20973
Ref: nodejs#20973
@mmarchini mmarchini mentioned this pull request May 29, 2018
test: mark test-child-process-fork-net as flaky #21018
Closed
1 of 4 tasks
mmarchini pushed a commit that referenced this pull request May 30, 2018
Matheus Marchini
test: mark test-child-process-fork-net as flaky
72ccafd
`flaky-test-child-process-fork-net` has been failing constantly for the
past few days, and all solutions suggestes so far were didn't work.
Marking it as faky while the issue is not fixed.

Ref: #21012
Ref: #20973
Ref: #20973

PR-URL: #21018
Refs: #21012
Refs: #20973
Refs: #20973
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
addaleax pushed a commit that referenced this pull request May 31, 2018
@gireeshpunathil @addaleax
test: fix worker send error
edf4298
In test-child-process-fork-closed-channel-segfault.js, race condition
is observed between the server getting closed and the worker sending
a message. Accommodate the potential errors.

Earlier, the same race was observed between the client and server
and was addressed through ignoring the relevant errors through error
handler. The same mechanism is re-used for worker too.

The only difference is that the filter is applied at the callback
instead of at the worker's error listener.

Refs: #3635 (comment)
Fixes: #20836
PR-URL: #20973

Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
Reviewed-By: Matheus Marchini <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Bartosz Sosnowski <[email protected]>
addaleax pushed a commit that referenced this pull request May 31, 2018
Matheus Marchini @addaleax
test: mark test-child-process-fork-net as flaky
04af697
`flaky-test-child-process-fork-net` has been failing constantly for the
past few days, and all solutions suggestes so far were didn't work.
Marking it as faky while the issue is not fixed.

Ref: #21012
Ref: #20973
Ref: #20973

PR-URL: #21018
Refs: #21012
Refs: #20973
Refs: #20973
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Jun 6, 2018
v10.4.0 proposal #21167
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@BridgeAR BridgeAR BridgeAR left review comments
@Trott Trott Trott approved these changes
@cjihrig cjihrig cjihrig approved these changes
@joyeecheung joyeecheung joyeecheung approved these changes
+3 more reviewers
@maclover7 maclover7 maclover7 approved these changes
@mmarchini mmarchini mmarchini approved these changes
@bzoz bzoz bzoz approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. test Issues and PRs related to Node.js core tests and test infrastructure.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Investigate test-child-process-fork-closed-channel-segfault

Uh oh!

There was an error while loading. Please reload this page.

8 participants

@gireeshpunathil @Trott @joyeecheung @bzoz @cjihrig @maclover7 @mmarchini @BridgeAR
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.