Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Lower the max size of transaction packet to prevent going oversize. #9308

Merged
merged 2 commits into from
Aug 14, 2018

Conversation

tomusdrw
Copy link
Collaborator

@tomusdrw tomusdrw commented Aug 8, 2018

Solves: #9255 (comment)

Still I'm quite unsure what could cause the packet to go oversize, it seems it might be a combination of:

  1. Inefficient snappy compression
  2. Imperfect estimate_size in RLP
  3. Some additional packet headers overhead that is counted to the result but shouldn't (I suppose the packet itself can be bigger than 16MB it's just the payload that is limited)

Might be worth further debugging if someone is into it. @debris / @ngotchac ?

@tomusdrw tomusdrw added A0-pleasereview 🤓 Pull request needs code review. M4-core ⛓ Core client code / Rust. labels Aug 8, 2018
@ngotchac
Copy link
Contributor

ngotchac commented Aug 8, 2018

It would indeed be nice to know what's causing the issue, so adding some traces in the propagator to check the estimated RLP size and the actual size when it overflows in util/network-devp2p/src/session.rs

Copy link
Contributor

@andresilva andresilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@dvdplm dvdplm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @ngotchac that it'd be nice to know more about the root cause of the problem but it seems worth trying with a lower packet size.

@@ -148,7 +148,8 @@ const MAX_PEER_LAG_PROPAGATION: BlockNumber = 20;
const MAX_NEW_HASHES: usize = 64;
const MAX_NEW_BLOCK_AGE: BlockNumber = 20;
// maximal packet size with transactions (cannot be greater than 16MB - protocol limitation).
const MAX_TRANSACTION_PACKET_SIZE: usize = 8 * 1024 * 1024;
// keep it under 8MB as well, cause it seems that it may result oversized after compression.
const MAX_TRANSACTION_PACKET_SIZE: usize = 5 * 1024 * 1024;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand. Before it was 8 * ..., which is 8MBs, not 16, right?

Copy link
Contributor

@andresilva andresilva Aug 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is the maximum size of a single transaction RLP. So if the final size is correct (and not increased by compression), you'd be able to fit at most three 5MB transactions, and have 1MB remaining for the rest of the packet.

@debris debris merged commit 29125e8 into master Aug 14, 2018
@debris debris deleted the td-maxpacket branch August 14, 2018 15:20
@5chdn 5chdn added this to the 2.1 milestone Aug 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-pleasereview 🤓 Pull request needs code review. M4-core ⛓ Core client code / Rust.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants