Closed ibc closed 5 years ago
May this commented this._down() affect?
Here a gist that perfectly reproduces the problem:
https://gist.github.com/ibc/e0eb0a0d1f2b2e66f04650c468e65a9a
As you can see, the script never ends:
$ node test.js
sctpSocket created and connecting
closing udpSocket and sctpSocket...
udpSocket.close() called
sctpSocket.end() called
sctpSocket.destroy() failed: Error [ERR_SOCKET_DGRAM_NOT_RUNNING]: Not running
done, this script should exit now, does it?
(no, it does never exit)
Oh, I got the issue! It's in lib/endpoint.js
in the Endpoint
constructor:
setInterval(() => {
// TODO change interval when valid_cookie_life changes
this.cookieSecretKey = crypto.randomBytes(32)
}, this.valid_cookie_life * 5)
This periodic timer is never cleared. By commenting it out, the test above does end.
And PR #12 sent :)
give me couple of days please)
Sure :)
By creating some unit tests (SCTP over plain UDP, in both UDP unconnected and connected mode in Node >= 12), I'm realizing that once
sctpSocket = sctp.connect()
is called, the test script cannot exit because, somehow, some handler remains active.I'm closing the
udpSocket
I providesctp.connect()
with, and also trying to "terminate" thesctpSocket
by callingend()
on it when the test ends, alsodestroy()
. Nothing works. It looks like if some internal timer within node-sctp (probably stuff doing the INIT ACK exchange) remains working inside and it's not terminated.Any thoughts?