Skip to content

Fix a deadlock in eventcache #510

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

Merged
merged 1 commit into from
Oct 26, 2022
Merged

Fix a deadlock in eventcache #510

merged 1 commit into from
Oct 26, 2022

Conversation

tpapagian
Copy link
Member

There is a case where we have an OOO exec event and this will also try to add again a new entry in the eventcache that will cause a deadlock.

This commit fixes that by creating a goroutine for that case.

Signed-off-by: Anastasios Papagiannis [email protected]

@tpapagian tpapagian marked this pull request as ready for review October 26, 2022 10:06
@tpapagian tpapagian requested a review from a team as a code owner October 26, 2022 10:06
@tpapagian tpapagian requested a review from olsajiri October 26, 2022 10:06
There is a case where we have an OOO exec event and this will also
try to add again a new entry in the eventcache that will cause a
deadlock.

This commit fixes that by creating a goroutine for that case.

Signed-off-by: Anastasios Papagiannis <[email protected]>
@tpapagian tpapagian force-pushed the pr/apapag/exec-race branch from 3695675 to 483b7bd Compare October 26, 2022 10:21
@olsajiri
Copy link
Contributor

@tpapagian so do I get it right, that the channel works like pipe and it Add will block the send until the other side reads it.. which it can't because it's in the same thread?

@tpapagian
Copy link
Member Author

@tpapagian so do I get it right, that the channel works like pipe and it Add will block the send until the other side reads it.. which it can't because it's in the same thread?

Yes thats true. An event can call Add() to insert an event into the EventCache. eventcache.handleEvents() traverse all EventCache entries and do the appropriate actions. Before that eventcache.handleEvents() can also call Add().

We use an unbuffered channel that blocks until the receiver gets the event. So we can have a deadlock. Now we simply create a new goroutine to do that for us.

@kkourt kkourt mentioned this pull request Oct 26, 2022
@michi-covalent michi-covalent merged commit ba43451 into main Oct 26, 2022
@michi-covalent michi-covalent deleted the pr/apapag/exec-race branch October 26, 2022 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants