Closed GoogleCodeExporter closed 8 years ago
File \boost\asio\detail\win_iocp_io_service.hpp contains comment:
// Timeout to use with GetQueuedCompletionStatus on older versions of
// Windows. Some versions of windows have a "bug" where a call to
// GetQueuedCompletionStatus can appear stuck even though there are events
// waiting on the queue. Using a timeout helps to work around the issue.
default_gqcs_timeout = 500,
Maybe it's related to the problem.
Original comment by rominmai...@gmail.com
on 1 Jun 2015 at 10:18
UPD: forgot about important clarification: if after session start wait more
time - >5 min - client shutdown quickly.
Original comment by rominmai...@gmail.com
on 1 Jun 2015 at 12:24
UPD: about hang on Win 8.1 - it not depends of the BOOST_ASIO_DISABLE_IOCP.
In some cases reproduced consistently - session shutdown about ~39.5 seconds.
Conditions: several torrent with seeding or paused state.
Sorry for the confusion )).
Original comment by rominmai...@gmail.com
on 1 Jun 2015 at 2:39
My first guess would be that there are DNS lookups that are stuck.
Unfortunately there is no way (at least not easily in boost.asio) to cancel DNS
lookups. If you have a DNS server that's slow or have a network connection
that's unreliable and DNS lookups stall, you have to wait for them to time out
before you can finish the shut down. I believe the default time-out is 2
minutes.
Presumably one or more of the trackers of the torrents you start have hostnames
that cause hangs, once they've timed out once, you may not contact them again,
or much later. This would explain why only if you start and try to shut down
quickly after do you get stuck.
Original comment by arvid.no...@gmail.com
on 1 Jun 2015 at 10:03
btw. in trunk (the next major release) I have made some effort to mitigate
this. Partly to cache more aggressively for shutdown and to use my own queue to
more reliably enforce the shutdown timeout.
Original comment by arvid.no...@gmail.com
on 1 Jun 2015 at 10:04
Hi,
Thanks for the reply.
Looks like you are right about trackers and DNS lookups.
Here are the results of my tests:
1) Hangs related to trackers:
libtorrent: 1.0.x (but OK on trunk)
OS: Win XP sp3 / 7 sp1 / 8.1
Workaround: remove torrents from session before exit.
Time reduced from ~27 to ~5 seconds (test_client example).
2) Hangs related to DNS lookups (?):
libtorrent: any
OS: Win XP
Workaround: BOOST_ASIO_DISABLE_IOCP
Please, could you express your opinion about BOOST_ASIO_DISABLE_IOCP?
How much will this affect libtorrent work (download/upload) and whole network
bandwidth?
Thanks.
Original comment by rominmai...@gmail.com
on 2 Jun 2015 at 8:54
I don't understand why disabling IOCP would make a difference. If anything,
hostname lookups would be more likely to have to be synchronous.
The main advantage of IOCP compared to select is that it scales with the number
of connections. If you don't intend to have a large number of connections, it
may not matter much. windows' select() only supports 64 sockets iirc, and I
don't know what or if boost.asio attempts to work around that or if that
becomes a hard limit. It's possible that it actually uses poll() internally too.
instead of removing the torrents, you could also stop them.
Original comment by arvid.no...@gmail.com
on 2 Jun 2015 at 11:23
Original issue reported on code.google.com by
rominmai...@gmail.com
on 1 Jun 2015 at 10:16