paritytech / litep2p

Peer-to-peer networking library
MIT License
70 stars 10 forks source link

TCP/WebSocket: Fix memory leak of canceled state and canceled futures #270

Open lexnv opened 4 hours ago

lexnv commented 4 hours ago

Similar to https://github.com/paritytech/litep2p/issues/269, the state tracking around canceling dials is monotonically increasing:

The AbortableHandler logic was introduced on top of the cancellation by connection ID, therefore I expect the fix to be similar for both cases.

TCP

Screenshot 2024-10-22 at 12 43 50 Screenshot 2024-10-22 at 12 41 49

WebSocket

Screenshot 2024-10-22 at 14 03 38 Screenshot 2024-10-22 at 14 02 45

cc @paritytech/networking

lexnv commented 3 hours ago

The cancel by abort handler is not yet merged, therefore the leak might come entirely from the "cancel by connection ID"