libp2p / go-libp2p-pubsub

The PubSub implementation for go-libp2p
https://github.com/libp2p/specs/tree/master/pubsub
Other
309 stars 178 forks source link

Bug Report: Stuck Goroutine in libp2p-pubsub handleSendingMessages #544

Open frystal opened 9 months ago

frystal commented 9 months ago

Description:

A critical issue has been identified in the libp2p-pubsub library. Specifically, in the process of a peer publishing a new RPC message to other peers through the function "handleSendingMessages", the function attempts to send messages on an existing stream towards remote peers.

image

However, if the libp2p-pubsub is configured to use the default "Yamux" as the muxer, the "Write" function operates synchronously without a time limitation. In the event that the write operation in "go-yamux" becomes stuck, it leads to the entire goroutine of "handleSendingMessages" becoming stuck. Consequently, any remaining messages destined for the target remote peer will be dropped due to the queue becoming full.

image

Expected Outcome:

The libp2p-pubsub library should handle situations where the Write operation becomes stuck in "go-yamux" without causing the entire goroutine of "handleSendingMessages" to become stuck.

Actual Outcome:

The current implementation results in the entire goroutine of "handleSendingMessages" getting stuck, leading to dropped messages due to a full queue.

Environment:

go-libp2p-pubsub@v0.9.3

vyzo commented 9 months ago

Sure, but if the sender is stuck you won't be able to send messages anyway.

What do you propose to do?

frystal commented 9 months ago

Could you please assign it the 'bug' label?

vyzo commented 9 months ago

Done, but I am not sure we can resolve this. I will welcome a pr.