Skip to content

bug: yamux Futures leak #1165

@gabrielmer

Description

@gabrielmer

When running tests on nwaku and activating dumpPendingFutures from nim-chronos, we noticed that the pending futures grow indefinitely in yamux.

Most of them come from the following line

try: # https://github.com/status-im/nim-chronos/issues/516
discard await race(channel.closedRemotely.wait(), channel.receivedData.wait())

For example

Future[4433822480] with name "AsyncEvent.wait" created at <asyncsync.nim:171> and state = Pending

I see these Futures get created at a really fast pace, and not seeing them getting completed. Even if they do eventually get completed, if we create futures at a faster rate than what it takes to complete them, the pending futures would grow indefinitely.

When using mplex instead, the amount of pending Futures is stable and doesn't grow indefinitely

Version: nim-libp2p 94d93cb

Attaching logs with prints of the pending Futures for both yamux and mplex

logs_yamux.txt
logs_mplex.txt

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions