-
-
Notifications
You must be signed in to change notification settings - Fork 33k
Closed
Closed
Copy link
Labels
streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.
Description
- Version: v12.10.0
- Platform: macOS
- Subsystem: stream
I ran into a problem where certain Connection: close
HTTP responses were not being closed, when the response is a Content-Length
response (as opposed to a chunked response), see #29609 and #29649 for background.
I've been able to isolate this bug to a problem in "stream" and/or the duplex pair implementation (used by the "tls" module and in tests):
'use strict';
const common = require('./test/common');
const makeDuplexPair = require('./test/common/duplexpair');
const { clientSide, serverSide } = makeDuplexPair();
serverSide.resume();
serverSide.on('end', function(buf){
serverSide.write('out');
serverSide.write('');
serverSide.end();
});
clientSide.end();
clientSide.on('data', function(m){
console.log(m.toString());
});
clientSide.on('end', common.mustCall(function(){
console.log('(Connection closed)');
}));
Expected:
out
(Connection closed)
Actual:
out
Mismatched function calls. Expected exactly 1, actual 0.
A write call (empty or non-empty) followed by an empty write call causes this; note how removing either of the calls works around the bug.
I'm not sure if/when this was ever introduced, but this test fails in v10.16.3, v12.10.0, and master branch.
ronag
Metadata
Metadata
Assignees
Labels
streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.