http: do not overflow the 5MB limit when adding large messages to the builder #125
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The intake enforces a 5MB limit which is avoided during the serialization by creating enough different payload for each of them to be <5MB.
However, the previous logic was not properly taking into account the size of the currently serialised event. Most of time slipped under the radar because only small events are sent, and the limit is a bit lenient. But when sending big messages, it is possible to trigger this bug.
E.g. with ~800kB messages and
maxMessageSize
configured to800*1024
, with previous code, it was possible to create payloads bigger than 5MB:with the new logic, they're properly contained in <5MB payloads: