-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When the TLS stream is destroyed for whatever reason, we should unset all callbacks on the underlying transport stream. PR-URL: #17478 Fixes: #17475 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
- Loading branch information
1 parent
ca667b9
commit 36abbce
Showing
2 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Flags: --expose-gc | ||
'use strict'; | ||
|
||
// Regression test for https://github.com/nodejs/node/issues/17475 | ||
// Unfortunately, this tests only "works" reliably when checked with valgrind or | ||
// a similar tool. | ||
|
||
const common = require('../common'); | ||
if (!common.hasCrypto) | ||
common.skip('missing crypto'); | ||
|
||
const { TLSSocket } = require('tls'); | ||
const makeDuplexPair = require('../common/duplexpair'); | ||
|
||
let { clientSide } = makeDuplexPair(); | ||
|
||
let clientTLS = new TLSSocket(clientSide, { isServer: false }); | ||
// eslint-disable-next-line no-unused-vars | ||
let clientTLSHandle = clientTLS._handle; | ||
|
||
setImmediate(() => { | ||
clientTLS = null; | ||
global.gc(); | ||
clientTLSHandle = null; | ||
global.gc(); | ||
setImmediate(() => { | ||
clientSide = null; | ||
global.gc(); | ||
}); | ||
}); |