feat: make bthread stack trace signal number configurable#3124
feat: make bthread stack trace signal number configurable#3124chenBright merged 1 commit intoapache:masterfrom
Conversation
|
@chenBright Take a look~ |
There was a problem hiding this comment.
Pull Request Overview
This PR makes the signal number used for bthread stack tracing configurable instead of hardcoded to SIGURG. This addresses compatibility issues where SIGURG may already be registered by other libraries like cgo.
Key Changes:
- Introduces a new flag
signal_number_for_traceto configure the signal number (defaults to SIGURG for backward compatibility) - Updates TaskTracer to use the configured signal number instead of hardcoded SIGURG
- Adds test coverage to verify the configuration works with alternative signals
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/bthread/task_tracer.cpp | Adds the configurable flag and updates signal registration/sending to use the configured signal number |
| src/bthread/task_tracer.h | Adds getter for signal number and stores it as instance variable; changes RegisterSignalHandler to non-static |
| src/bthread/task_control.cpp | Updates worker interruption to use the configured signal number instead of hardcoded SIGURG |
| test/brpc_builtin_service_unittest.cpp | Adds test initialization to verify configuration with SIGUSR2 |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| @@ -100,7 +103,7 @@ class TaskTracer { | |||
| Result ContextTrace(bthread_fcontext_t fcontext); | |||
| static Result TraceByLibunwind(unw_cursor_t& cursor); | |||
|
|
|||
There was a problem hiding this comment.
The method signature changed from static to non-static, which is a significant API change affecting how this method is called. This change should be documented with a comment explaining why it needs to be non-static (i.e., to access the instance variable _signal_num).
| // This method must be non-static in order to access the instance variable _signal_num. |
|
ping~ |
|
LGTM |
What problem does this PR solve?
Issue Number: resolve #3118
Problem Summary:
What is changed and the side effects?
Changed:
Side effects:
NO
NO
Check List: