Problem with boost::asio and boost::coroutine.
This is my first post so sorry if it is not in the appropriate form. I have trouble with specific *boost::asio* and *boost::coroutine *usage pattern. I have a multi-thread application which uses *boost::asio* and *boost::coroutine* via its integration in *boost::asio*. Every thread has its own *io_service* object. The only shared state between threads are connection pools which are locked with *mutex* when connection is get or returned from/to the connection pool. When there is not enough connections in the pool I push infinite *asio::steady_tiemer *in internal structure of the pool and asynchronously waiting on it and I yielding from the couroutine function. When other thread returns connection to the pool it checks whether there is waiting timers, it gets waiting timer from the internal structure, it gets its *io_service* object and posts a lambda which wakes up the timer to resume the suspended coroutine. I have random crashes in the application. I try to investigate the problem with *valgrind*. It founds some issues but I cannot understand them because they happen in *boost::coroutine* and *boost::asio *internals. I posted two questions in *stckoverflow *with extract from my code and from valgrind and *GDB* output. The first link is with original question with extracts from my source and the second one contains proof of concept application aimed to investigate the problem in isolation. Can someone help me explaining what is my mistake which causes those problems? http://stackoverflow.com/questions/31610415/what-causes-a-random-crash-in-bo... http://stackoverflow.com/questions/31639888/whats-wrong-with-this-boostasio-...
I forgot to mention that used by me boost version is *1.57 *and the used
compiler is *GCC 4.8.3 *on *CentOS Linux release 7.1.1503*. Thank you in
advance.
2015-07-27 13:46 GMT+03:00 Иван Бобев
This is my first post so sorry if it is not in the appropriate form.
I have trouble with specific *boost::asio* and *boost::coroutine *usage pattern. I have a multi-thread application which uses *boost::asio* and *boost::coroutine* via its integration in *boost::asio*. Every thread has its own *io_service* object. The only shared state between threads are connection pools which are locked with *mutex* when connection is get or returned from/to the connection pool. When there is not enough connections in the pool I push infinite *asio::steady_tiemer *in internal structure of the pool and asynchronously waiting on it and I yielding from the couroutine function. When other thread returns connection to the pool it checks whether there is waiting timers, it gets waiting timer from the internal structure, it gets its *io_service* object and posts a lambda which wakes up the timer to resume the suspended coroutine. I have random crashes in the application. I try to investigate the problem with *valgrind*. It founds some issues but I cannot understand them because they happen in *boost::coroutine* and *boost::asio *internals. I posted two questions in *stckoverflow *with extract from my code and from valgrind and *GDB* output. The first link is with original question with extracts from my source and the second one contains proof of concept application aimed to investigate the problem in isolation. Can someone help me explaining what is my mistake which causes those problems?
http://stackoverflow.com/questions/31610415/what-causes-a-random-crash-in-bo...
http://stackoverflow.com/questions/31639888/whats-wrong-with-this-boostasio-...
It seems that all *valgrind* errors are caused because of
*BOOST_USE_VALGRIND* macro is not defined as *Tanner Sansbury* points in
comment related to this
http://stackoverflow.com/questions/29180589/is-it-safe-to-use-spawn-directly...
question.
It seems that except this the program is correct.
2015-07-27 13:58 GMT+03:00 Иван Бобев
I forgot to mention that used by me boost version is *1.57 *and the used compiler is *GCC 4.8.3 *on *CentOS Linux release 7.1.1503*. Thank you in advance.
2015-07-27 13:46 GMT+03:00 Иван Бобев
: This is my first post so sorry if it is not in the appropriate form.
I have trouble with specific *boost::asio* and *boost::coroutine *usage pattern. I have a multi-thread application which uses *boost::asio* and *boost::coroutine* via its integration in *boost::asio*. Every thread has its own *io_service* object. The only shared state between threads are connection pools which are locked with *mutex* when connection is get or returned from/to the connection pool. When there is not enough connections in the pool I push infinite *asio::steady_tiemer *in internal structure of the pool and asynchronously waiting on it and I yielding from the couroutine function. When other thread returns connection to the pool it checks whether there is waiting timers, it gets waiting timer from the internal structure, it gets its *io_service* object and posts a lambda which wakes up the timer to resume the suspended coroutine. I have random crashes in the application. I try to investigate the problem with *valgrind*. It founds some issues but I cannot understand them because they happen in *boost::coroutine* and *boost::asio *internals. I posted two questions in *stckoverflow *with extract from my code and from valgrind and *GDB* output. The first link is with original question with extracts from my source and the second one contains proof of concept application aimed to investigate the problem in isolation. Can someone help me explaining what is my mistake which causes those problems?
http://stackoverflow.com/questions/31610415/what-causes-a-random-crash-in-bo...
http://stackoverflow.com/questions/31639888/whats-wrong-with-this-boostasio-...
participants (1)
-
Иван Бобев