This is an automated email from the ASF dual-hosted git repository.

guangmingchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git


The following commit(s) were added to refs/heads/master by this push:
     new 0141e9e7 Only store failed SignalSyncs (#3128)
0141e9e7 is described below

commit 0141e9e7f7a9ca385d5c50cf3e5a6a4ba0d6f047
Author: Bright Chen <[email protected]>
AuthorDate: Mon Oct 27 19:23:14 2025 +0800

    Only store failed SignalSyncs (#3128)
---
 src/bthread/task_tracer.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/bthread/task_tracer.cpp b/src/bthread/task_tracer.cpp
index f9d14f02..0ae782e9 100644
--- a/src/bthread/task_tracer.cpp
+++ b/src/bthread/task_tracer.cpp
@@ -410,7 +410,6 @@ TaskTracer::Result TaskTracer::SignalTrace(pthread_t 
worker_tid) {
             return Result::MakeErrorResult("Fail to pthread_sigqueue: %s", 
berror());
         }
     }
-    _inuse_signal_syncs.push_back(signal_sync);
 
     // Wait for the signal handler to complete.
     butil::Timer timer;
@@ -435,13 +434,14 @@ TaskTracer::Result TaskTracer::SignalTrace(pthread_t 
worker_tid) {
             if (EINTR == errno) {
                 continue;
             }
+            // Extend the lifetime of `signal_sync' to
+            // avoid it being destroyed in the signal handler.
+            _inuse_signal_syncs.push_back(signal_sync);
             return Result::MakeErrorResult("Fail to poll: %s", berror());
         }
         break;
     }
-    // Remove the successful SignalSync.
-    _inuse_signal_syncs.pop_back();
-    
+
     return signal_sync->result;
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to