-
-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed another potential issue causing high loads while waiting for main thread to exit polling. #21
Conversation
…in thread to exit polling. This is the same fix as in rtorrent ce16621. It needed to migitate high load issues on FreeBSD.
Thanks, I can confirm that the patch worked for me. I only just noticed the issue yesterday, not sure how long its been happening |
Can also confirm this patch works for me on FreeBSD 9.0-RELEASE with rtorrent 0.9.2 / libtorrent 0.13.2. I no longer see cpu usage spikes that eat one or more cpu cores, and the rtorrent curses interface is back to being responsive. One simple test case (in my situation, not sure if others saw this) was exiting the rtorrent interface via CTRL-Q. Previously, it would hang for up to 30 seconds before responding or just throw away the quit request. Now it exits immediately. |
A linear 50-100ms sleep would be better, I'll fix this code in the near future. |
Thanks Yamagi for the fix, however I just want to report that i've tried both 50-100 and 50-1000ms. With 50-1000ms linear sleep download/upload speeds reached 100mbit very fast, but also higher CPU usage, ~40% still better than before when it got unresponsive and hanged tested of course with the same torrent on a private tracker, using FreeBSD 9.0 |
Sounds like you need to increase send/write buffer size and enable prefetch, increasing the timeout does produce the same effect it seems. |
Is this in the send/buffer size and prefetch in the source code, if so could you post a "patch" here like Yamagi? Thanks again, love rtorrent/libtorrent |
Perhaps an interesting datapoint: I wanted to see if I could spot the problem, so I did valgrind --tool=callgrind rtorrent and lo and behold, no more cpu-spikes. I noticed dl at 2mb/s and no increase in cpu frequency. |
On closer examination this issue may be linked to the recently fixed (I hope) SIGUS1 issue. |
We're not using a socket for interrupting threads, this is now obsolete. |
In rtorrent ce16621 some magic was added to src/thread_base.cc to migitate high load problems. A similar issue manifests on FreeBSD in the "new" libtorrent method thread_base::interrupt() in src/torrent/utils/thread_base.cc, added with commit aa9d73e. The attached commit fixes this issue the same way as it was done in rtorrent.