You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2022/03/08 06:28:50 UTC
[GitHub] [incubator-brpc] zwkno1 opened a new issue #1713: DoublyBufferedData 死锁问题
zwkno1 opened a new issue #1713:
URL: https://github.com/apache/incubator-brpc/issues/1713
DoublyBufferedData<std::unique_ptr<brpc::Channel>> channel;
void do_request() {
butil::DoublyBufferedData<std::unique_ptr<brpc::Channel>>::ScopedPtr c;
channel.Read(&c);
c->CallMethod(nullptr, &cntl, &req, &resp, nullptr);
}
调用do_request函数的时候会导致死锁
--
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: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] cdjingit closed issue #1713: DoublyBufferedData 死锁问题
Posted by GitBox <gi...@apache.org>.
cdjingit closed issue #1713:
URL: https://github.com/apache/incubator-brpc/issues/1713
--
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: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] wwbmmm commented on issue #1713: DoublyBufferedData 死锁问题
Posted by GitBox <gi...@apache.org>.
wwbmmm commented on issue #1713:
URL: https://github.com/apache/incubator-brpc/issues/1713#issuecomment-1061524190
DoublyBufferedData<std::unique_ptr<brpc::Channel>> 也改成 DoublyBufferedData<std::shared_ptr<brpc::Channel>> 吧
否则无法统一引用计数,可能会出现重复释放
--
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: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] TousakaRin edited a comment on issue #1713: DoublyBufferedData 死锁问题
Posted by GitBox <gi...@apache.org>.
TousakaRin edited a comment 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::shared_ptr<brpc::Channel>>::ScopedPtr c;
channel.Read(&c);
chan = c.get();
}
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: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] TousakaRin edited a comment on issue #1713: DoublyBufferedData 死锁问题
Posted by GitBox <gi...@apache.org>.
TousakaRin edited a comment 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.get();
}
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: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] cdjingit closed issue #1713: DoublyBufferedData 死锁问题
Posted by GitBox <gi...@apache.org>.
cdjingit closed issue #1713:
URL: https://github.com/apache/incubator-brpc/issues/1713
--
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: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] TousakaRin commented on issue #1713: DoublyBufferedData 死锁问题
Posted by GitBox <gi...@apache.org>.
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: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] wwbmmm edited a comment on issue #1713: DoublyBufferedData 死锁问题
Posted by GitBox <gi...@apache.org>.
wwbmmm edited a comment on issue #1713:
URL: https://github.com/apache/incubator-brpc/issues/1713#issuecomment-1061524190
`DoublyBufferedData<std::unique_ptr<brpc::Channel>>` 也改成 `DoublyBufferedData<std::shared_ptr<brpc::Channel>>` 吧
否则无法统一引用计数,可能会出现重复释放
--
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: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] cdjingit commented on issue #1713: DoublyBufferedData 死锁问题
Posted by GitBox <gi...@apache.org>.
cdjingit commented on issue #1713:
URL: https://github.com/apache/incubator-brpc/issues/1713#issuecomment-1070886048
closed掉了,还有疑问,reopen。
--
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: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org
[GitHub] [incubator-brpc] cdjingit commented on issue #1713: DoublyBufferedData 死锁问题
Posted by GitBox <gi...@apache.org>.
cdjingit commented on issue #1713:
URL: https://github.com/apache/incubator-brpc/issues/1713#issuecomment-1070886048
closed掉了,还有疑问,reopen。
--
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: dev-unsubscribe@brpc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org