Wild Problem in Boost ASIO Async Reader

Boost C++ Libraries

This afternoon, I ran into what appears to be a problem with boost ASIO. I'm reading a framed TCP message where the fixed-sized header includes the number of bytes in the rest of the message, and then trying to read the rest of the message with the boost::asio::transfer_all() completion code. The goal of this says to either return the full buffer or an error. What I'm seeing from time to time is that I'm asking for n bytes and I'm getting m where m is a good bit below n.

I have been able to catch this in the reader, flag it as an error, and then notify the client to re-issue the request. These retries always seem to work (after I reset the socket connection), so it's not the server or the client - it's the communication between the two. Not a lot of fun, but at least I have a semi-reliable solution with the retries. This will hold until I get back to this in a few days.

But I'm just shocked that there's a problem in the boost ASIO code. I know it's possible to just drop the connections and not face the problem, but that seems to be excessive. What I want is to track down why this is happening.

Hopefully, I'll get to it.