Discussion:
[asio-users] async_read failing with semaphore timeout message on windows 7 x64
风之寒
2012-12-30 02:50:01 UTC
Permalink
My Tcp server occasionally has async_read calls failing with: The semaphore timeout period has expired (121) This is from boost::asio::async_read on a connected TCP socket. There is a tidbit of info turned up in searches on async accept returning this on windows, but nothing from any async read calls. Anyone have any ideas? I'm going to see what happens if I catch this error and just retry the async read. That doesn't seem right though. Thanks,
vf
2013-01-10 23:12:52 UTC
Permalink
http://support.microsoft.com/kb/325487
suggests it could be a hardware problem.
Also, do you pass a concurrency_hint parameter to the constructor
of the io_service?
风之寒
2013-01-11 03:54:58 UTC
Permalink
vf
2013-01-14 06:25:19 UTC
Permalink
does the error 121 occur for all clients (including connections from the local
host) or only for certain computers?
风之寒
2013-01-14 11:02:47 UTC
Permalink
vf
2013-01-14 22:54:36 UTC
Permalink
only for certain computers my code of async_read look like
this
connection->socket->async_read_some(
boost::asio::buffer(data, size),
boost::bind(&Self::OnRead, this,
boost::asio::placeholders::error, connection,
boost::asio::placeholders::bytes_transferred )
);
well, the error 121 is a generic one and could be caused by pretty much
anything.

A good start would be to figure what is different about the connections
that cause problems, look into event logs on both the server and client
computers in case there are any relevant messages etc.
The other things to check would be firewalls, VPNs, etc
Also since vista windows tcp stack implements receive window auto-tuning,
you might try to turn it off to see if it makes any difference.

I would not treat the error 121 differently to any other error, i.e the
server should probably drop the connection instead of issuing a second
async_read()

One of our customers had a problem with the error 121 awhile back, their
setup was being mostly VMs and software NICs. We told them to reinstall
the software, apply the latest service packs etc, and the problem
apparently went away. So it was kind of inconclusive.

Loading...