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

Panic -1 requesting.go (peer-requesting branch) #679

Closed
ELOUFIR opened this issue Oct 23, 2021 · 2 comments
Closed

Panic -1 requesting.go (peer-requesting branch) #679

ELOUFIR opened this issue Oct 23, 2021 · 2 comments
Assignees

Comments

@ELOUFIR
Copy link

ELOUFIR commented Oct 23, 2021

Hi,
I got this error sometimes (I'm using peer-requesting branch)

2021-10-23T21:55:53+0000 WARN  torrent.go:1497: "Sintel": error running handshook conn: main read loop: reading message length: EOF
2021-10-23T21:55:53+0000 WARN  torrent.go:1497: "Sintel": error running handshook conn: main read loop: reading message length: EOF
2021-10-23T21:55:55+0000 WARN  torrent.go:1497: "Sintel": error running handshook conn: main read loop: reading message length: EOF
2021-10-23T21:55:56+0000 WARN  torrent.go:1497: "Sintel": error running handshook conn: main read loop: reading message length: EOF
2021-10-23T21:56:23+0000 WARN  torrent.go:1497: "Sintel": error running handshook conn: main read loop: reading message length: EOF
panic: -1

goroutine 146647 [running]:
github.com/anacrolix/torrent.(*peerRequests).Less.func1(...)
        /root/go1/pkg/mod/github.com/anacrolix/[email protected]/requesting.go:151
github.com/anacrolix/torrent.(*peerRequests).Less(0xc002aff980, 0x0, 0x0)
        /root/go1/pkg/mod/github.com/anacrolix/[email protected]/requesting.go:166 +0x2e7container/heap.down({0xd21458, 0xc002aff980}, 0x3, 0x8)
        /root/simple/go/src/container/heap/heap.go:112 +0x109
container/heap.Init({0xd21458, 0xc002aff980})
        /root/simple/go/src/container/heap/heap.go:46 +0x53
github.com/anacrolix/torrent.(*Peer).getDesiredRequestState(0xc00dfb8800)
        /root/go1/pkg/mod/github.com/anacrolix/[email protected]/requesting.go:232 +0x165github.com/anacrolix/torrent.(*Peer).maybeUpdateActualRequestState.func1({0xd1d580, 0xc003cd9350})
        /root/go1/pkg/mod/github.com/anacrolix/[email protected]/requesting.go:249 +0x3d
runtime/pprof.Do({0xd1d510, 0xc0000340a8}, {{0xc002962f00, 0x0, 0x96ede6}}, 0xc0035d9d08)
        /root/simple/go/src/runtime/pprof/runtime.go:40 +0xa3
github.com/anacrolix/torrent.(*Peer).maybeUpdateActualRequestState(0xc00dfb8800)
        /root/go1/pkg/mod/github.com/anacrolix/[email protected]/requesting.go:245 +0x22dgithub.com/anacrolix/torrent.(*PeerConn).fillWriteBuffer(0xc00dfb8800)
        /root/go1/pkg/mod/github.com/anacrolix/[email protected]/peerconn.go:641 +0x25
github.com/anacrolix/torrent.(*PeerConn).startWriter.func1()
        /root/go1/pkg/mod/github.com/anacrolix/[email protected]/peer-conn-msg-writer.go:24 +0xa6
github.com/anacrolix/torrent.(*peerConnMsgWriter).run(0xc00dfb8c10, 0xdf8475800)
        /root/go1/pkg/mod/github.com/anacrolix/[email protected]/peer-conn-msg-writer.go:69 +0xdb
github.com/anacrolix/torrent.(*PeerConn).startWriter.func3()
        /root/go1/pkg/mod/github.com/anacrolix/[email protected]/peer-conn-msg-writer.go:40 +0xdd
created by github.com/anacrolix/torrent.(*PeerConn).startWriter
        /root/go1/pkg/mod/github.com/anacrolix/[email protected]/peer-conn-msg-writer.go:36 +0x1e5

From here :

File: requesting.go
134: func (p *peerRequests) Less(i, j int) bool {
135: 	leftRequest := p.requestIndexes[i]
136: 	rightRequest := p.requestIndexes[j]
137: 	t := p.peer.t
138: 	leftPieceIndex := leftRequest / p.torrentStrategyInput.ChunksPerPiece
139: 	rightPieceIndex := rightRequest / p.torrentStrategyInput.ChunksPerPiece
140: 	leftCurrent := p.peer.actualRequestState.Requests.Contains(leftRequest)
141: 	rightCurrent := p.peer.actualRequestState.Requests.Contains(rightRequest)
142: 	pending := func(index RequestIndex, current bool) int {
143: 		ret := t.pendingRequests.Get(index)
144: 		if current {
145: 			ret--
146: 		}
147: 		// I have a hunch that this could trigger for requests for chunks that are choked and not
148: 		// allowed fast, since the current conn shouldn't already be included. It's a very specific
149: 		// circumstance, and if it triggers I will fix it.
150: 		if ret < 0 {
151: 			panic(ret)
152: 		}
153: 		return ret
154: 	}
@anacrolix anacrolix changed the title Panic -1 requesting.go Panic -1 requesting.go (peer-requesting branch) Oct 24, 2021
@anacrolix anacrolix self-assigned this Oct 24, 2021
@anacrolix
Copy link
Owner

Thanks for reporting this. I suppose the hunch is correct. I know the fix I just need to get to it. Cheers

anacrolix added a commit that referenced this issue Oct 25, 2021
@anacrolix
Copy link
Owner

Should be fixed by e8067f7. Let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants