Subject: [Boost-bugs] [Boost C++ Libraries] #12073: Why read callback not call
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-03-17 01:45:12
#12073: Why read callback not call
------------------------------+----------------------------
Reporter: zhjie007@⦠| Owner: chris_kohlhoff
Type: Bugs | Status: new
Milestone: To Be Determined | Component: asio
Version: Boost 1.48.0 | Severity: Problem
Keywords: |
------------------------------+----------------------------
I write a simple test server but meet a strange problem.
In my test server, I start a 10 threads pool to run io_service.run
function.
I created a boost::asio::ip::tcp::acceptor object and call 'listen'
function, final call 'async_accept' to start a asynchronous operation.
Then if a client connect to server, the accept callback function will be
called.
In accept callback function, I do three thing:
1, create a boost::asio::strand object
2, create a boost::asio::deadline_timer object to set timeout, if the
client does not send any data for 5 seconds, the timer callback will be
called. In this timer callback, the server will send a hearbeat request to
client and expect to receive a hearbeat response from the client.
3, call async_read_some to set read callback function.
Of cause 'async_wait' in step 2 and 'async_read_some' call in step 3 are
both wrapper in strand object which is created in step 1.
To test this server, I write a demo python client. This demo client just
connect to server and send hearbeat request to server, then expect to
receive a hearbeat response. I set a crontab task to call this demo python
client every one minute.
The most tests are OK, but the test would random fail.
Everytime it failed, I have checked the output of tcpdump on server, the
server successfully receives the hearbeat request, but the read callback
function is not called.
So why the read callback function is not called just when the hearbeat
request is received.
It looks like the read event is missing, is it about edge trigger in
epoll?
This random failure could reproduce on both CentOS 6.5 and CentOS 6.6, the
boost version is boost 1.48.0, the compiler is gcc 4.4.7.
Does anyone meet this bug?
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12073> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC