-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make message large message handling robust and noisy #189
Conversation
Stebalien
commented
Jun 6, 2019
- Reject outgoing messages that are too large.
- Drop outgoing RPCs that are too large and log.
- Increase the max RPC size to 1MiB+64KiB (to allow for 1MiB messages).
1. Reject outgoing messages that are too large. 2. Drop outgoing RPCs that are too large and _log_. 3. Increase the max RPC size to 1MiB+64KiB (to allow for 1MiB messages).
85e8f8a
to
da3290e
Compare
travis fails with:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a bug...
pubsub.go
Outdated
func (p *PubSub) Publish(topic string, data []byte) error { | ||
if len(data) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BUG: that should be
if len(data) > maxMessageSize
@@ -70,11 +70,20 @@ func (fs *FloodSubRouter) Publish(from peer.ID, msg *pb.Message) { | |||
continue | |||
} | |||
|
|||
if out.Size() > maxRPCSize { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this check really necessary here?
We already drop large messages on publish and can't read messages larger than maxRCPSize anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it should be fine in floodsub. My worry is gossipsub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, let's remove it from here as it's redundant, and rethink the gossipsub case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't hurt and future proofs us against, e.g., batching too many messages in a single RPC and then silently failing when the remote side drops it.
ctl := out.GetControl() | ||
if ctl != nil { | ||
gs.pushControl(p, ctl) | ||
if out.Size() > maxRPCSize { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here too, this check seems unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worried we could add too much gossip. That's why I have that check. But I can remove it if you think it's overkill.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but the check is done before we even add the gossip!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, this check is reasonable on second thought, if we are adding too much gossip (over 64KB) we probably want to know.