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

Use eval broker lock when reading/modifying delay heap #4632

Merged
merged 2 commits into from
Sep 4, 2018

Conversation

preetapan
Copy link
Member

Fixes #4607

runDelayedEvalsWatcher attempted to read and write from the delay heap it uses without synchronization. This caused a panic due to the race mentioned in #4607. This PR uses the existing eval broker mutex to synchronize access.

Copy link
Contributor

@tantra35 tantra35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you use Lock/Unlock in nextDelayedEval, but this method is read only

@preetapan
Copy link
Member Author

preetapan commented Sep 4, 2018

@tantra35 because nextDelayedEval reads from the heap (via the channel trigger delayedEvalsUpdateCh) while another goroutine modifies it (processEnqueue)

EDIT - I think you mean why I didn't use RLock? That's a valid question. Locking for reads should be sufficient here.

Copy link
Contributor

@jippi jippi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another panic bites the dust 🎉

@preetapan preetapan merged commit a78d0c3 into master Sep 4, 2018
@tantra35
Copy link
Contributor

tantra35 commented Sep 4, 2018

@preetapan I mean why not used Rlock/RUnlock instead Lock/Unlock?

@preetapan preetapan deleted the b-delay-heap-race branch September 4, 2018 22:37
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants