TousakaRin commented on issue #1713: URL: https://github.com/apache/incubator-brpc/issues/1713#issuecomment-1061457313
DoublyBufferedData的[基本工作原理](https://github.com/apache/incubator-brpc/blob/master/docs/cn/lalb.md#doublybuffereddata)是为每个线程都设置一把锁,ScopedPtr用RAII的方式管理了这个per thread的锁,你的例子里,在临界区中发起了rpc。brpc中,锁内rpc属于未定义行为(大概率会造成死锁)。 建议把std::unique_ptr<brpc::Channel> 换成 std::shared_ptr<brpc::Channel>: ``` std::shared_ptr<brpc::Channel> chan; { butil::DoublyBufferedData<std::unique_ptr<brpc::Channel>>::ScopedPtr c; channel.Read(&c); chan = c; } chan->CallMethod(...); ``` -- 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]
