Closed nisdas closed 3 years ago
Yeah, we could make it synchronous at some level and make sure it doesn't get dropped because of full validator queues.
@vyzo any reason not to just skip validation for our own messages? If we really want, we could even validate before pushing...
I think that validating our own messages is paramount for correctness -- otherwise we can have some nasty bugs that will be very hard to diagnose.
From synchronous discussion with @Stebalien we concluded that the right way to solve this issue is to perform validation for own messages synchronously on publish, and return an error if validation fails.
See #406 for implementation -- @nisdas this should finally resolve this very thorny issue.
Thanks for bringing this up.
Currently before a message can be broadcasted to all peers in a mesh, it has to pass a series of steps before it can be sent to its peers.
Host Publishes Message: https://github.com/libp2p/go-libp2p-pubsub/blob/master/topic.go#L245
Message is handled in the event queue: https://github.com/libp2p/go-libp2p-pubsub/blob/master/pubsub.go#L591
While message is being processed, it is run by its validators: https://github.com/libp2p/go-libp2p-pubsub/blob/master/pubsub.go#L1047
However if the validation queue is full this message is dropped. https://github.com/libp2p/go-libp2p-pubsub/blob/master/validation.go#L201
This can lead to messages going missing in the above case. While it does make sense to drop inbound messages in the event our validation queue is full, dropping messages originating from the host (rather than re-propagated) does not seem correct. As given the host is the source and originator of the particular message it should be special cased.
The issue is similar to #217, something like
WaitUntilQueued
would be very useful here to specify the importance of the message.