Skip to content
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

test: Fix common.PIPE to be process unique #14168

Merged
merged 1 commit into from
Jul 14, 2017

Conversation

refack
Copy link
Contributor

@refack refack commented Jul 11, 2017

  • Fix common.PIPE to be process unique
  • tiny bit of refactoring in adjacent lines

Fixes: #14128

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,stream,net

@refack refack added wip Issues and PRs that are still a work in progress. net Issues and PRs related to the net subsystem. stream Issues and PRs related to the stream subsystem. test Issues and PRs related to the tests. labels Jul 11, 2017
}
} else {
exports.PIPE = `${exports.tmpDir}/test.sock`;
{
Copy link
Member

Choose a reason for hiding this comment

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

Is block scoping really needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since the const are only used locally and there's a single exported side-effect (exports.PIPE = ...) IMHO it's cleaner.
Similar to the function setupFoo(); setupFoo(); approach in node_bootstap.js
Maybe even V8 will inline the consts ?

Copy link
Member

Choose a reason for hiding this comment

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

I like it, easier to see that the consts aren't used except in exports.PIPE.

@@ -246,7 +246,7 @@ Object.defineProperty(exports, 'opensslCli', {get: function() {

Object.defineProperty(exports, 'hasCrypto', {
get: function() {
return process.versions.openssl ? true : false;
return Boolean(process.versions.openssl);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not a huge fan of !! outside of minimal code competitions.
Willing to change if anyone has a strong opinion.

Copy link
Member

Choose a reason for hiding this comment

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

No strong opinion from me. I think it used to be preferred in hot paths for performance. No idea if that's still the case. Regardless, it's totally sensible to value readable code over performant code in test/common/index.js.

@refack
Copy link
Contributor Author

refack commented Jul 11, 2017

Failures:

not ok 220 parallel/test-cluster-eaccess
  ---
  duration_ms: 0.218
  severity: fail
  stack: |-
    child listening
    child exiting
    PIPE should have been in use.
    master exited
    assert.js:48
      throw new errors.AssertionError({
      ^
    
    AssertionError [ERR_ASSERTION]: 'EADDRINUSE' === undefined
        at Worker.<anonymous> (/data/iojs/build/workspace/node-test-commit-linuxone/nodes/rhel72-s390x/test/parallel/test-cluster-eaccess.js:48:12)
        at Worker.<anonymous> (/data/iojs/build/workspace/node-test-commit-linuxone/nodes/rhel72-s390x/test/common/index.js:515:15)
        at emitTwo (events.js:130:20)
        at Worker.emit (events.js:213:7)
        at ChildProcess.Worker.process.on (internal/cluster/worker.js:28:12)
        at emitTwo (events.js:125:13)
        at ChildProcess.emit (events.js:213:7)
        at emit (internal/child_process.js:776:12)
        at _combinedTickCallback (internal/process/next_tick.js:141:11)
        at process._tickCallback (internal/process/next_tick.js:180:9)
  ...
not ok 1509 sequential/test-benchmark-http
  ---
  duration_ms: 3.632
  severity: fail
  stack: |-
    
    http/bench-parser.js
    http/bench-parser.js n=1 len=1: 10,362.694300518135
    
    http/check_invalid_header_char.js
    http/check_invalid_header_char.js n=1 key="\"\"": 9,291.521486643438
    
    http/check_is_http_token.js
    http/check_is_http_token.js n=1 key="\"\"": 9,632.797749778445
    
    http/chunked.js
    http/chunked.js c=1 len=1 n=1 benchmarker="test-double": 1
    
    http/client-request-body.js
    http/client-request-body.js method="write" len=1 type="asc" dur=0.1: 3,782.800838240719
    http/client-request-body.js method="end" len=1 type="asc" dur=0.1: 3,753.1900606189497
    http/client-request-body.js method="write" len=1 type="utf" dur=0.1: 4,350.617135040606
    http/client-request-body.js method="end" len=1 type="utf" dur=0.1: 4,771.837295122962
    http/client-request-body.js method="write" len=1 type="buf" dur=0.1: 4,070.584983768017
    http/client-request-body.js method="end" len=1 type="buf" dur=0.1: 4,119.2370015667975
    
    http/cluster.js
    http/cluster.js c=1 len=1 type="bytes" benchmarker="test-double": 1
    http/cluster.js c=1 len=1 type="buffer" benchmarker="test-double": 1
    
    http/create-clientrequest.js
    http/create-clientrequest.js n=1 len=1: 1,233.710396354139
    
    http/end-vs-write-end.js
    http/end-vs-write-end.js method="write" c=1 len=1 type="asc" benchmarker="test-double": 1
    http/end-vs-write-end.js method="end" c=1 len=1 type="asc" benchmarker="test-double": 1
    http/end-vs-write-end.js method="write" c=1 len=1 type="utf" benchmarker="test-double": 1
    http/end-vs-write-end.js method="end" c=1 len=1 type="utf" benchmarker="test-double": 1
    http/end-vs-write-end.js method="write" c=1 len=1 type="buf" benchmarker="test-double": 1
    http/end-vs-write-end.js method="end" c=1 len=1 type="buf" benchmarker="test-double": 1
    
    http/http_server_for_chunky_client.js
    events.js:182
          throw er; // Unhandled 'error' event
          ^
    
    Error: connect ENOENT /data/iojs/node-tmp/tmp.0/node-test.47355.sock
        at Object.exports._errnoException (util.js:1023:11)
        at exports._exceptionWithHostPort (util.js:1046:20)
        at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1150:14)
    assert.js:48
      throw new errors.AssertionError({
      ^
    
    AssertionError [ERR_ASSERTION]: 1 === 0
        at ChildProcess.<anonymous> (/data/iojs/build/workspace/node-test-commit-linuxone/nodes/rhel72-s390x/benchmark/http/http_server_for_chunky_client.js:43:10)
        at emitTwo (events.js:125:13)
        at ChildProcess.emit (events.js:213:7)
        at maybeClose (internal/child_process.js:929:16)
        at Process.ChildProcess._handle.onexit (internal/child_process.js:212:5)
    assert.js:48
      throw new errors.AssertionError({
      ^
    
    AssertionError [ERR_ASSERTION]: 1 === 0
        at ChildProcess.child.on (/data/iojs/build/workspace/node-test-commit-linuxone/nodes/rhel72-s390x/test/sequential/test-benchmark-http.js:34:10)
        at emitTwo (events.js:125:13)
        at ChildProcess.emit (events.js:213:7)
        at Process.ChildProcess._handle.onexit (internal/child_process.js:201:12)
  ...

@gibfahn
Copy link
Member

gibfahn commented Jul 11, 2017

For the commit message, maybe:

test: make common.PIPE process unique

Also includes a tiny bit of refactoring in adjacent lines.

Fixes: https://github.com/nodejs/node/issues/14128

@refack refack changed the title test: tweak common test: Fix common.PIPE to be process unique Jul 12, 2017
@refack refack removed the wip Issues and PRs that are still a work in progress. label Jul 12, 2017
@refack
Copy link
Contributor Author

refack commented Jul 12, 2017

@refack
Copy link
Contributor Author

refack commented Jul 12, 2017

Known flakes:
smartOS - #14177
Windows - #14178

@refack
Copy link
Contributor Author

refack commented Jul 14, 2017

* includes a tiny bit of refactoring in adjacent lines.
* fixes 1 test and 1 benchmark that depended on PIPE being constant.

PR-URL: nodejs#14168
Fixes: nodejs#14128
Reviewed-By: James M Snell <[email protected]>
@refack refack merged commit c34ae48 into nodejs:master Jul 14, 2017
@refack refack deleted the test-common-rotate-EPIPE branch July 14, 2017 23:38
@addaleax addaleax mentioned this pull request Jul 18, 2017
addaleax pushed a commit that referenced this pull request Jul 18, 2017
* includes a tiny bit of refactoring in adjacent lines.
* fixes 1 test and 1 benchmark that depended on PIPE being constant.

PR-URL: #14168
Fixes: #14128
Reviewed-By: James M Snell <[email protected]>
Fishrock123 pushed a commit that referenced this pull request Jul 19, 2017
* includes a tiny bit of refactoring in adjacent lines.
* fixes 1 test and 1 benchmark that depended on PIPE being constant.

PR-URL: #14168
Fixes: #14128
Reviewed-By: James M Snell <[email protected]>
@MylesBorins
Copy link
Contributor

This does not land cleanly in LTS. Please feel free to manually backport by following the guide. Please also feel free to replace do-not-land if it is being backported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
net Issues and PRs related to the net subsystem. stream Issues and PRs related to the stream subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test: flaky - parallel/test-pipe-stream
6 participants