yanglimingcn commented on PR #2358:
URL: https://github.com/apache/brpc/pull/2358#issuecomment-1949464923

   > 
感觉ExecutionQueue这个用起来还是有点问题,比如in_place执行的场景,task是在当前bthread执行的,就有可与初始化execq时指定的attr的tag不一致,如果task里面用到了bthread_mutex,就可能存在跨线程池唤醒的问题。
   > 
   > 在我们的项目里面还有一个场景,感觉也有可能有问题,具体如下: 
对外服务是一个端口,braft使用的是另一个端口,期望对外服务和braft如果分别使用不同的tag调度。 
但是在业务流程中,存在对外服务的service函数中,要执行提交到braft状态机,然后阻塞到bthread_cond上,然后等待raft 
apply之后的在closure中对bthread_cond进行signal。这个操作就相当于是用bthread_cond实现了异步转同步的调用。
   > 
   > 
由于对外服务和braft使用了不同的tag,braft的on_apply调用是在execq中执行,按这个PR前面的讨论,会指定attr的tag为braft使用的tag,那么on_apply执行所使用的bthread就会是braft的tag,在on_apply中调用bthread_cond_signal,就会发生跨线程池使用bthread同步原语的问题了。
   > 
   > 如果是这种场景,根据前面的讨论,应该是不适合让对外服务和braft服务使用不同的tag来调度了。不知道这样的理解是否正确?
   
   划分线程池的目的是为了隔离,感觉你对外服务和braft已经在上层通过execq做了隔离,是不是就没必要再使用这个功能了呢?
   如果要使用可能要做一些改造,attribute可以按照你的情况制定,但是bthread原语确实不能跨线程池。


-- 
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-unsubscr...@brpc.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org

Reply via email to