You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@brpc.apache.org by "lsdh-fei (via GitHub)" <gi...@apache.org> on 2025/09/25 02:59:30 UTC

[I] 多bthread tag下创建socket有可能造成_io_event异常 (brpc)

lsdh-fei opened a new issue, #3107:
URL: https://github.com/apache/brpc/issues/3107

   **Describe the bug**
   
   Socket::OnCreated 函数中会给 _io_event 手动设置 bthread_tag `_io_event.set_bthread_tag(options.bthread_tag);`,但是 _io_event 构造时会使用 bthread_self_tag(),如果调用 Socket::OnCreated 构造 _io_event 的和 SocketOptions 中的 bthread_tag 不同,那么 IOEvent::AddConsumer 和 RemoveConsumer 中GetGlobalEventDispatcher 就会获取到不同的 EventDispatcher。
   
   **To Reproduce**
   
   在 bthread_tag 1 中开启 rpc 服务,然后在其中使用 rdma client 请求其他服务。其他服务实例重启,后续client就无法正确建联。
   
   RdmaEndpoint::ProcessHandshakeAtClient 建联时,RdmaEndpoint::AllocateResources() 中 Socket::Create 传入的 SocketOptions 没有指定 bthread_tag  ,那么 Socket::ResetFileDescriptor 中 _io_event.AddConsumer 时就会使用 bthread_tag 0,如果 Socket::Create 是 tag 1,后续就会在错误的EventDispatcher中 RemoveConsumer,后续重用 socket 就会有问题 
   
   应该所有 Socket::OnCreated 调用时,传入的options中没有指定thread_tag都会有风险
   
   **Expected behavior**
   
   使用相同的tag处理socket创建
   
   
   


-- 
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: issues-unsubscribe@brpc.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@brpc.apache.org
For additional commands, e-mail: issues-help@brpc.apache.org


Re: [I] 多bthread tag下创建socket有可能造成_io_event异常 (brpc)

Posted by "yanglimingcn (via GitHub)" <gi...@apache.org>.
yanglimingcn commented on issue #3107:
URL: https://github.com/apache/brpc/issues/3107#issuecomment-3332384910

   你用的版本有更新吗?之前我遇到这样的问题,后来做了修改。SocketOptions里面bthread_tag默认也是bthread_self_tag()。


-- 
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: issues-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@brpc.apache.org
For additional commands, e-mail: issues-help@brpc.apache.org


Re: [I] 多bthread tag下创建socket有可能造成_io_event异常 (brpc)

Posted by "chenBright (via GitHub)" <gi...@apache.org>.
chenBright commented on issue #3107:
URL: https://github.com/apache/brpc/issues/3107#issuecomment-3332138841

   SocketOptions::bthread_tag的默认值是bthread_self_tag(),在bthread_tag 1上创建Socket,tag就是1吧。
   https://github.com/apache/brpc/blob/020f807a99e3aee38752e895e6b4d88fcbda1526/src/brpc/socket.h#L288


-- 
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: issues-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@brpc.apache.org
For additional commands, e-mail: issues-help@brpc.apache.org


Re: [I] 多bthread tag下创建socket有可能造成_io_event异常 (brpc)

Posted by "lsdh-fei (via GitHub)" <gi...@apache.org>.
lsdh-fei closed issue #3107: 多bthread tag下创建socket有可能造成_io_event异常
URL: https://github.com/apache/brpc/issues/3107


-- 
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: issues-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@brpc.apache.org
For additional commands, e-mail: issues-help@brpc.apache.org


Re: [I] 多bthread tag下创建socket有可能造成_io_event异常 (brpc)

Posted by "lsdh-fei (via GitHub)" <gi...@apache.org>.
lsdh-fei commented on issue #3107:
URL: https://github.com/apache/brpc/issues/3107#issuecomment-3332529030

   新版确实修了,关了


-- 
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: issues-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@brpc.apache.org
For additional commands, e-mail: issues-help@brpc.apache.org