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

PROTON-2792: [cpp] Segmentation fault in container::impl::run_timer_jobs #421

Closed
wants to merge 1 commit into from

Conversation

zlomek
Copy link

@zlomek zlomek commented Feb 28, 2024

@DreamPearl
Copy link
Contributor

@astitcher @cliffjansen

@astitcher
Copy link
Member

astitcher commented Mar 6, 2024

There is a clear thread safety violation in run_timer_jobs use of is_active_ without using the appropriate lock - in fact this is so obvious that I'm puzzled we haven't seen it in the TSAN or even static analyzer runs - maybe we just missed it!
Unfortunately this fix has changed the previous semantics of task cancellation: An important way to cancel a task is from a previous task callback. However this change makes that unreliable as it only checks for task cancellation before executing the entire batch of tasks that are runable at the point where run_timer_jobs is called. So if an earlier task in the batch cancels a later task in the batch then that cancellation would not be honored.
I'm looking at a fix that should work correctly now and I'll post it here when I'm done.

@astitcher
Copy link
Member

My suggested fix is #422. @zlomek please check it out and see if it fixes your crash. I'd like to add some tests before merging this so that we make sure the crrect semantics are maintained with any further fixes and also preferably to exercise the race you found.

@zlomek
Copy link
Author

zlomek commented Mar 8, 2024

Closing this in favour of #422.

@zlomek zlomek closed this Mar 8, 2024
@zlomek zlomek deleted the patch-1 branch March 20, 2024 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants