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: deflake test-http-dump-req-when-res-ends.js #30360

Closed

Conversation

@lpinca
Copy link
Member

lpinca commented Nov 11, 2019

On some platforms the 'end' event might not be emitted because the
socket could be destroyed by the other peer while the client is still
sending the data triggering an error. Use the 'close' event instead.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
@lpinca

This comment has been minimized.

Copy link
Member Author

lpinca commented Nov 11, 2019

An alternative, arguably more explicit, fix could be:

diff --git a/test/parallel/test-http-dump-req-when-res-ends.js b/test/parallel/test-http-dump-req-when-res-ends.js
index 718797fae1..7aa02e35ee 100644
--- a/test/parallel/test-http-dump-req-when-res-ends.js
+++ b/test/parallel/test-http-dump-req-when-res-ends.js
@@ -48,10 +48,12 @@ server.listen(0, mustCall(function() {
 
     res.resume();
 
-    // Wait for the response.
-    res.on('end', function() {
-      server.close();
+    res.on('error', function(err) {
+      console.log(err);
     });
+
+    res.on('aborted', close);
+    res.on('end', close);
   }));
 
   req.on('error', function() {
@@ -60,3 +62,7 @@ server.listen(0, mustCall(function() {
     // this is safe to ignore.
   });
 }));
+
+function close() {
+  server.close();
+}
On some platforms the `'end'` event might not be emitted because the
socket could be destroyed by the other peer while the client is still
sending the data triggering an error. Use the `'close'` event instead.
@lpinca lpinca force-pushed the lpinca:deflake/test-http-dump-req-when-res-ends branch from 7fa136d to bd774d9 Nov 11, 2019
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

lpinca added a commit that referenced this pull request Nov 15, 2019
On some platforms the `'end'` event might not be emitted because the
socket could be destroyed by the other peer while the client is still
sending the data triggering an error. Use the `'close'` event instead.

PR-URL: #30360
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@lpinca

This comment has been minimized.

Copy link
Member Author

lpinca commented Nov 15, 2019

Landed in a4a089a.

@lpinca lpinca closed this Nov 15, 2019
@lpinca lpinca deleted the lpinca:deflake/test-http-dump-req-when-res-ends branch Nov 15, 2019
MylesBorins added a commit that referenced this pull request Nov 17, 2019
On some platforms the `'end'` event might not be emitted because the
socket could be destroyed by the other peer while the client is still
sending the data triggering an error. Use the `'close'` event instead.

PR-URL: #30360
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@BridgeAR BridgeAR mentioned this pull request Nov 19, 2019
targos added a commit that referenced this pull request Dec 1, 2019
On some platforms the `'end'` event might not be emitted because the
socket could be destroyed by the other peer while the client is still
sending the data triggering an error. Use the `'close'` event instead.

PR-URL: #30360
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@BethGriggs BethGriggs mentioned this pull request Dec 9, 2019
MylesBorins added a commit that referenced this pull request Dec 17, 2019
On some platforms the `'end'` event might not be emitted because the
socket could be destroyed by the other peer while the client is still
sending the data triggering an error. Use the `'close'` event instead.

PR-URL: #30360
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@BethGriggs BethGriggs mentioned this pull request Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.