DiegoRBaquero / BTorrent

:globe_with_meridians: Fully-featured WebTorrent Client
https://btorrent.xyz
MIT License
549 stars 95 forks source link

Tracker connections close after 1.7 minutes of stale activity #94

Closed SnowyCoder closed 2 years ago

SnowyCoder commented 2 years ago

Hello,

After 1.7 minutes of stale activity the connection to tracker is closed by the server, as I think you're using bittorrent tracker by webtorrent a stale timer is not present is the code (it's not present even in wt-tracker nor in openwebtorrent-tracker). Is this intended behaviour?

Since the behaviour is the same for openwebtorrent's tracker (that seems to use a different tracker server) I think that it's due to a nginx configuration (correct me if I'm wrong). This causes weird pauses where the client cannot connect to other btorrent clients (it surely happens after 1.7 minutes, but it's mitigated by client reconnection pause policy).

image (captured by chrome after seeding to noone for a while)

Related issue on openwebtorrent tracker: https://github.com/OpenWebTorrent/openwebtorrent-tracker/issues/22

Thanks for the great service! I would be happy to help in any way if I can

DiegoRBaquero commented 2 years ago

It could be, for BTorrent's tracker, that the conn is being closed by cloudflare (as I use it on top of it). I'll disable it now and we can tracker results

SnowyCoder commented 2 years ago

A workaround I found is to send {"action":"scrape","info_hash":[]} once in a while (but it's not pretty, puts more strain on the server and webtorrent tracker client needs to be patched)

DiegoRBaquero commented 2 years ago

Does it work with direct connection now? My nginx conf timeouts after more than the announce interval, so it should go uninterrupted.

SnowyCoder commented 2 years ago

Yes, I've tested it for 10 minutes on a stale connection and it seems perfectly fixed, thank you!