Closed tabcat closed 1 month ago
Version: latest
Subsystem: @libp2p/tcp
The hanging promise is to do with shutting down the tcp server
https://github.com/libp2p/js-libp2p/blob/1cbfd6cf392b0db80f744cfe4a0841ed80760c84/packages/transport-tcp/src/listener.ts#L364-L372
For server.close to resolve all socket connections must be closed. The connections are closed inside of the close method.
server.close
https://github.com/libp2p/js-libp2p/blob/1cbfd6cf392b0db80f744cfe4a0841ed80760c84/packages/transport-tcp/src/listener.ts#L306-L308
The connections are tracked in the onSocket listener method with the property this.connections.
https://github.com/libp2p/js-libp2p/blob/1cbfd6cf392b0db80f744cfe4a0841ed80760c84/packages/transport-tcp/src/listener.ts#L197-L202
The race condition is triggered when close is called before the connection is upgraded. At that point the socket is not added to this.connections.
https://github.com/tabcat/delay5
Version: latest
Subsystem: @libp2p/tcp
Severity: Low
Description
The hanging promise is to do with shutting down the tcp server
https://github.com/libp2p/js-libp2p/blob/1cbfd6cf392b0db80f744cfe4a0841ed80760c84/packages/transport-tcp/src/listener.ts#L364-L372
For
server.close
to resolve all socket connections must be closed. The connections are closed inside of the close method.https://github.com/libp2p/js-libp2p/blob/1cbfd6cf392b0db80f744cfe4a0841ed80760c84/packages/transport-tcp/src/listener.ts#L306-L308
The connections are tracked in the onSocket listener method with the property this.connections.
https://github.com/libp2p/js-libp2p/blob/1cbfd6cf392b0db80f744cfe4a0841ed80760c84/packages/transport-tcp/src/listener.ts#L197-L202
The race condition is triggered when close is called before the connection is upgraded. At that point the socket is not added to this.connections.
Steps to reproduce the error:
https://github.com/tabcat/delay5