jackpal / Taipei-Torrent

A(nother) Bittorrent client written in the go programming language
BSD 3-Clause "New" or "Revised" License
842 stars 123 forks source link

Crash in (*BitSet).IsSet torrent/bitset.go:52 #54

Open nictuku opened 10 years ago

nictuku commented 10 years ago
2014/05/12 21:22:55 Closing connection to <..>
panic: Index out of range.

goroutine 27 [running]:
runtime.panic(0x69f940, 0xc2082a5500)
        /usr/local/go/src/pkg/runtime/panic.c:279 +0xf5
github.com/jackpal/Taipei-Torrent/torrent.(*Bitset).IsSet(0xc2082420c0, 0x235, 0xc208357448)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/bitset.go:52 +0xda
github.com/jackpal/Taipei-Torrent/torrent.(*TorrentSession).RecordBlock(0xc20802e000, 0xc2082c6340, 0x1800000000235, 0x4000, 0x0, 0x0)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:812 +0x721
github.com/jackpal/Taipei-Torrent/torrent.(*TorrentSession).generalMessage(0xc20802e000, 0xc20848a000, 0x4009, 0x4009, 0xc2082c6340, 0x0, 0x0)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:1005 +0x1840
github.com/jackpal/Taipei-Torrent/torrent.(*TorrentSession).DoMessage(0xc20802e000, 0xc2082c6340, 0xc20848a000, 0x4009, 0x4009, 0x0, 0x0)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:878 +0xb6
github.com/jackpal/Taipei-Torrent/torrent.(*TorrentSession).DoTorrent(0xc20802e000)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:588 +0x1685
main.func·002()
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/main.go:96 +0x37
created by main.main
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/main.go:98 +0xbe4

goroutine 16 [select]:
main.main()
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/main.go:108 +0x1550

goroutine 19 [finalizer wait]:
runtime.park(0x4158d0, 0x96d280, 0x96b4e9)
        /usr/local/go/src/pkg/runtime/proc.c:1369 +0x89
runtime.parkunlock(0x96d280, 0x96b4e9)
        /usr/local/go/src/pkg/runtime/proc.c:1385 +0x3b
runfinq()
        /usr/local/go/src/pkg/runtime/mgc0.c:2626 +0xcf
runtime.goexit()
        /usr/local/go/src/pkg/runtime/proc.c:1445

goroutine 20 [syscall]:
os/signal.loop()
        /usr/local/go/src/pkg/os/signal/signal_unix.go:21 +0x1e
created by os/signal.init·1
        /usr/local/go/src/pkg/os/signal/signal_unix.go:27 +0x32

goroutine 21 [chan receive]:
github.com/golang/glog.(*loggingT).flushDaemon(0x96eea0)
        /home/nictuku/src/github.com/golang/glog/glog.go:839 +0x75
created by github.com/golang/glog.init·1
        /home/nictuku/src/github.com/golang/glog/glog.go:406 +0x28a

goroutine 17 [syscall]:
runtime.goexit()
        /usr/local/go/src/pkg/runtime/proc.c:1445

goroutine 23 [IO wait]:
net.runtime_pollWait(0x7f818a43eac0, 0x72, 0x0)
        /usr/local/go/src/pkg/runtime/netpoll.goc:146 +0x66
net.(*pollDesc).Wait(0xc2080521b0, 0x72, 0x0, 0x0)
        /usr/local/go/src/pkg/net/fd_poll_runtime.go:84 +0x46
net.(*pollDesc).WaitRead(0xc2080521b0, 0x0, 0x0)
        /usr/local/go/src/pkg/net/fd_poll_runtime.go:89 +0x42
net.(*netFD).accept(0xc208052150, 0x83c680, 0x0, 0x7f818a43d440, 0xb)
        /usr/local/go/src/pkg/net/fd_unix.go:409 +0x2fe
net.(*TCPListener).AcceptTCP(0xc20803e020, 0x6928a0, 0x0, 0x0)
        /usr/local/go/src/pkg/net/tcpsock_posix.go:233 +0x59
net.(*TCPListener).Accept(0xc20803e020, 0x0, 0x0, 0x0, 0x0)
        /usr/local/go/src/pkg/net/tcpsock_posix.go:243 +0x4b
github.com/jackpal/Taipei-Torrent/torrent.func·001()
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/listen.go:52 +0x4c
created by github.com/jackpal/Taipei-Torrent/torrent.ListenForPeerConnections
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/listen.go:71 +0x43a

goroutine 24 [select]:
github.com/nictuku/nettools.(*ClientThrottle).cleanup(0xc208044da0)
        /home/nictuku/src/github.com/nictuku/nettools/ratelimit.go:76 +0x220
created by github.com/nictuku/nettools.NewThrottler
        /home/nictuku/src/github.com/nictuku/nettools/ratelimit.go:20 +0xcb

goroutine 28 [IO wait]:
net.runtime_pollWait(0x7f818a43ea10, 0x72, 0x0)
        /usr/local/go/src/pkg/runtime/netpoll.goc:146 +0x66
net.(*pollDesc).Wait(0xc2080525a0, 0x72, 0x0, 0x0)
        /usr/local/go/src/pkg/net/fd_poll_runtime.go:84 +0x46
net.(*pollDesc).WaitRead(0xc2080525a0, 0x0, 0x0)
        /usr/local/go/src/pkg/net/fd_poll_runtime.go:89 +0x42
net.(*netFD).readFrom(0xc208052540, 0xc208017000, 0x1000, 0x1000, 0x0, 0x0, 0x0, 0x7f818a43d440, 0xb)
        /usr/local/go/src/pkg/net/fd_unix.go:259 +0x39d
net.(*UDPConn).ReadFromUDP(0xc20803e058, 0xc208017000, 0x1000, 0x1000, 0x1e, 0x0, 0x0, 0x0)
        /usr/local/go/src/pkg/net/udpsock_posix.go:67 +0x141
github.com/nictuku/dht.readFromSocket(0xc20803e058, 0xc208004780, 0xc208054140, 0xc208004660)
        /home/nictuku/src/github.com/nictuku/dht/krpc.go:215 +0xbb
created by github.com/nictuku/dht.(*DHT).Run
        /home/nictuku/src/github.com/nictuku/dht/dht.go:300 +0x182

goroutine 26 [runnable]:
github.com/nictuku/dht.(*DHT).Run(0xc208066100, 0x0, 0x0)
        /home/nictuku/src/github.com/nictuku/dht/dht.go:331 +0x1086
created by github.com/jackpal/Taipei-Torrent/torrent.NewTorrentSession
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:190 +0x4ee

goroutine 29 [select]:
github.com/jackpal/Taipei-Torrent/torrent.(*TorrentSession).deadlockDetector(0xc20802e000)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:446 +0x48b
created by github.com/jackpal/Taipei-Torrent/torrent.(*TorrentSession).DoTorrent
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:475 +0x5f

goroutine 30 [chan receive]:
github.com/jackpal/Taipei-Torrent/torrent.func·004()
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/trackerClient.go:47 +0x6c
created by github.com/jackpal/Taipei-Torrent/torrent.startTrackerClient
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/trackerClient.go:59 +0x247

goroutine 31 [chan receive]:
github.com/jackpal/Taipei-Torrent/torrent.func·005()
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/trackerClient.go:62 +0x7b
created by github.com/jackpal/Taipei-Torrent/torrent.startTrackerClient
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/trackerClient.go:68 +0x286

goroutine 40 [chan receive]:
github.com/jackpal/Taipei-Torrent/torrent.queueingWriter(0xc2082cb260, 0xc2082cb2c0)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:65 +0xbc
created by github.com/jackpal/Taipei-Torrent/torrent.NewPeerState
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:94 +0x74

goroutine 52 [chan receive]:
github.com/jackpal/Taipei-Torrent/torrent.queueingWriter(0xc2082dbd40, 0xc2082dbda0)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:65 +0xbc
created by github.com/jackpal/Taipei-Torrent/torrent.NewPeerState
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:94 +0x74

goroutine 42 [chan receive]:
github.com/jackpal/Taipei-Torrent/torrent.(*peerState).peerWriter(0xc2082c6820, 0xc208004420)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:240 +0xa1
created by github.com/jackpal/Taipei-Torrent/torrent.(*TorrentSession).addPeerImp
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:418 +0x41e

goroutine 43 [runnable]:
net.runtime_pollWait(0x7f818a43e8b0, 0x72, 0x0)
        /usr/local/go/src/pkg/runtime/netpoll.goc:146 +0x66
net.(*pollDesc).Wait(0xc208132290, 0x72, 0x0, 0x0)
        /usr/local/go/src/pkg/net/fd_poll_runtime.go:84 +0x46
net.(*pollDesc).WaitRead(0xc208132290, 0x0, 0x0)
        /usr/local/go/src/pkg/net/fd_poll_runtime.go:89 +0x42
net.(*netFD).Read(0xc208132230, 0xc20818bc7c, 0x4, 0x4, 0x0, 0x7f818a43d440, 0xb)
        /usr/local/go/src/pkg/net/fd_unix.go:232 +0x30e
net.(*conn).Read(0xc20803e040, 0xc20818bc7c, 0x4, 0x4, 0x0, 0x0, 0x0)
        /usr/local/go/src/pkg/net/net.go:122 +0xe7
github.com/jackpal/Taipei-Torrent/torrent.readNBOUint32(0x7f818a43f048, 0xc20803e040, 0x7f8100000000, 0x0, 0x0)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:225 +0xcd
github.com/jackpal/Taipei-Torrent/torrent.(*peerState).peerReader(0xc2082c6820, 0xc208004420)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:276 +0x47
created by github.com/jackpal/Taipei-Torrent/torrent.(*TorrentSession).addPeerImp
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:419 +0x447

goroutine 64 [chan receive]:
github.com/jackpal/Taipei-Torrent/torrent.queueingWriter(0xc208301f20, 0xc208301f80)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:65 +0xbc
created by github.com/jackpal/Taipei-Torrent/torrent.NewPeerState
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:94 +0x74

goroutine 54 [chan receive]:
github.com/jackpal/Taipei-Torrent/torrent.(*peerState).peerWriter(0xc2082c7c70, 0xc208004420)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:240 +0xa1
created by github.com/jackpal/Taipei-Torrent/torrent.(*TorrentSession).addPeerImp
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:418 +0x41e

goroutine 55 [runnable]:
net.runtime_pollWait(0x7f818a43e750, 0x72, 0x0)
        /usr/local/go/src/pkg/runtime/netpoll.goc:146 +0x66
net.(*pollDesc).Wait(0xc2081333a0, 0x72, 0x0, 0x0)
        /usr/local/go/src/pkg/net/fd_poll_runtime.go:84 +0x46
net.(*pollDesc).WaitRead(0xc2081333a0, 0x0, 0x0)
        /usr/local/go/src/pkg/net/fd_poll_runtime.go:89 +0x42
net.(*netFD).Read(0xc208133340, 0xc2081ad120, 0x4, 0x4, 0x0, 0x7f818a43d440, 0xb)
        /usr/local/go/src/pkg/net/fd_unix.go:232 +0x30e
net.(*conn).Read(0xc20803e060, 0xc2081ad120, 0x4, 0x4, 0x0, 0x0, 0x0)
        /usr/local/go/src/pkg/net/net.go:122 +0xe7
github.com/jackpal/Taipei-Torrent/torrent.readNBOUint32(0x7f818a43f048, 0xc20803e060, 0x7f8100000000, 0x0, 0x0)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:225 +0xcd
github.com/jackpal/Taipei-Torrent/torrent.(*peerState).peerReader(0xc2082c7c70, 0xc208004420)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:276 +0x47
created by github.com/jackpal/Taipei-Torrent/torrent.(*TorrentSession).addPeerImp
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:419 +0x447

goroutine 76 [chan receive]:
github.com/jackpal/Taipei-Torrent/torrent.queueingWriter(0xc208300600, 0xc208300660)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:65 +0xbc
created by github.com/jackpal/Taipei-Torrent/torrent.NewPeerState
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:94 +0x74

goroutine 66 [chan receive]:
github.com/jackpal/Taipei-Torrent/torrent.(*peerState).peerWriter(0xc208304d00, 0xc208004420)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:240 +0xa1
created by github.com/jackpal/Taipei-Torrent/torrent.(*TorrentSession).addPeerImp
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:418 +0x41e

goroutine 67 [runnable]:
net.runtime_pollWait(0x7f818a43e490, 0x72, 0x0)
        /usr/local/go/src/pkg/runtime/netpoll.goc:146 +0x66
net.(*pollDesc).Wait(0xc208052d80, 0x72, 0x0, 0x0)
        /usr/local/go/src/pkg/net/fd_poll_runtime.go:84 +0x46
net.(*pollDesc).WaitRead(0xc208052d80, 0x0, 0x0)
        /usr/local/go/src/pkg/net/fd_poll_runtime.go:89 +0x42
net.(*netFD).Read(0xc208052d20, 0xc2082ba75c, 0x4, 0x4, 0x0, 0x7f818a43d440, 0xb)
        /usr/local/go/src/pkg/net/fd_unix.go:232 +0x30e
net.(*conn).Read(0xc20803e0a0, 0xc2082ba75c, 0x4, 0x4, 0x0, 0x0, 0x0)
        /usr/local/go/src/pkg/net/net.go:122 +0xe7
github.com/jackpal/Taipei-Torrent/torrent.readNBOUint32(0x7f818a43f048, 0xc20803e0a0, 0x7f8100000000, 0x0, 0x0)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:225 +0xcd
github.com/jackpal/Taipei-Torrent/torrent.(*peerState).peerReader(0xc208304d00, 0xc208004420)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:276 +0x47
created by github.com/jackpal/Taipei-Torrent/torrent.(*TorrentSession).addPeerImp
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:419 +0x447

goroutine 78 [chan receive]:
github.com/jackpal/Taipei-Torrent/torrent.(*peerState).peerWriter(0xc2082c6340, 0xc208004420)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:240 +0xa1
created by github.com/jackpal/Taipei-Torrent/torrent.(*TorrentSession).addPeerImp
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:418 +0x41e

goroutine 91 [chan receive]:
github.com/jackpal/Taipei-Torrent/torrent.queueingWriter(0xc2082da5a0, 0xc2082da600)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:65 +0xbc
created by github.com/jackpal/Taipei-Torrent/torrent.NewPeerState
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:94 +0x74

goroutine 79 [runnable]:
net.runtime_pollWait(0x7f818a43e5f0, 0x72, 0x0)
        /usr/local/go/src/pkg/runtime/netpoll.goc:146 +0x66
net.(*pollDesc).Wait(0xc2081bc530, 0x72, 0x0, 0x0)
        /usr/local/go/src/pkg/net/fd_poll_runtime.go:84 +0x46
net.(*pollDesc).WaitRead(0xc2081bc530, 0x0, 0x0)
        /usr/local/go/src/pkg/net/fd_poll_runtime.go:89 +0x42
net.(*netFD).Read(0xc2081bc4d0, 0xc2084ae22d, 0x3ddc, 0x3ddc, 0x0, 0x7f818a43d440, 0xb)
        /usr/local/go/src/pkg/net/fd_unix.go:232 +0x30e
net.(*conn).Read(0xc20803e0e0, 0xc2084ae22d, 0x3ddc, 0x3ddc, 0x0, 0x0, 0x0)
        /usr/local/go/src/pkg/net/net.go:122 +0xe7
io.ReadAtLeast(0x7f818a448798, 0xc20803e0e0, 0xc2084ae000, 0x4009, 0x4009, 0x4009, 0x22d, 0x0, 0x0)
        /usr/local/go/src/pkg/io/io.go:289 +0x11e
io.ReadFull(0x7f818a448798, 0xc20803e0e0, 0xc2084ae000, 0x4009, 0x4009, 0x4009, 0x0, 0x0)
        /usr/local/go/src/pkg/io/io.go:307 +0x89
github.com/jackpal/Taipei-Torrent/torrent.(*peerState).peerReader(0xc2082c6340, 0xc208004420)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:293 +0x16f
created by github.com/jackpal/Taipei-Torrent/torrent.(*TorrentSession).addPeerImp
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:419 +0x447

goroutine 93 [chan receive]:
github.com/jackpal/Taipei-Torrent/torrent.(*peerState).peerWriter(0xc2082c71e0, 0xc208004420)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:240 +0xa1
created by github.com/jackpal/Taipei-Torrent/torrent.(*TorrentSession).addPeerImp
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:418 +0x41e

goroutine 94 [runnable]:
net.runtime_pollWait(0x7f818a43e280, 0x72, 0x0)
        /usr/local/go/src/pkg/runtime/netpoll.goc:146 +0x66
net.(*pollDesc).Wait(0xc2081bd6b0, 0x72, 0x0, 0x0)
        /usr/local/go/src/pkg/net/fd_poll_runtime.go:84 +0x46
net.(*pollDesc).WaitRead(0xc2081bd6b0, 0x0, 0x0)
        /usr/local/go/src/pkg/net/fd_poll_runtime.go:89 +0x42
net.(*netFD).Read(0xc2081bd650, 0xc2082a53f8, 0x4, 0x4, 0x0, 0x7f818a43d440, 0xb)
        /usr/local/go/src/pkg/net/fd_unix.go:232 +0x30e
net.(*conn).Read(0xc20803e128, 0xc2082a53f8, 0x4, 0x4, 0x0, 0x0, 0x0)
        /usr/local/go/src/pkg/net/net.go:122 +0xe7
github.com/jackpal/Taipei-Torrent/torrent.readNBOUint32(0x7f818a43f048, 0xc20803e128, 0x7f8100000000, 0x0, 0x0)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:225 +0xcd
github.com/jackpal/Taipei-Torrent/torrent.(*peerState).peerReader(0xc2082c71e0, 0xc208004420)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/peer.go:276 +0x47
created by github.com/jackpal/Taipei-Torrent/torrent.(*TorrentSession).addPeerImp
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:419 +0x447

I can work on this but it may take me some time.

nictuku commented 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
jackpal commented 10 years ago

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.

jackpal commented 10 years ago

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.

nictuku commented 10 years ago

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

jackpal commented 10 years ago

Aha, that's very interesting. Index 631 out of range 0..0 - sounds like the bitset is uninitialized.

jackpal commented 10 years ago

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.