PROTON-2785: Fix pn_data_clear not clearing error #431
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.
We've also hit the bug of the Go library that is described in PROTON-2785. This bug happens when one large message is sent and another message with arbitrary size gets marshaled.
Reason is that the large message does multiple calls with a too small message size to
pn_data_encode
which leads to the errorPN_OVERFLOW
to be set inpn_encoder_encode
on the data field until a large enough buffer is provided. As thepn_message_t
is reused the error hits the second message encoding.Relevant Go code:
qpid-proton/go/pkg/amqp/message.go
Lines 378 to 393 in 9fdc19c
Relevant C code:
qpid-proton/c/src/core/encoder.c
Lines 395 to 409 in 9fdc19c
This PR adds clearing the error field when
pn_data_clear
is called. According to the docs "A cleared pn_data_t object is equivalent to a newly constructed one.", so that would match this fix.Other possible way would be to not set those
PN_OVERFLOW
errors onpn_data_t
at all. I don't have enough overview of the internals to know if this makes sense or not. Especially, as there are a few other errors that are set onpn_data_t
too which might cause similar issues.