Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: decoder should clear the pointers before reslicing #460

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

muktihari
Copy link
Owner

@muktihari muktihari commented Sep 19, 2024

Previously, d.fieldDescriptions was resliced on reset, resulting d.releaseTemporaryObjects to do nothing regarding that field so the pointers (if any) will be keep until next decoding process reaching the previous slice index then replacing the
value.

In general, this should not be a problem since the values will be replaced anyway when we do decode again, and the pointer will eventually be released at some point or when the decoder is no longer used (garbage-collected), but it becomes nondeterministic, so let's fix it.

We can move the resetting of d.fieldDescriptions and d.developerDataIndexes to d.releaseTemporaryObjects instead of in d.reset, since these fields only changes during decoding messages.

@muktihari muktihari added the bug Something isn't working label Sep 19, 2024
@muktihari muktihari added this to the Unplanned milestone Sep 19, 2024
@muktihari muktihari self-assigned this Sep 19, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.94%. Comparing base (e6386e5) to head (f148c37).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #460   +/-   ##
=======================================
  Coverage   99.94%   99.94%           
=======================================
  Files          42       42           
  Lines        3697     3697           
=======================================
  Hits         3695     3695           
  Misses          2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@muktihari muktihari merged commit 720cc58 into master Sep 19, 2024
5 checks passed
@muktihari muktihari deleted the fix/decoder-release-temporary-objects branch September 19, 2024 15:04
@muktihari muktihari removed this from the Unplanned milestone Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants