Skip to content

Add a mutex to the thread plan stack map class #4988

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

Conversation

kastiglione
Copy link

This PR consisted of:

  1. 46575a6: Cherry picks D124029 which adds a mutex to ThreadPlanStackMap
  2. 8e34300: Adds a follow up refactoring to preserve the mutex in a use case that is currently swift-only

The refactoring replaces GetDetachedPlanStacks, which was a simple getter and had one caller (Process::FindDetachedPlanExplainingStop). The new function is FindThreadPlanInStack, which is a search function that takes a lambda. This refactoring is done to ensure the new mutex is held over the course of the search. Without this, the mutex would only be held for the duration of the getter, after which the search could potentially search over the unlocked/unprotected vector.

To make this change, I also had to tweak an existing friend declaration.

jimingham and others added 2 commits July 15, 2022 16:29
We've seen very occasional crashes that we can only explain by
simultaneous access to the ThreadPlanStackMap, so I'm adding a
mutex to protect it.

Differential Revision: https://reviews.llvm.org/D124029
@kastiglione
Copy link
Author

@swift-ci test

@kastiglione
Copy link
Author

@swift-ci test macOS

@kastiglione kastiglione merged commit 36c6453 into stable/20220421 Jul 16, 2022
@kastiglione kastiglione deleted the Add-a-mutex-to-the-ThreadPlanStackMap-class-stable-20220421 branch July 16, 2022 04:31
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.

2 participants