Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upCPU 100% after a few minutes idle in seed mode #502
Comments
This comment has been minimized.
This comment has been minimized.
|
Yes! I hadn't noticed this happened but it's horrible. In my case the memory and CPU usage slowly increases. According to some people is because of the number of datachannels that are created and never killed. I haven't been able to confirm this as the chrome://webrtc-internals doesn't work that well itself and freezes after a second. |
This comment has been minimized.
This comment has been minimized.
|
I believe the issue is caused by out-of-control creation of WebRTC connections which are never cleaned up. We just need to destroy the This problem is worse with multiple trackers, as twice as many connections are attempted. |
This comment has been minimized.
This comment has been minimized.
|
If you're using Chrome, you can watch the datachannels multiply in chrome://webrtc-internals/ until it eventually crashes. It would be nice to be able to set a parameter for the max number of datachannels in the client object. |
This comment has been minimized.
This comment has been minimized.
Yep, there's already a This issue is about data channels that aren't destroyed and cleaned up. They're not being counted as part of the 50. |
This comment has been minimized.
This comment has been minimized.
|
I was actually messing around with |
This comment has been minimized.
This comment has been minimized.
|
Yeah, that's because a data channel doesn't count until it's connected. It's kind of like how we don't count outgoing TCP connections until they connect. See: https://github.com/feross/bittorrent-swarm/blob/master/index.js#L94 |
This comment has been minimized.
This comment has been minimized.
|
Ahh, ok that makes sense. I've also found that the data channels persist even after all torrents in the client are destroyed. |
This comment has been minimized.
This comment has been minimized.
|
Yeah, there's literally zero cleanup code for connections. There's a TODO in the code to do that. |
This comment has been minimized.
This comment has been minimized.
|
PR welcome! |
This comment has been minimized.
This comment has been minimized.
|
Hahaha, yeah I found a few of the TODO's I'll take a look through the code and see if I can digest it enough to offer a good cleanup solution. |
This comment has been minimized.
This comment has been minimized.
|
Awesome. Happy to answer any questions as you try to figure it out. |
This comment has been minimized.
This comment has been minimized.
|
Working on this right now. Should have a fix soon. |
This comment has been minimized.
This comment has been minimized.
|
Awesome! I was having a bit of difficulty removing peers created under onSocketData so it's very helpful to see how you solved it. Has this update been rolled into webtorrent.min.js? |
This comment has been minimized.
This comment has been minimized.
|
@DiegoRBaquero, I've tracked down part of what's causing this problem. The BTorrent tracker automatically kills the tracker connection after 60 seconds, since no data is sent and we don't currently send heartbeats. You said you had it hosted behind nginx right? You should increased the http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_read_timeout In the meantime, I'm going to switch back to one tracker since every time the disconnect happens, webtorrent reconnects and generates another 10 webrtc offers. |
This comment has been minimized.
This comment has been minimized.
|
@feross Set to 15m |
This comment has been minimized.
This comment has been minimized.
|
Nice, seems to be working. I readded the second tracker to https://instant.io. |
This comment has been minimized.
This comment has been minimized.
|
@loon3 Yes, the update was released as 0.63.3 and is available in webtorrent.min.js now. |
This comment has been minimized.
This comment has been minimized.
|
great! thanks! |
This comment has been minimized.
This comment has been minimized.
|
This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue. |
Happened both at instant.io and btorrent. Left a tab open to upload a book and, even though there's no one downloading, CPU shoots to 100% in a minute or two. Let me know if I can help diagnose. Thanks!