Comments (4)
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 doioc.stop()
orioc.get_executor().on_work_finished()
. - Run the contexts on separate threads, see example.
from asio-grpc.
ok let me disable the optimization and see if the value is still huge.
from asio-grpc.
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.
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)
- Question: Why is it recommended to create one agrpc::GrpcContext per thread? HOT 3
- feature request: support cancel in agrpc::Alarm HOT 4
- [Question] About bench mark HOT 2
- [Question] : How to detect client disconnection HOT 18
- Questions about CPU usage and event multiplexing HOT 3
- GRPC_CALL_ERROR_TOO_MANY_OPERATIONS Error on Concurrent Write Operations HOT 3
- Lifetime issue in the docs HOT 2
- Example with small changes crashes HOT 6
- Why I get const correctness problems HOT 16
- Generic server example without manual buffer serializaiton? HOT 4
- Using asynchronous gRPC server and client on same context HOT 9
- Asio-gRPC seems to have TSAN warnings HOT 8
- How to detect client closed connection HOT 6
- Can I call ServerBuilder::BuildAndStart() after GrpcContext::run() HOT 2
- Questions on how to switch from an GrpcContext to io_context and back HOT 6
- How to shutdown grpc clients HOT 1
- Clarification Needed on Thread Context Switch in writer() Function (example streaming-server.cpp) HOT 8
- assertion failed: !started_ HOT 2
- Can I use asio-grpc inside an existing boost::asio application? HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asio-grpc.