PFZheng edited a comment on issue #1085: PrometheusMetricsService造成死锁
URL: https://github.com/apache/incubator-brpc/issues/1085#issuecomment-613207192
 
 
   如果是在PassiveStatus里用了 bthread mutex,可能是内部版本fix过的一个问题。这里会有一个pthread mutex 下用 
bthread mutex的嵌套。
   
   问题出在这段代码
   
   struct VarMapWithLock : public VarMap {
       pthread_mutex_t mutex;
   
       VarMapWithLock() {
           CHECK_EQ(0, init(1024, 80));
           pthread_mutexattr_t attr;
           pthread_mutexattr_init(&attr);
           **pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);**
           pthread_mutex_init(&mutex, &attr);
           pthread_mutexattr_destroy(&attr);
       }
   };
   
   这里的pthread mutex可能重入,重入的pthread mutex在lock/unlock的时候会检查owner,即pthread 
id。bthread切换后,这个条件不再满足,导致锁未unlock。

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to