webtorrent / webtorrent-hybrid

WebTorrent (with WebRTC support in Node.js)
https://webtorrent.io
MIT License
519 stars 98 forks source link

webtorrent-hybrid seed for several seconds and stop #67

Open Danorcohen opened 7 years ago

Danorcohen commented 7 years ago

Hi,

I tried to seed an mp4 file (800M) with webtorrent-hybrid or webtorrent-hybrid-cli and to watch it with Webtorrent video player (such as instant.io). The web player shows that it start downloading from one peer (my server) and the server (webtorrent-hybrid-cli) shows that the client is downloading for several seconds... then the speed decreaces and eventually stops.. then, after a minute or two, it starts to download again for several seconds and stops again... and in the several seconds that it works the download speed is 300kB/s max...

According to Speedtest, in the server side the download rate is 480Mbit/s and upload rate 95Mbit/s In the client side the download rate is 42Mbit/s and upload rate 3Mbit/s

What is the problem?

Danorcohen commented 7 years ago

Nothing?

savely-krasovsky commented 7 years ago

I have this problem too.

wattazoum commented 7 years ago

Hi,

I confirm this problem on my server. I thought it was a firewall issue, but it happens even after stopping the firewall.

myotavietnam commented 7 years ago

I have same problem , Destop verson too ( webpeer not work ) Webtorrent still need many improvements for smooth operation

flimshaw commented 7 years ago

+1 also having this issue, connections are initiated and run briefly, but aren't maintained. No idea how useful this is, but left side is webtorrent-hybrid attempting to download on a raspberry pi. Right side is webtorrent-hybrid seeing from os-x. Both are on the same network and subnet, start up and connect immediately and transfer at around 1MB/s for a few seconds, and then crash. The connection tends to restart every 30-60 seconds for a while before halting indefinitely.

screen shot 2017-09-14 at 9 34 21 pm
Ciao121 commented 7 years ago

Same here... just few seeding few seconds

Ciao121 commented 7 years ago

Anybody found a solution or a workaround to this? I'm really going mad trying to understand where the problem is...

Standaa commented 6 years ago

Same problem here, running webtorrent-hybrid in node on a mac. Starts and then hangs after a couple seconds.

TheFeelTrain commented 6 years ago

I have the same problem with both webtorrent and webtorrent-hybrid.

I want to be able to keep seeding a file that is already downloaded but it only lasts for about 5 seconds. Is there anyway to do the equivalent of the --keep-seeding flag through the API? @feross

feross commented 6 years ago

@thefeeltrain The API automatically continues seeding, you don't need to pass any special flag.

DhavalW commented 5 years ago

+1. Been a year. No updates ? doesn't hang. but doesn't continue seeding either - at least not to the browser.

Made a browser process + node process download (& then auto seed ?) the same torrent. Torrent does become available successfully. But once I kill the browser process, after a while the torrent isn't available anymore to any new browser process, despite node process staying active all through out without any errors.

I also confirmed that the node process did not hang, because the code i put into node for remotely managing torrents, still runs fine & deletes the the torrent when instructed.

Is this expected behaviour ?

sebastienvercammen commented 4 years ago

👍 Similar problem, using webtorrent-hybrid via CLI.

Same result as @flimshaw.

I looked through the code and noticed webtorrent/webtorrent-hybrid only sets an RTC global that later gets "picked up" (referenced via the same global scope, there is no intermediary code) by webtorrent/webtorrent, so there's not much code in this repo that can break.

The underlying code is webtorrent-cli + webtorrent (via require()).

@feross Before outsiders have to jump in blind & deep, do you have any thoughts on what the cause might be? I'm up for fixing it, just hoping to save some time off debugging someone else's code.

feross commented 4 years ago

@sebastienvercammen I suspect there's a bug in webtorrent itself that causes seeding to stop after some time. I think it will be a bit tricky, but not impossible to track down. Please ping me if you track it down and have a PR that fixes it :)

sebastienvercammen commented 4 years ago

@feross Thanks for jumping in. Will do. :)

Weedshaker commented 4 years ago

@feross , I got the same issue after seeding for 7/8 hours from my raspberry-pi. Then the terminal freezes and the torrent is unavailable. Also I tried the cli versions on other devices as well as the Webtorrent Desktop on Windows and Ubuntu, similar issues arose and sometimes even failing faster. But they all fail after some time, while I hoped that they would keep seeding permanently.

Screenshot at 2020-05-26 10-17-14 Test description at: https://github.com/Weedshaker/PeerWebSite#Tests

Is there a way, flag to get a log, because I think there is some error which stops nodejs execution. PS: I am now trying to get some output with --verbose, gonna post my findings asap.

Weedshaker commented 4 years ago

Update: I put the --verbose flag and it has been seeding for over a day. I am going to let you know once it fails. Until then you can keep track of my test at: https://peerweb.site/#magnet:?xt=urn:btih:123646487058d49b7d25d59842cd04862eee8822&dn=peerWebSite.txt&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&tr=wss%3A%2F%2Ftracker.fastcast.nz

sebastienvercammen commented 4 years ago

Thanks for the additions @Weedshaker.

I've been too busy to work on this, but I'm planning to make time soon to get this sorted. I'm following the updates and they're appreciated.

Weedshaker commented 4 years ago

