MJY-HUST commented on PR #2730:
URL: https://github.com/apache/brpc/pull/2730#issuecomment-2277064209

   > 一般什么情况下会两次解析呀,我这边确实没遇到过这样的场景,这块就做的不充分。 
bthread_concurrency_by_tag的默认值应该设置成等于bthread_concurrency的默认值
   
   
两次解析是由于上层应用对其他的gflags有reload需求,但使用了类似ParseCommandLineFlags会调用所有flags的validate函数?或者只是代码的不规范导致的在链路中执行了两次ParseCommandLineFlags触发这个问题。这部分应该是可以通过修改上层应用的代码来避免,但是brpc应该也需要做到兼容这个场景。
   
   > 如果有多个tag的时候,两次解析是啥结果呢?
   
   
如果内部实现有多个tag,一般来说第一次解析是在main函数开始出,此时第一次解析由于设置了never_set_bthread_concurrency_by_tag,task_control还是等于nullptr;后续如果在设置了tag的server没启动前出现第二次解析,此时task_control
 init之后只有tag 0,因此指定其他的tag时,tag_ngroup = 
0,如果设置了bthread_concurrency_by_tag的值,那么只要其大于0,那么就会触发add_workers,不会有异常。如果在server启动之后第二次触发,就和正常的动态改变分组线程的流程一致了,应该也没有问题。


-- 
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