Open nictuku opened 10 years ago
A few clues about the state of the torrent:
I0512 21:22:55.468268 32671 dht.go:237] DHT: torrent client asking more peers for <ih>.
2014/05/12 21:22:55 Have 2 of 821 pieces 0.24360536 % complete.
2014/05/12 21:22:55 Closing peer A
2014/05/12 21:22:55 Closing connection to A
2014/05/12 21:22:55 Closing peer B
2014/05/12 21:22:55 Closing connection to B
2014/05/12 21:22:55 Closing peer C
2014/05/12 21:22:55 Closing connection to C
2014/05/12 21:22:55 Closing peer D
2014/05/12 21:22:55 Closing connection to D
2014/05/12 21:22:55 Closing peer E
2014/05/12 21:22:55 Closing connection to E
I just pushed a change that improves the panic message to give more information.
Please let me know if you see the error again with the additional info.
Looking at the code and the stack crawl... generalMessage has made sure the piece index is in range for our copy of the bitset.
But we fail trying to update the peer's "have" bitset.
For some reason the peer's have bitset is smaller than it should be.
One theory is that we are adding peers to the torrent session before we know the size of the torrent. In that case we would create peers with a "have" bitset of size of 0.
I added some sanity checks to reject attempts to add peers before we know the size of the torrent.
Let me know if you see this error again with the latest code.
This just happened again, using tip.
2014/07/23 23:05:24 Have 1 of 821 pieces 0.12180268 % complete. 2014/07/23 23:05:24 Closing peer 104.32.212.207:27879 2014/07/23 23:05:24 Closing connection to 104.32.212.207:27879 2014/07/23 23:05:24 Closing peer 109.64.39.122:31457 2014/07/23 23:05:24 Closing connection to 109.64.39.122:31457 2014/07/23 23:05:24 Closing peer 93.86.210.98:32460 2014/07/23 23:05:24 Closing connection to 93.86.210.98:32460 2014/07/23 23:05:24 Closing peer 75.85.14.185:6881 2014/07/23 23:05:24 Closing connection to 75.85.14.185:6881 2014/07/23 23:05:24 Closing peer 58.146.147.85:63263 2014/07/23 23:05:24 Closing connection to 58.146.147.85:63263 2014/07/23 23:05:24 Closing peer 213.123.216.75:57176 2014/07/23 23:05:24 Closing connection to 213.123.216.75:57176 2014/07/23 23:05:24 Closing peer 116.87.42.42:56468 2014/07/23 23:05:24 Closing connection to 116.87.42.42:56468 2014/07/23 23:05:24 Closing peer 177.205.199.216:52591 2014/07/23 23:05:24 Closing connection to 177.205.199.216:52591 2014/07/23 23:05:24 Closing peer 88.253.253.57:30784 2014/07/23 23:05:24 Closing connection to 88.253.253.57:30784 2014/07/23 23:05:24 Closing peer 181.168.191.97:58241 2014/07/23 23:05:24 Closing connection to 181.168.191.97:58241 2014/07/23 23:05:24 Closing peer 154.46.108.88:15291 2014/07/23 23:05:24 Closing connection to 154.46.108.88:15291 2014/07/23 23:05:24 Closing peer 23.240.34.125:62348 2014/07/23 23:05:24 Closing connection to 23.240.34.125:62348 2014/07/23 23:05:24 Closing peer 99.228.171.252:16093 2014/07/23 23:05:24 Closing connection to 99.228.171.252:16093 2014/07/23 23:05:24 Closing peer 130.43.98.70:34133 2014/07/23 23:05:24 Closing connection to 130.43.98.70:34133 2014/07/23 23:05:24 Closing peer 90.35.153.189:14432 2014/07/23 23:05:24 Closing connection to 90.35.153.189:14432 2014/07/23 23:05:24 Closing peer 174.134.129.253:63874 2014/07/23 23:05:24 Closing connection to 174.134.129.253:63874 2014/07/23 23:05:24 Closing peer 182.19.136.97:59696 2014/07/23 23:05:24 Closing connection to 182.19.136.97:59696 2014/07/23 23:05:24 Closing peer 197.226.170.212:58627 2014/07/23 23:05:24 Closing connection to 197.226.170.212:58627 panic: Index 631 out of range 0..0.
goroutine 27 [running]: runtime.panic(0x6a1b80, 0xc2082f13d0) /usr/local/go/src/pkg/runtime/panic.c:279 +0xf5 github.com/jackpal/Taipei-Torrent/torrent.(_Bitset).checkRange(0xc208286390, 0x277) /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/bitset.go:65 +0x131 github.com/jackpal/Taipei-Torrent/torrent.(_Bitset).IsSet(0xc208286390, 0x277, 0xc20839f440) /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/bitset.go:51 +0x31 github.com/jackpal/Taipei-Torrent/torrent.(_TorrentSession).RecordBlock(0xc20802e000, 0xc20833a000, 0x1c00000000277, 0x4000, 0x0, 0x0) /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:808 +0x72e github.com/jackpal/Taipei-Torrent/torrent.(_TorrentSession).generalMessage(0xc20802e000, 0xc2083ac300, 0x4009, 0x4009, 0xc20833a000, 0x0, 0x0) /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:1003 +0x186a github.com/jackpal/Taipei-Torrent/torrent.(_TorrentSession).DoMessage(0xc20802e000, 0xc20833a000, 0xc2083ac300, 0x4009, 0x4009, 0x0, 0x0) /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:874 +0xb6 github.com/jackpal/Taipei-Torrent/torrent.(_TorrentSession).DoTorrent(0xc20802e000) /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:580 +0x16f1 github.com/jackpal/Taipei-Torrent/torrent.func·004(0xc20802e000) /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrentLoop.go:55 +0x30 created by github.com/jackpal/Taipei-Torrent/torrent.RunTorrents /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrentLoop.go:57 +0x5b2
Aha, that's very interesting. Index 631 out of range 0..0 - sounds like the bitset is uninitialized.
Reading through the source, I think what's happening is that a peer is being added (and the peer's "have" bitset is created) before t.totalPieces is set.
I can work on this but it may take me some time.