You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by "yming000 (via GitHub)" <gi...@apache.org> on 2023/11/14 02:57:23 UTC

[I] brpcServer 异步处理 (brpc)

yming000 opened a new issue, #2446:
URL: https://github.com/apache/brpc/issues/2446

   用echo.proto中的Echo举例,我的需求是,在Echo()运行完后,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-unsubscribe@brpc.apache.org.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


Re: [I] brpcServer 异步处理 (brpc)

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

   看下这个https://github.com/apache/brpc/pull/2328 满足需求吗


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


Re: [I] brpcServer 异步处理 (brpc)

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

   > > > 那么是在Echo 处理函数中回复了Echo response,同时启动一个线程来运行你的业务函数就行了吧
   > > 
   > > 
   > > 想了解brpc有没有预留这样的借口,自己起线程,感觉在程序退出时,可能会有资源访问core问题
   > 
   > 运行done->Run()后request和response都会被析构,如果在单独业务线程中会访问req和resp会有问题
   
   Hi,如果是这样,你应该拓展done的生命周期,类似这样:
   ```
   void ChatServiceImpl::Syn(google::protobuf::RpcController *cntl_base,
                             const HttpRequest *, HttpResponse *,
                             google::protobuf::Closure *done) {
   
   auto job = std::make_shared<inference::inference_job_t>();
     ...
     job->cntl = cntl;
     job->done = done_guard.release();
   
     infer_job_scheduler_->noNewJob(job);
     ...
   }
   
   ```
   
   


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


Re: [I] brpcServer 异步处理 (brpc)

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

   > > 那么是在Echo 处理函数中回复了Echo response,同时启动一个线程来运行你的业务函数就行了吧
   > 
   > 想了解brpc有没有预留这样的借口,自己起线程,感觉在程序退出时,可能会有资源访问core问题
   
   运行done->Run()后request和response都会被析构,如果在单独业务线程中会访问req和resp会有问题


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


Re: [I] brpcServer 异步处理 (brpc)

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

   > 看下这个#2328 满足需求吗
   
   谢谢 我学习一下


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


Re: [I] brpcServer 异步处理 (brpc)

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

   那么是在Echo 处理函数中回复了Echo response,同时启动一个线程来运行你的业务函数就行了吧


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


Re: [I] brpcServer 异步处理 (brpc)

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

   > 那么是在Echo 处理函数中回复了Echo response,同时启动一个线程来运行你的业务函数就行了吧
   
   想了解brpc有没有预留这样的借口,自己起线程,感觉在程序退出时,可能会有资源访问core问题


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