Coder Social home page Coder Social logo

Comments (4)

Tradias avatar Tradias commented on June 13, 2024

I cannot see anything wrong with the code snippet. The deadline is too high indeed but I do not see any potential for overflow in the code. I suspect that:

  • There is some UB or ODR violation elsewhere in your code. These errors are difficult to debug, I recommend commenting out as much code as possible until the error disappears, then slowly enable it again.
  • There might be some compiler optimization that skews the value. I recommend looking at ioc.stopped() which should be false. If it is not then somewhere in the code you do ioc.stop() or ioc.get_executor().on_work_finished().
  • Run the contexts on separate threads, see example.

from asio-grpc.

RavikumarTulugu avatar RavikumarTulugu commented on June 13, 2024

ok let me disable the optimization and see if the value is still huge.

from asio-grpc.

RavikumarTulugu avatar RavikumarTulugu commented on June 13, 2024

wanted to wait till i am sure the issue is resolved. This works better since grpc doesn't give out epoll fd. poll () comes to rescue.

static void
grpcPollTimerCallback (
const boost::system::error_code &error,
boost::asio::deadline_timer *timer,
boost::asio::io_context &ioc,
agrpc::GrpcContext &grpc_context
) {
if ( ! error ) {
timer -> expires_from_now ( boost::posix_time::milliseconds ( 1 ) );
timer -> async_wait ( boost::bind ( grpcPollTimerCallback,
boost::asio::placeholders::error,
timer,
std::ref ( ioc ),
std::ref ( grpc_context )));
grpc_context.poll ();
}
return;
}

boost::asio::deadline_timer grpcPollTimer ( ioc );
grpcPollTimer.expires_from_now ( boost::posix_time::milliseconds ( 1 ) );
grpcPollTimer.async_wait ( boost::bind ( grpcPollTimerCallback,
boost::asio::placeholders::error,
&grpcPollTimer,
std::ref ( ioc ),
std::ref ( grpc_context_ )));

from asio-grpc.

RavikumarTulugu avatar RavikumarTulugu commented on June 13, 2024

There is a bug for sure in case of single thread with multiple event loops , but we are able to get around with the poll method , the poll approach works for now. may be in future , some one else will stumble up on the same in a different scenario. closing this for now.

from asio-grpc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.