CodeZHXS commented on issue #2983:
URL: https://github.com/apache/brpc/issues/2983#issuecomment-2954524102

   > > Is it possible to simply set m->traced to false on each error return 
path? then signal()?
   > 
   > Yes.
   > 
   > 
[brpc/src/bthread/task_tracer.cpp](https://github.com/apache/brpc/blob/d0fa17634e7c614f8481b21d5525611d618151e4/src/bthread/task_tracer.cpp#L296-L303)
   > 
   > Lines 296 to 303 in 
[d0fa176](/apache/brpc/commit/d0fa17634e7c614f8481b21d5525611d618151e4)
   > 
   >  { 
   >      BAIDU_SCOPED_LOCK(m->version_lock); 
   >      // If m->status is BTHREAD_STATUS_END, the bthread also waits for 
tracing completion, 
   >      // so given_version != *m->version_butex is OK. 
   >      m->traced = false; 
   >  } 
   >  // Wake up the waiting worker thread to jump. 
   >  _cond.Signal(); 
   > I think moving this part of the code to line 274 would fix the problem, 
like
   > 
   > BRPC_SCOPE_EXIT {
   >     {
   >         BAIDU_SCOPED_LOCK(m->version_lock);
   >         // If m->status is BTHREAD_STATUS_END, the bthread also waits for 
tracing completion,
   >         // so given_version != *m->version_butex is OK.
   >         m->traced = false;
   >     }
   >     // Wake up the waiting worker thread to jump.
   >     _cond.Signal();
   > };
   > You can verify it again after modification.
   
   
[https://github.com/apache/brpc/pull/2988](https://github.com/apache/brpc/pull/2988)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to