Skip to content

Fix incorrect size calculation of cloned messages#404

Merged
Ostrzyciel merged 2 commits intomainfrom
piotr/fix-misreported-option-size
May 25, 2025
Merged

Fix incorrect size calculation of cloned messages#404
Ostrzyciel merged 2 commits intomainfrom
piotr/fix-misreported-option-size

Conversation

@Ostrzyciel
Copy link
Member

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.

Copy link
Collaborator

@Karolina-Bogacka Karolina-Bogacka 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 the sentiment that it's better to simplify in this case.

@Ostrzyciel Ostrzyciel enabled auto-merge (squash) May 25, 2025 08:50
@Ostrzyciel Ostrzyciel merged commit 92d2875 into main May 25, 2025
7 checks passed
@Ostrzyciel Ostrzyciel deleted the piotr/fix-misreported-option-size branch May 25, 2025 08:51
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
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