Skip to content
Permalink
Browse files

test: deflake test-tls-close-notify.js

This test occasionally fails on macOS with the following error

```
events.js:187
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:201:27)
Emitted 'error' event on TLSSocket instance at:
    at emitErrorNT (internal/streams/destroy.js:84:8)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: -54,
  code: 'ECONNRESET',
  syscall: 'read'
}
```

Fix it by making the client send the close_notify alert instead of the
server.

PR-URL: #30202
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
lpinca authored and MylesBorins committed Nov 1, 2019
1 parent d713e5a commit 342031eac05ca5f60d5aa626eeebc4a206c54e1d
Showing with 9 additions and 10 deletions.
  1. +9 −10 test/parallel/test-tls-close-notify.js
@@ -35,19 +35,18 @@ const server = tls.createServer({
key: fixtures.readKey('agent1-key.pem'),
cert: fixtures.readKey('agent1-cert.pem')
}, function(c) {
// Send close-notify without shutting down TCP socket
const req = new ShutdownWrap();
req.oncomplete = common.mustCall(() => {});
req.handle = c._handle;
c._handle.shutdown(req);
// Ensure that we receive 'end' event anyway.
c.on('end', common.mustCall(function() {
server.close();
}));
}).listen(0, common.mustCall(function() {
const c = tls.connect(this.address().port, {
rejectUnauthorized: false
}, common.mustCall(function() {
// Ensure that we receive 'end' event anyway
c.on('end', common.mustCall(function() {
c.destroy();
server.close();
}));
// Send close-notify without shutting down TCP socket.
const req = new ShutdownWrap();
req.oncomplete = common.mustCall(() => {});
req.handle = c._handle;
c._handle.shutdown(req);
}));
}));

0 comments on commit 342031e

Please sign in to comment.
You can’t perform that action at this time.