Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

Yamagi
Copy link

@Yamagi Yamagi commented Aug 19, 2012

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.

…in thread to exit polling.

This is the same fix as in rtorrent ce16621. It needed to migitate high load issues on FreeBSD.
@ghost
Copy link

ghost commented Aug 27, 2012

Thanks, I can confirm that the patch worked for me. I only just noticed the issue yesterday, not sure how long its been happening

@dannywarren
Copy link

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.

@rakshasa
Copy link
Owner

rakshasa commented Sep 4, 2012

A linear 50-100ms sleep would be better, I'll fix this code in the near future.

@SasukeFreestyle
Copy link

Thanks Yamagi for the fix, however I just want to report that i've tried both 50-100 and 50-1000ms.
With 50-100ms, it took about 5 min for the torrent to reach full 100mbit download/upload speed, but also much lower CPU usage ~7%, sometimes it got stuck between 30-50 Mbit, not reaching any higher.

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

@rakshasa
Copy link
Owner

Sounds like you need to increase send/write buffer size and enable prefetch, increasing the timeout does produce the same effect it seems.

@SasukeFreestyle
Copy link

Is this in the send/buffer size and prefetch in the source code, if so could you post a "patch" here like Yamagi?
Im very new to the FreeBSD system, thats why im asking, how to change this in FreeBSD if it is in the OS? a link would be nice.

Thanks again, love rtorrent/libtorrent

@andrnils
Copy link

andrnils commented Oct 1, 2012

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.

@rakshasa
Copy link
Owner

rakshasa commented Mar 2, 2013

On closer examination this issue may be linked to the recently fixed (I hope) SIGUS1 issue.

@rakshasa
Copy link
Owner

We're not using a socket for interrupting threads, this is now obsolete.

@rakshasa rakshasa closed this Aug 15, 2013
draglop pushed a commit to draglop/libtorrent that referenced this pull request Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants