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 upWebtorrent makes NWjs freez and hang #1224
Comments
This comment has been minimized.
This comment has been minimized.
|
Can you post full logs while this happens? |
This comment has been minimized.
This comment has been minimized.
|
I can't, as it makes nwjs freez. Hence it doesnt write the part of the log when it happens, because it's frozen. Unless you have an idea to bypass nwjs somehow, but I doubt its doable since webtorrent gets called by nwjs' node |
This comment has been minimized.
This comment has been minimized.
|
Maybe post the full console output from up until the error occurs in a pastebin and link here? I'm not super familiar with nwjs's APIs, but I would expect them to have some verbose logging option during initialization. |
This comment has been minimized.
This comment has been minimized.
|
If it's an infinite loop, you should be able to pause in devtools? |
This comment has been minimized.
This comment has been minimized.
|
devtool cannot be opened or focused when nwjs process hangs. I've noticed that the issue only appears when you download multiple files over a somewhat long period of time. EG:
|
This comment has been minimized.
This comment has been minimized.
|
Duplicate of #1026. High CPU is a known bug of WebTorrent in some circumstances, for now. I suggest not running in the same thread as your UI. In WebTorrent Desktop, for example, we have a separate thread just for WebTorrent so it will never freeze the UI. |
This comment has been minimized.
This comment has been minimized.
|
RAM usage is also high, like 1500Mb |
This comment has been minimized.
This comment has been minimized.
|
WebTorrent Desktop doesn't have high RAM usage in normal usage. If you can share example code that reproduces the issue, or explain how to reproduce it in more depth, that would be helpful. |
This comment has been minimized.
This comment has been minimized.
|
Here's my streamer: https://github.com/vankasteelj/frak/blob/master/app/js/lib/streamer.js High RAM usage only happens when webtorrent "freezes", as described above. As with the above linked file, you could reproduce doing this:
Repeat a few times with different torrents, without reloading the browser (nwjs, in my case). Usually after 4 or 6 video files, it will freeze. |
This comment has been minimized.
This comment has been minimized.
|
Thanks for the sample code. I believe this is just yet another instance of the known CPU issues with WebTorrent. Please follow this issue #1026 for updates. |
I'm using webtorrent inside a nwjs app. I'm using it to download videos that are played on a localhost port, and read from MPV. I use a single instance of webtorrent and download a single file.
Most of the time, webtorrent will work flawlessly. But sometimes, in an upredicable manner, it will make the entire app freez and then hang, with CPU usage going up to 50%.
I'm guessing there's some loop somewhere that goes nuts, you can simulate a similar freez in console by running a bunch of expensive operations in an infinite loop. But I can't log anything, because the app freezes and I have no other choice than killing nwjs' process.
What version of WebTorrent?
What operating system and Node.js version?
What browser and version? (if using WebTorrent in the browser)
No browser (well, except nwjs)
What did you expect to happen?
Download goes flawlessly like always
What actually happened?
once in a while, webtorrent will make the entire app hang, like a loop gone mad or something, and CPU usage will rise up to 50% of an intel m3