Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes addPeer is still triggered after webtorrent.remove(torrentId) #623

Closed
niieani opened this issue Feb 16, 2016 · 3 comments
Closed

Sometimes addPeer is still triggered after webtorrent.remove(torrentId) #623

niieani opened this issue Feb 16, 2016 · 3 comments

Comments

@niieani
Copy link
Contributor

@niieani niieani commented Feb 16, 2016

Do this repeatedly and you'll eventually see the problem:

const parsedTorrent = {...}; // ParsedTorrent from ParseTorrent
webTorrent.add(parsedTorrent, { path: ... }, (torrent) => {
  webTorrent.remove(torrent.infoHash);
});

Seems like internally a DHT scheduled a connection to be created before the torrent was destroyed is still trying to add a peer even after (or during) the time it was removed.

Looks like a possible regression of this #589.

Error:

/Users/nixin/Documents/Projects/webtorrent/lib/torrent.js:456
  if (self.destroyed) throw new Error('torrent is destroyed')
                      ^
Error: torrent is destroyed
    at Torrent.addPeer (/Users/nixin/Documents/Projects/webtorrent/lib/torrent.js:456:29)
    at emitOne (events.js:90:13)
    at Discovery.emit (events.js:182:7)
    at DHT.onPeer (/Users/nixin/Documents/Projects/webtorrent/node_modules/torrent-discovery/index.js:66:10)
    at emitThree (events.js:115:20)
    at DHT.emit (events.js:188:7)
    at emit (/Users/nixin/Documents/Projects/webtorrent/node_modules/bittorrent-dht/client.js:316:12)
    at onreply (/Users/nixin/Documents/Projects/webtorrent/node_modules/bittorrent-dht/client.js:322:27)
    at onreply (/Users/nixin/Documents/Projects/webtorrent/node_modules/bittorrent-dht/client.js:532:12)
    at Object.afterQuery [as callback] (/Users/nixin/Documents/Projects/webtorrent/node_modules/k-rpc/index.js:272:18)
    at Socket.onmessage (/Users/nixin/Documents/Projects/webtorrent/node_modules/k-rpc-socket/index.js:101:11)
    at emitTwo (events.js:100:13)
    at Socket.emit (events.js:185:7)
    at UDP.onMessage (dgram.js:481:8)
@capric8416

This comment has been minimized.

Copy link

@capric8416 capric8416 commented Jul 4, 2016

I edit file node_modules/webtorrent/lib/torrent.js at line 707 to skip this.
image

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jul 27, 2016

@niieani @capric8416 This issue should be fixed in the latest version of webtorrent.

@capric8416 Can you check what version of webtorrent you have installed?

@feross feross closed this Jul 27, 2016
@lock

This comment has been minimized.

Copy link

@lock lock bot commented May 4, 2018

This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue.

@lock lock bot locked as resolved and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.