Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7435491
lib: use arrow functions instead of bind
JungMinu Aug 21, 2015
8c71854
doc: fix link in addons.markdown
secretfader Dec 17, 2015
1dd09a8
doc: Typo in buffer.markdown referencing buf.write()
chrisJohn404 Dec 17, 2015
46c44c8
doc: fix, modernize examples in docs
jasnell Dec 14, 2015
645577f
http: Remove an unnecessary assignment
gigabo Dec 17, 2015
1a07eab
debugger: guard against call from non-node context
bnoordhuis Dec 17, 2015
d187c6e
test: try other ipv6 localhost alternatives
mscdex Dec 17, 2015
89c32bc
node: fix erroneously named function call
trevnorris Nov 10, 2015
369f795
http_parser: use pushValueToArray for headers
trevnorris Nov 10, 2015
3f19d4a
fs: use pushValueToArray for readdir(Sync)
trevnorris Nov 10, 2015
4f07866
node: improve GetActiveHandles performance
trevnorris Nov 11, 2015
b73bb71
node: improve performance of hrtime()
trevnorris Nov 11, 2015
e808658
node: improve accessor perf of process.env
trevnorris Nov 11, 2015
6406dbb
crypto: load PFX chain the same way as regular one
indutny Dec 5, 2015
569e5eb
test: fix flaky test-net-error-twice
mscdex Dec 18, 2015
72b6b4f
module: always decorate thrown errors
mscdex Dec 15, 2015
09c9110
repl: use String#repeat instead of Array#join
evanlucas Nov 18, 2015
dd935c2
assert: typed array deepequal performance fix
claudiorodriguez Dec 17, 2015
8168669
http: remove excess calls to removeSocket
Dec 6, 2015
2888ec3
src: remove forwards for v8::GC*logueCallback
ofrobots Dec 21, 2015
1009a82
repl: Fixed node repl history edge case.
zeusdeux Dec 1, 2015
b7fd395
2015-12-22, Version 5.3.1 (Stable)
Fishrock123 Dec 22, 2015
d3d2216
Working on v5.3.2
Fishrock123 Dec 22, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: fix flaky test-net-error-twice
On Windows there can exist some race condition where the
notification of the client's `socket.destroy()` isn't received
before the server writes to the socket. This race condition was
more evident/reproducible on a single core system.

This commit fixes the flakiness by waiting until the server's
connection event handler has been called to destroy the client
socket and perform the server socket write.

Fixes: #4057
PR-URL: #4342
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: João Reis <reis@janeasystems.com>
  • Loading branch information
mscdex authored and Fishrock123 committed Dec 22, 2015
commit 569e5eb9bba3e807a148276f43e13fce59bcb660
25 changes: 18 additions & 7 deletions test/parallel/test-net-error-twice.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
'use strict';
var common = require('../common');
var assert = require('assert');
var net = require('net');
const common = require('../common');
const assert = require('assert');
const net = require('net');

var buf = new Buffer(10 * 1024 * 1024);
const buf = new Buffer(10 * 1024 * 1024);

buf.fill(0x62);

var errs = [];
const errs = [];
var clientSocket;
var serverSocket;

function ready() {
if (clientSocket && serverSocket) {
clientSocket.destroy();
serverSocket.write(buf);
}
}

var srv = net.createServer(function onConnection(conn) {
conn.write(buf);
conn.on('error', function(err) {
errs.push(err);
if (errs.length > 1 && errs[0] === errs[1])
Expand All @@ -19,11 +27,14 @@ var srv = net.createServer(function onConnection(conn) {
conn.on('close', function() {
srv.unref();
});
serverSocket = conn;
ready();
}).listen(common.PORT, function() {
var client = net.connect({ port: common.PORT });

client.on('connect', function() {
client.destroy();
clientSocket = client;
ready();
});
});

Expand Down