Skip to content
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

Closed
wants to merge 4 commits into from

Conversation

Stebalien
Copy link
Member

  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).

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).
@vyzo
Copy link
Collaborator

vyzo commented Jun 7, 2019

travis fails with:

./gossipsub.go:361:6: no new variables on left side of :=

Copy link
Collaborator

@vyzo vyzo left a 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 {
Copy link
Collaborator

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

pubsub.go Show resolved Hide resolved
@@ -70,11 +70,20 @@ func (fs *FloodSubRouter) Publish(from peer.ID, msg *pb.Message) {
continue
}

if out.Size() > maxRPCSize {
Copy link
Collaborator

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.

Copy link
Member Author

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.

Copy link
Collaborator

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.

Copy link
Member Author

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 {
Copy link
Collaborator

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.

Copy link
Member Author

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.

Copy link
Collaborator

@vyzo vyzo Jun 12, 2019

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!

Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants