Skip to content

Commit c0acd73

Browse files
committed
test: fix flaky test-http2-close-while-writing
Use stream.once() instead of stream.on() for the 'data' event handler to prevent multiple calls when receiving large data chunks. The test sends 64KB of data which may arrive in multiple chunks, causing the destroy callback to fire multiple times and leading to intermittent timeouts on macOS. Refs: nodejs/reliability#1459
1 parent 4fca20c commit c0acd73

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

test/parallel/test-http2-close-while-writing.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ let client_stream;
2424
server.on('session', common.mustCall(function(session) {
2525
session.on('stream', common.mustCall(function(stream) {
2626
stream.resume();
27-
stream.on('data', function() {
27+
stream.once('data', function() {
2828
this.write(Buffer.alloc(1));
2929
process.nextTick(() => client_stream.destroy());
3030
});

0 commit comments

Comments
 (0)