Fix address sanitizer issue in new_worker (rx-newthread.hpp) #497
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.
Greetings!
Some time ago I performed checks of some project which uses RxCpp with address sanitizer and got this:
Logs are truncated a bit, please check https://gist.github.com/luckychess/0abced67530eda0ede1456e666d2ccf6 for details.
After some investigation the problem became more clear to me:
wait_until
(line 113)wait_until
releases the lockpush
(line 136)And after that the reference becomes invalid according to ASAN, because of a data race in an underlying queue.
My propose is to retrieve a copy of a queue item instead of reference. It eliminates ASAN errors.
Also ASAN blames for this only under MacOS but finds no issues on Linux. Probably because of a different queue implementation.