Fix incorrect size calculation of cloned messages#404
Merged
Ostrzyciel merged 2 commits intomainfrom May 25, 2025
Merged
Conversation
Karolina-Bogacka
approved these changes
May 25, 2025
Collaborator
Karolina-Bogacka
left a comment
There was a problem hiding this comment.
I agree with the sentiment that it's better to simplify in this case.
Ostrzyciel
added a commit
to Jelly-RDF/cli
that referenced
this pull request
May 25, 2025
This will resolve the issue observed in #126 owing to the fix here: Jelly-RDF/jelly-jvm#404
Karolina-Bogacka
pushed a commit
to Jelly-RDF/cli
that referenced
this pull request
May 25, 2025
This will resolve the issue observed in #126 owing to the fix here: Jelly-RDF/jelly-jvm#404
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In a few places in the code we clone messages, change their fields, and then forget to reset the cached size. This leads to weird race conditions such as the one caught here: Jelly-RDF/cli#126
We could either be very careful to always reset the size before modifying the cloned message, or just never copy the cached size in the first place. The second approach is much more resistant to human error, so that's what I'm going with here.
Another argument for this solution is that this type of error causes issues that occur only sometimes, so they might slip through the cracks in CI testing. It's better to eliminate the entire class of issues in one go.