fix(subscriber): changed atomic add to fetch update #629
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.
Hi I can file a bug if that's needed but on my project (I can try and make an MVE) I kept running into an out of bounds panic originating from
I assumed this was possible due to multiple calls to
fetch_add
incrementing and thus puttinglen
temporarily in a bad state that could allow an out of bound access. The other solution I thought of would've beenlen.min(MAX_CALLSITES)
so up to you which you prefer. I should note, I'm not super familiar with atomics so I'm unsure if I did it right.While I don't have an MVE using this modified code with my project I no longer saw the panic. Let me know if there's anything else I can do and thanks for all your hard work! :)