Skip to content

Investigate flaky test-stream-finished #43623

Closed
@F3n67u

Description

Test

test-stream-finished

Platform

not specific on a single platform

Console output

node:assert:124
  throw new AssertionError(obj);
  ^

AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
+ actual - expected

+ Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
+     at new NodeError (node:internal/errors:387:5)
+     at ServerResponse.onclose (node:internal/streams/end-of-stream:147:30)
+     at ServerResponse.emit (node:events:549:35)
+     at emitCloseNT (node:_http_server:904:10)
+     at Socket.onServerResponseClose (node:_http_server:257:5)
+     at Socket.emit (node:events:549:35)
+     at TCP.<anonymous> (node:net:756:14) {
+   code: 'ERR_STREAM_PREMATURE_CLOSE'
+ }
- undefined
    at ServerResponse.<anonymous> (/Users/iojs/build/workspace/node-test-commit-osx/nodes/osx11-x64/test/parallel/test-stream-finished.js:656:14)
    at ServerResponse.<anonymous> (/Users/iojs/build/workspace/node-test-commit-osx/nodes/osx11-x64/test/common/index.js:438:15)
    at ServerResponse.<anonymous> (node:internal/util:445:5)
    at ServerResponse.onclose (node:internal/streams/end-of-stream:146:25)
    at ServerResponse.emit (node:events:549:35)
    at emitCloseNT (node:_http_server:904:10)
    at Socket.onServerResponseClose (node:_http_server:257:5)
    at Socket.emit (node:events:549:35)
    at TCP.<anonymous> (node:net:756:14) {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
      at new NodeError (node:internal/errors:387:5)
      at ServerResponse.onclose (node:internal/streams/end-of-stream:147:30)
      at ServerResponse.emit (node:events:549:35)
      at emitCloseNT (node:_http_server:904:10)
      at Socket.onServerResponseClose (node:_http_server:257:5)
      at Socket.emit (node:events:549:35)
      at TCP.<anonymous> (node:net:756:14) {
    code: 'ERR_STREAM_PREMATURE_CLOSE'
  },
  expected: undefined,
  operator: 'strictEqual'
}

Node.js v19.0.0-pre

Build links

https://ci.nodejs.org/job/node-test-commit-osx/45891/nodes=osx11-x64/testReport/junit/(root)/test/parallel_test_stream_finished/

https://ci.nodejs.org/job/node-test-commit-linux/46348/nodes=rhel8-x64/testReport/(root)/test/parallel_test_stream_finished/

https://ci.nodejs.org/job/node-test-commit-osx-arm/6307/nodes=osx11/testReport/junit/(root)/test/parallel_test_stream_finished/

Additional information

I can reproduce it on my macOS 12.2.1:

$ repeat 200 ./node test/parallel/test-stream-finished.js
node:assert:124
  throw new AssertionError(obj);
  ^

AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
+ actual - expected

+ Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
+     at new NodeError (node:internal/errors:387:5)
+     at ServerResponse.onclose (node:internal/streams/end-of-stream:147:30)
+     at ServerResponse.emit (node:events:549:35)
+     at emitCloseNT (node:_http_server:904:10)
+     at Socket.onServerResponseClose (node:_http_server:257:5)
+     at Socket.emit (node:events:549:35)
+     at TCP.<anonymous> (node:net:756:14) {
+   code: 'ERR_STREAM_PREMATURE_CLOSE'
+ }
- undefined
    at ServerResponse.<anonymous> (/Users/feng/Projects/node/test/parallel/test-stream-finished.js:656:14)
    at ServerResponse.<anonymous> (/Users/feng/Projects/node/test/common/index.js:438:15)
    at ServerResponse.<anonymous> (node:internal/util:445:5)
    at ServerResponse.onclose (node:internal/streams/end-of-stream:146:25)
    at ServerResponse.emit (node:events:549:35)
    at emitCloseNT (node:_http_server:904:10)
    at Socket.onServerResponseClose (node:_http_server:257:5)
    at Socket.emit (node:events:549:35)
    at TCP.<anonymous> (node:net:756:14) {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
      at new NodeError (node:internal/errors:387:5)
      at ServerResponse.onclose (node:internal/streams/end-of-stream:147:30)
      at ServerResponse.emit (node:events:549:35)
      at emitCloseNT (node:_http_server:904:10)
      at Socket.onServerResponseClose (node:_http_server:257:5)
      at Socket.emit (node:events:549:35)
      at TCP.<anonymous> (node:net:756:14) {
    code: 'ERR_STREAM_PREMATURE_CLOSE'
  },
  expected: undefined,
  operator: 'strictEqual'
}

Node.js v19.0.0-pre

Related test:

{
const server = http.createServer(common.mustCall(function(req, res) {
fs.createReadStream(__filename).pipe(res);
finished(res, common.mustCall(function(err) {
assert.strictEqual(err, undefined);
}));
})).listen(0, function() {
http.request(
{ method: 'GET', port: this.address().port },
common.mustCall(function(res) {
res.resume();
server.close();
})
).end();
});
}

It seems like caused by a regression, this sub-test is added at #40941 by @ronag 8 months ago.

Metadata

Assignees

No one assigned

    Labels

    flaky-testIssues and PRs related to the tests with unstable failures on the CI.streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions