chr15m / bugout

Back end web app services over WebRTC.
https://chr15m.github.io/bugout
MIT License
604 stars 59 forks source link

Bugout does not work anymore #64

Closed neuronsupport closed 1 year ago

neuronsupport commented 1 year ago

Bugout does not work anymore with latest browsers. The bugout examples work only in different tabs in the same browser instance. Nothing connects from another browser. It does not connect to a server running on chrome from a firefox or safari window. If I compile Bugout with latest webtorrent, it is worse. Even another tab does not connect. I only use tracker.openwebtorrent.com which pings fine. I can connect to torrents from webtorrent application that means webtorrent works okay. Can anybody confirm this?

chr15m commented 1 year ago

Thanks for reporting this @norzak. I do not have capacity or motivation to work on a fix at this stage. I can put a note on the repository and will merge any fix that is submitted and passes tests etc.

chr15m commented 1 year ago

@norzak if you have time to post any console logs here that would help.

neuronsupport commented 1 year ago

There is no log on the console. It sounds like something that bugout uses is broken in webtorrent. It may be the extension system? I will try to go back some versions of webtorrent and see if it works or not.

neuronsupport commented 1 year ago

I went back to your previous releases and tested them. I can confirm that it is completely broken.

neuronsupport commented 1 year ago

This is debug console from the version that used to work.

bugout address +0ms bEkCZWjMyUFPoY96fzXyY5qkU3SREsZoKg bugout.min.js:21926:132 bugout identifier +1ms bSpvwMkMasWR8J5nYG7j8TJMuGHGsxKHci bugout.min.js:21926:132 bugout public key +0ms 42fJyqabdn7vJ7cHCTEkAsSDqeEo8AhRGC8xi1SmKEe5 bugout.min.js:21926:132 bugout encryption key +0ms 7rwM3B1XvXJiKEX785rmFWFJoqvFJDyCvyqa2QHrMSVa bugout.min.js:21926:132 My address is bEkCZWjMyUFPoY96fzXyY5qkU3SREsZoKg docs:69:13 Connecting to the server... (this can take a minute) docs:69:13 GEThttp://127.0.0.1:8080/favicon.ico [HTTP/1.1 404 0ms]

bugout torrent +36ms bSpvwMkMasWR8J5nYG7j8TJMuGHGsxKHci Object { _events: {…}, _eventsCount: 2, _maxListeners: undefined, _debugId: "0c33245", client: {…}, announce: (2) […], urlList: [], path: "/webtorrent/0c332458fc384aeef84bf45bae677f566f78bfed", skipVerify: true, _store: Storage(chunkLength, opts) , … } _amInterested: false _critical: Array [] _debugId: "0c33245" _downloadSpeed: function exports(delta)​ _events: Object { close: onceWrapper(), wire: (2) […] } _eventsCount: 2 _fileModtimes: undefined _getAnnounceOpts: undefined _hashes: Array [ "b6b40c6ba2d66bc5691b517d45767a2e28920ab2" ] _maxListeners: undefined _peers: Object { } _peersLength: 0 _queue: Array [] _rarityMap: Object { _torrent: {…}, _numPieces: 1, _pieces: (1) […], … } _rechokeIntervalId: 7 _rechokeNumSlots: 10 _rechokeOptimisticTime: 0 _rechokeOptimisticWire: null _reservations: Array [ null ] _selections: Array [] _servers: Array [] _store: function Storage(chunkLength, opts)​ _uploadSpeed: function exports(delta)​ _xsRequests: Array [] announce: Array [ "wss://tracker.btorrent.xyz", "wss://tracker.openwebtorrent.com" ] bitfield: Object { grow: 0, buffer: Uint8Array(1) } client: Object { _eventsCount: 0, peerId: "2d5757303030372d596f48344256425477684c5a", nodeId: "9990eef29bb133ed5aca6ce43d40944dbb06839d", … } created: Date Fri Nov 04 2022 09:56:01 GMT+0000 (Greenwich Mean Time) createdBy: "WebTorrent/0007" destroyed: false discovery: Object { _eventsCount: 5, peerId: "2d5757303030372d596f48344256425477684c5a", infoHash: "0c332458fc384aeef84bf45bae677f566f78bfed", … } done: true files: Array [ {…} ] info: Object { length: 34, name: Uint8Array(34), "piece length": 16384, … } infoBuffer: Uint8Array(110) [ 100, 54, 58, … ] infoHash: "0c332458fc384aeef84bf45bae677f566f78bfed" infoHashBuffer: Uint8Array(20) [ 12, 51, 36, … ] lastPieceLength: 34 length: 34 magnetURI: "magnet:?xt=urn:btih:0c332458fc384aeef84bf45bae677f566f78bfed&dn=bSpvwMkMasWR8J5nYG7j8TJMuGHGsxKHci&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com" maxWebConns: 4 metadata: Uint8Array(314) [ 100, 56, 58, … ] name: "bSpvwMkMasWR8J5nYG7j8TJMuGHGsxKHci" path: "/webtorrent/0c332458fc384aeef84bf45bae677f566f78bfed" paused: false pieceLength: 16384 pieces: Array [ null ] ready: true received: 0 skipVerify: true store: Object { store: {…}, chunkLength: 16384, mem: (1) […] } strategy: "sequential" torrentFile: Uint8Array(314) [ 100, 56, 58, … ] uploaded: 0 urlList: Array [] wires: Array []

neuronsupport commented 1 year ago

it is not actually minimized bugout.

neuronsupport commented 1 year ago

Client gets the correct server hashcode in trackerAnnounce. Then it ping pongs between "update" and "trackerannounce" then stops. It just sits there.

this.torrent.discovery.tracker && this.torrent.discovery.tracker.on("update", partial(function(bugout, update) {
       bugout.emit("tracker", bugout.identifier, update)
}, this)),
this.torrent.discovery.on("trackerAnnounce", partial(function(bugout) {
        bugout.emit("announce", bugout.identifier),
        bugout.connections()
}, this))
neuronsupport commented 1 year ago

There are no wires. connections() method just returns because of that.

neuronsupport commented 1 year ago

attach method is never called

this.torrent.on("wire", partial(attach, this, this.identifier));

wire event is never called.

neuronsupport commented 1 year ago

Looks like it is a webtorrent related problem. If I refresh the client page 3-4 times. It connects.

neuronsupport commented 1 year ago

It seems like, trackers are not reliable. It closes the connections periodically if you are from the same IP. I believe your tracker which is not online anymore was not restrictive and let us connect quicker.

chr15m commented 1 year ago

Ah ok. The reason it's not online any more is probably because I never updated it and so it doesn't have those protections, and hence got taken down by spam connections. I could start it up again but the spam connections will start again. If I upgrade it may suffer from the same problem. :thinking:

chr15m commented 1 year ago

A perpetual problem with the architecture of the whole system is these trackers are a central point of failure and they get crushed the moment any app using them gets popular. I have an idea how to solve this with a distributed signaling mesh but I ran out of motivation. Maybe I will get to it sometime. :thinking:

bertung commented 1 year ago

Wow that would be awesome if you can get that to work.

draeder commented 1 year ago

I am working with @amark on updating Gun DB in my spare time (when our schedules link up). We are building a DHT called Book. My intention with Gun is to use it to fully decentralize WebTorrent WebRTC signaling.

chr15m commented 1 year ago

@draeder super cool, keep us posted!

neuronsupport commented 1 year ago

@draeder it sounds very interesting. Hope to see a solution to this signaling bottleneck in a near future.