Boost logo

Boost Users :

Subject: [Boost-users] Problem with boost::asio and boost::coroutine.
From: Иван Бобев (bobeff_at_[hidden])
Date: 2015-07-27 06:46:56


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-boostcoroutine
http://stackoverflow.com/questions/31639888/whats-wrong-with-this-boostasio-and-boostcoroutine-usage-pattern



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net