Skip to content

test: fix test-process-kill-null.js for Windows - #14099

Closed
starkwang wants to merge 1 commit into
nodejs:masterfrom
starkwang:fix-test-process-kill-null
Closed

test: fix test-process-kill-null.js for Windows#14099
starkwang wants to merge 1 commit into
nodejs:masterfrom
starkwang:fix-test-process-kill-null

Conversation

@starkwang

Copy link
Copy Markdown
Contributor

The test-process-kill-null.js failed in Windows because cat command is invalid for Windows cmd.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test

@nodejs-github-botnodejs-github-bot added the test Issues and PRs related to the tests. label Jul 6, 2017
@richardlau

Copy link
Copy Markdown
Member

The test-process-kill-null.js failed in Windows because cat command is invalid for Windows cmd.

It's included in Git bash. From BUILDING.md:

  • Basic Unix tools required for some tests, Git for Windows includes Git Bash and tools which can be included in the global PATH.

@refackrefack reopened this Jul 7, 2017
@refack

Copy link
Copy Markdown
Contributor

I want this.
The MSYS cat is a ported utility and it's not as robust on windows as it is on *nix.
If we could remove the git-for-windows dependancy, all the better.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The recommended test is common.isWindows (assign const common on L23)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

add common.mustCall

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not needed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

add common.mustCall

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not needed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not needed.

@refackrefack added process Issues and PRs related to the process subsystem. windows Issues and PRs related to the Windows platform. labels Jul 7, 2017
@starkwang
starkwangforce-pushed the fix-test-process-kill-null branch from 7b96888 to 310a19cCompareJuly 7, 2017 02:25
@starkwang

Copy link
Copy Markdown
ContributorAuthor

Pushed commit to address comments.

@refack

Copy link
Copy Markdown
Contributor

refack pushed a commit to refack/node that referenced this pull request Jul 8, 2017
PR-URL: nodejs#14099
Reviewed-By: Refael Ackermann <refack@gmail.com>
@refack

Copy link
Copy Markdown
Contributor

landed in 44483b6

@refackrefack closed this Jul 8, 2017
@refack

refack commented Jul 8, 2017

Copy link
Copy Markdown
Contributor

@refack

refack commented Jul 8, 2017

Copy link
Copy Markdown
Contributor

@starkwangmight will need a followup PR to fix this flakiness:

not ok 235 parallel/test-process-kill-null
---
duration_ms: 0.255
severity: fail
stack: |-
internal/process.js:190
throw errnoException(err, 'kill');
^
Error: kill ESRCH
at exports._errnoException (util.js:1023:11)
at process.kill (internal/process.js:190:13)
at Socket.<anonymous> (c:\workspace\node-test-binary-windows\RUN_SUBSET\3\VS_VERSION\vs2015\label\win2012r2\test\parallel\test-process-kill-null.js:38:11)
at Socket.<anonymous> (c:\workspace\node-test-binary-windows\RUN_SUBSET\3\VS_VERSION\vs2015\label\win2012r2\test\common\index.js:518:15)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at addChunk (_stream_readable.js:252:12)
at readableAddChunk (_stream_readable.js:239:11)
at Socket.Readable.push (_stream_readable.js:197:10)
at Pipe.onread (net.js:589:20)
...

https://ci.nodejs.org/job/node-test-binary-windows/9711/RUN_SUBSET=3,VS_VERSION=vs2015,label=win2012r2/

Running another windows CI: https://ci.nodejs.org/job/node-test-commit-windows-fanned/10278/

@refackrefack mentioned this pull request Jul 9, 2017
3 tasks
refack added a commit to refack/node that referenced this pull request Jul 9, 2017
This reverts commit 44483b6.
PR-URL: nodejs#14142Fixes: nodejs#14141
Refs: nodejs#14099
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@refackrefack reopened this Jul 9, 2017
@refack

Copy link
Copy Markdown
Contributor

@nodejs/platform-windows could the kill ESRCH ("No such process") actually be a bug?
micro context:

