Opened 7 years ago

Last modified 5 years ago

#12073 new Bugs

Why read callback not call

Reported by: zhjie007@… Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.48.0 Severity: Problem
Keywords: Cc:

Description

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?

Change History (1)

comment:1 by anonymous, 5 years ago

update boost to 1.54.0 and have a try.

Note: See TracTickets for help on using tickets.