Commit f0e6be7
Protect against deadlocks in stack walk API
Summary:
This is just adding some extra defense to the stack walk API. alexmalyshev asked "What happens if a second sampling thread appears and sends another SIGUSR1?" It's actually the callers responsibility to protect this with a lock (which we rely on either the GIL or the FreeThreadedJITEntrypointGuard to do so). But there's an additional concern about if someone sent our walking thread a signal while we were trying to walk the stack.
In that case the walking thread that sent us the signal could depend upon a resource owned by the thread that we are trying to walk. That'd result in a deadlock. So now the sampled thread will give up if the sampling thread fails to walk it in a reasonable amount of time.
Reviewed By: alexmalyshev
Differential Revision: D116388968
fbshipit-source-id: 8fa581c5fb57081c3f0bad3cdd74d25f4900fa831 parent a78e01c commit f0e6be7
4 files changed
Lines changed: 1494 additions & 97 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
164 | 169 | | |
165 | 170 | | |
166 | 171 | | |
| |||
0 commit comments