child.stdout.on('data',common.mustCall(function(){process.kill(child.pid,'SIGKILL');}

@richardlau

Copy link
Copy Markdown
Member

It probably means the child has exited before the kill was attempted.

https://nodejs.org/dist/latest-v8.x/docs/api/child_process.html#child_process_child_kill_signal

The ChildProcess object may emit an 'error' event if the signal cannot be delivered.

@refack

Copy link
Copy Markdown
Contributor

It probably means the child has exited before the kill was attempted.

https://nodejs.org/dist/latest-v8.x/docs/api/child_process.html#child_process_child_kill_signal

The ChildProcess object may emit an 'error' event if the signal cannot be delivered.

It's more a case of https://nodejs.org/dist/latest-v8.x/docs/api/process.html#process_process_kill_pid_signal

This method will throw an error if the target pid does not exist.
...
Windows platforms will throw an error if the pid is used to kill a process group.

But presumably in this case we attempt to kill only if we get something from stdout.
I'll try to repro locally. I smell something fishy 👃

@richardlau

Copy link
Copy Markdown
Member

The child process can exit between Node.js reading stdout and calling the on 'data' callback.

@gibfahn

Copy link
Copy Markdown
Member

@refack can you open a new PR? Now this has been reverted I don't think we should keep using it, it's likely to confuse things like branch-diff (and collaborators!).

IDK if there's a standard way to do this, but don't land a PR twice seems like a reasonable rule.

@gibfahngibfahn closed this Jul 12, 2017
@refack

refack commented Jul 12, 2017

Copy link
Copy Markdown
Contributor

@refack can you open a new PR? Now this has been reverted I don't think we should keep using it, it's likely to confuse things like branch-diff (and collaborators!).

IDK if there's a standard way to do this, but don't land a PR twice seems like a reasonable rule.

I consulted with @addaleax and @Trott and this seems like the "standard" way 🤷‍♂️

@gibfahn

Copy link
Copy Markdown
Member

I consulted with @addaleax and @Trott and this seems like the "standard" way 🤷‍♂️

Happy to be wrong if others disagree.

@Trott

Copy link
Copy Markdown
Member

I consulted with @addaleax and @Trott and this seems like the "standard" way 🤷‍♂️

I'm not 100% sure that re-landing from the same PR is the standard way. But if @addaleax says it's OK, that's good enough for me.

@addaleax

Copy link
Copy Markdown
Member

I wouldn’t know that there’s a standard way to handle this either. Opening a new PR is certainly easier for everyone and will make sure the new commit won’t get overlooked, but reverts are probably rare enough that handling them manually is feasible.

@refack

Copy link
Copy Markdown
Contributor

@starkwang Would you like to open a new PR for this?

@starkwang

Copy link
Copy Markdown
ContributorAuthor

Yes, I'd like to do it. I'm trying to reproduce the flakiness locally.

@refack

Copy link
Copy Markdown
Contributor

@starkwang you could try spawn('type con', { shell: true }) that will start cmd.exe with the right arguments to run type con which is sort of the equivalent to cat with no args

@refack

Copy link
Copy Markdown
Contributor

P.S. @starkwang if you want your full name in the logs you could follow https://help.github.com/articles/setting-your-username-in-git/

@gibfahn

Copy link
Copy Markdown
Member

So at the moment your Git author name and email address are set to:

starkwang <381152119@qq.com>

People usually choose to use their full names for commits. To set your name globally you can do:

git config --global user.name "Weijia Wang"
git config --global user.email "381152119@qq.com"

To change the author for a single commit you can do:

git commit --amend --author="Weijia Wang <381152119@qq.com>"
git push --force-with-lease

It's entirely optional.

@starkwang

Copy link
Copy Markdown
ContributorAuthor

@gibfahn Thanks for your suggestion! :D
I've changed the user information in Git.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

processIssues and PRs related to the process subsystem.testIssues and PRs related to the tests.windowsIssues and PRs related to the Windows platform.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@starkwang@richardlau@refack@gibfahn@Trott@addaleax@jasnell@nodejs-github-bot