-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BACKPORT 2.14][#18668] DocDB: Block stack collection during thread c…
…reation Summary: Original commit: 3e34805 / D27851 We use `backtrace` function to collect stack traces of long running operations and to show list of running threads in the UI. But when this function runs in the middle of pthread_create, or during thread start or thread exit it cases a SIGSEGV segmentation faults. We use SIGUSR2 signal to trigger `HandleStackTraceSignal` which calls `backtrace`. Fix it to block SIGUSR2 during the `pthread_create` call. Threads inherit the parent threads signal masters so the new thread will also start with with SIGUSR2 blocked. We unblock it in `Thread::SuperviseThread` which is the first function run on the thread and block it again on `Thread::FinishThread` which is the last function that we run. Signals received when a block is placed are stored and resent as soon as we unblock, so we will not miss any stacks with this change. Another issue was that we sometime recursively call `backtrace`. In debug mode this most commonly happens when were get a SIGUSR2 signal while we are already collecting backtrace for `Mutex::CheckUnheldAndMark`. Prevent this by blocking the signal during `StackTrace::Collect` Fixes #18668 Jira: DB-7589 Test Plan: DebugUtilTest.TestGetStackTraceWhileCreatingThreads Reviewers: slingam, mlillibridge, sergei, timur, bogdan Reviewed By: slingam Subscribers: ybase, yql, mbautin Differential Revision: https://phorge.dev.yugabyte.com/D28513
- Loading branch information
Showing
8 changed files
with
149 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters