Skip to content

TypeErrors: infoHashes is null #205

@alxhotel

Description

@alxhotel

A few releases ago, probably since v8.3.0, two TypeErrors have appeared (my bad for not reporting this before):

var index = peer.socket.infoHashes.indexOf(this.infoHash)
                                      ^

TypeError: Cannot read property 'indexOf' of null
    at Swarm._onAnnounceStopped (/fakepath/tracker/node_modules/bittorrent-tracker/lib/server/swarm.js:106:39)
    at LRU.<anonymous> (/fakepath/tracker/node_modules/bittorrent-tracker/lib/server/swarm.js:31:10)
    at emitOne (events.js:96:13)
    at LRU.emit (events.js:188:7)
    at LRU._checkAge (/fakepath/tracker/node_modules/lru/index.js:104:10)
    at LRU.peek (/fakepath/tracker/node_modules/lru/index.js:64:13)
    at Swarm._getPeers (/fakepath/tracker/node_modules/bittorrent-tracker/lib/server/swarm.js:149:27)
    at Swarm.announce (/fakepath/tracker/node_modules/bittorrent-tracker/lib/server/swarm.js:65:17)
    at announce (/fakepath/tracker/node_modules/bittorrent-tracker/server.js:684:11)
    at /fakepath/tracker/node_modules/bittorrent-tracker/server.js:654:7

And this one:

if (socket.infoHashes.indexOf(params.info_hash) === -1) {
                           ^

TypeError: Cannot read property 'indexOf' of null
    at /fakepath/tracker/node_modules/bittorrent-tracker/server.js:513:28
    at /fakepath/tracker/node_modules/bittorrent-tracker/server.js:716:7
    at Swarm.announce (/fakepath/tracker/node_modules/bittorrent-tracker/lib/server/swarm.js:62:3)
    at announce (/fakepath/tracker/node_modules/bittorrent-tracker/server.js:684:11)
    at /fakepath/tracker/node_modules/bittorrent-tracker/server.js:654:7
    at /fakepath/tracker/node_modules/bittorrent-tracker/server.js:365:5
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Seems like it is trying to access the infoHashes of a peer already evicted.

I would like to fix them myself, but, unfortunately, I don't have too much time these days.

@feross @DiegoRBaquero @yciabaud

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions