-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
fix: avoid acquiring lock on two mutexes at the same time to prevent deadlock #13636
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep this looks like another one. Great job!
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## master #13636 +/- ##
=======================================
Coverage 49.24% 49.24%
=======================================
Files 248 248
Lines 42838 42839 +1
=======================================
+ Hits 21094 21097 +3
+ Misses 19646 19645 -1
+ Partials 2098 2097 -1
☔ View full report in Codecov by Sentry. |
…deadlock Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
99cb45f
to
cb653f1
Compare
/cherry-pick release-2.7 |
1 similar comment
/cherry-pick release-2.7 |
…deadlock (#13636) Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
/cherry-pick release-2.6 |
1 similar comment
/cherry-pick release-2.6 |
…deadlock (#13636) Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
/cherry-pick release-2.5 |
…deadlock (#13636) Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
…deadlock (argoproj#13636) (argoproj#13648) Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com> Co-authored-by: Alexander Matyushentsev <AMatyushentsev@gmail.com> Signed-off-by: schakrad <58915923+schakrad@users.noreply.github.com>
…deadlock (argoproj#13636) Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
Closes #11458
PR fixes an almost identical bug that was fixed by argoproj/gitops-engine#521.
Deadlock is happening because we have two functions that acquire lock on two different mutexes in different order.
Function 1 stack trace:
Function 2 stack trace:
So liveStateCache.invalidate waits for SetPopulateResourceInfoHandler and SetPopulateResourceInfoHandler waits for liveStateCache.invalidate.
PR updates liveStateCache.invalidate to release Mutex 1 before it locks Mutex 2