Until yesterday the test stood strong -> seeding. I can't really tell if the difference was the --verbose flag or that I ran an instant of transmission parallel (although transmission has no active upload stats received) or that I kept the above link open on chromium on the raspberry-pi. Although, the former usually stops seeding after the browser becomes idle. Anyhow, yesterday I had to reboot my raspberry-pi and I only started the webtorrent hybrid cli for the three torrents described in my test. The terminal froze and seeding stopped after less than 12 hours.

I restarted the test today. Again with a browser open and transmission in the background. I will see if I can reproduce it to stay seeding for long.

sebastienvercammen commented 4 years ago

@Weedshaker Any update on the second test with --verbose? Any logs that hint at the problem?

Weedshaker commented 4 years ago

@sebastienvercammen StIll Up and running.

feross commented 4 years ago

Has this issue been resolved?

Weedshaker commented 4 years ago

I am going to run a test from today and let you know.

Weedshaker commented 4 years ago

I am now seeding this page: https://peerweb.site/#magnet:?xt=urn:btih:682fc456c6e9d1cb848efe6178fe5f0c26c210fc&dn=peerWebSite.txt&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com

I am going to check back and see if it will keep seeding.

Weedshaker commented 4 years ago

The page and for that reason the torrent, which I am still seeding according to the WebTorrent Desktop UI on my computer, is now not reachable anymore. It is also not reachable from https://instant.io/#682fc456c6e9d1cb848efe6178fe5f0c26c210fc

Weedshaker commented 4 years ago

Check box seeding had no effect. But once I did restart the WebTorrent Desktop, it would be seeding and available again. I had the same issue with hybrid, since this is under the hood of WebTorrent Desktop.

Weedshaker commented 4 years ago

It just went offline again and these were the logs which happened between seeding and failing:

webtorrent: got wt-progress
C:\Users\weeds\AppData\Local\WebTorrent\app-0.24.0\resources\app.asar\build\renderer\main.js:347 dispatch: mediaControlsMouseEnter []
C:\Users\weeds\AppData\Local\WebTorrent\app-0.24.0\resources\app.asar\build\renderer\main.js:347 dispatch: mediaControlsMouseLeave []
22C:\Users\weeds\AppData\Local\WebTorrent\app-0.24.0\resources\app.asar\build\renderer\main.js:363 webtorrent: got wt-progress
C:\Users\weeds\AppData\Local\WebTorrent\app-0.24.0\resources\app.asar\build\renderer\controllers\torrent-controller.js:41 warning for torrent 1: connection error to wss://tracker.btorrent.xyz
C:\Users\weeds\AppData\Local\WebTorrent\app-0.24.0\resources\app.asar\build\renderer\main.js:363 webtorrent: got wt-warning
C:\Users\weeds\AppData\Local\WebTorrent\app-0.24.0\resources\app.asar\build\renderer\controllers\torrent-controller.js:41 warning for torrent 2: connection error to wss://tracker.btorrent.xyz
C:\Users\weeds\AppData\Local\WebTorrent\app-0.24.0\resources\app.asar\build\renderer\main.js:363 webtorrent: got wt-warning
C:\Users\weeds\AppData\Local\WebTorrent\app-0.24.0\resources\app.asar\build\renderer\controllers\torrent-controller.js:41 warning for torrent 1: connection error to wss://tracker.btorrent.xyz
C:\Users\weeds\AppData\Local\WebTorrent\app-0.24.0\resources\app.asar\build\renderer\main.js:363 webtorrent: got wt-warning
C:\Users\weeds\AppData\Local\WebTorrent\app-0.24.0\resources\app.asar\build\renderer\controllers\torrent-controller.js:41 warning for torrent 2: connection error to wss://tracker.btorrent.xyz
C:\Users\weeds\AppData\Local\WebTorrent\app-0.24.0\resources\app.asar\build\renderer\main.js:363 webtorrent: got wt-warning
C:\Users\weeds\AppData\Local\WebTorrent\app-0.24.0\resources\app.asar\build\renderer\main.js:347 dispatch: mediaControlsMouseEnter []
C:\Users\weeds\AppData\Local\WebTorrent\app-0.24.0\resources\app.asar\build\renderer\main.js:347 dispatch: mediaControlsMouseLeave []
C:\Users\weeds\AppData\Local\WebTorrent\app-0.24.0\resources\app.asar\build\renderer\main.js:363 webtorrent: got wt-progress
C:\Users\weeds\AppData\Local\WebTorrent\app-0.24.0\resources\app.asar\build\renderer\main.js:347 dispatch: mediaControlsMouseEnter []
C:\Users\weeds\AppData\Local\WebTorrent\app-0.24.0\resources\app.asar\build\renderer\main.js:347 dispatch: mediaControlsMouseLeave []
C:\Users\weeds\AppData\Local\WebTorrent\app-0.24.0\resources\app.asar\build\renderer\controllers\torrent-controller.js:41 warning for torrent 1: connection error to wss://tracker.btorrent.xyz
C:\Users\weeds\AppData\Local\WebTorrent\app-0.24.0\resources\app.asar\build\renderer\main.js:363 webtorrent: got wt-warning
feross commented 3 years ago

Thanks for sharing @Weedshaker. Two possibilities come to mind:

  1. Connection to the tracker is lost and webtorrent doesn't re-establish it for some reason, or

  2. All the trackers for the given torrent have gone offline for some reason (maybe wss://tracker.btorrent.xyz was the last one online) and for that reason no peer introductions can happen.

In the first case, that would be a bug in webtorrent. In the second, it wouldn't.