anacrolix / torrent

Full-featured BitTorrent client package and utilities
Mozilla Public License 2.0
5.41k stars 617 forks source link

panic: insufficient write buffer #793

Open JaskaranSM opened 1 year ago

JaskaranSM commented 1 year ago

Torrent: here

panic: insufficient write buffer

goroutine 355603 [running]:
github.com/anacrolix/torrent.(*Peer).applyRequestState(0xc0141a5200, {{{0xc000f9e000, 0xf8a, 0x1000}, 0xc0141a5200, {0xc001a46000, 0x4ecd8, 0x4ecd8}}, 0x1})
        /root/go/pkg/mod/github.com/anacrolix/torrent@v1.47.1-0.20221211042123-f75989863cfc/requesting.go:269 +0x678
github.com/anacrolix/torrent.(*Peer).maybeUpdateActualRequestState.func1({0x1e98990?, 0xc01d567860?})
        /root/go/pkg/mod/github.com/anacrolix/torrent@v1.47.1-0.20221211042123-f75989863cfc/requesting.go:259 +0xe5
runtime/pprof.Do({0x1e98920?, 0xc000112000?}, {{0xc012a1b8c0?, 0x0?, 0x0?}}, 0xc01052caf0)
        /opt/hostedtoolcache/go/1.19.4/arm64/src/runtime/pprof/runtime.go:40 +0xa3
github.com/anacrolix/torrent.(*Peer).maybeUpdateActualRequestState(0xc0141a5200)
        /root/go/pkg/mod/github.com/anacrolix/torrent@v1.47.1-0.20221211042123-f75989863cfc/requesting.go:254 +0x286
github.com/anacrolix/torrent.(*PeerConn).fillWriteBuffer(0xc0141a5200)
        /root/go/pkg/mod/github.com/anacrolix/torrent@v1.47.1-0.20221211042123-f75989863cfc/peerconn.go:707 +0x2b
github.com/anacrolix/torrent.(*PeerConn).initMessageWriter.func1()
        /root/go/pkg/mod/github.com/anacrolix/torrent@v1.47.1-0.20221211042123-f75989863cfc/peer-conn-msg-writer.go:24 +0xa6
github.com/anacrolix/torrent.(*peerConnMsgWriter).run(0xc0141a5640, 0xdf8475800)
        /root/go/pkg/mod/github.com/anacrolix/torrent@v1.47.1-0.20221211042123-f75989863cfc/peer-conn-msg-writer.go:75 +0xe2
github.com/anacrolix/torrent.(*PeerConn).messageWriterRunner(0xc014281980?)
        /root/go/pkg/mod/github.com/anacrolix/torrent@v1.47.1-0.20221211042123-f75989863cfc/peer-conn-msg-writer.go:47 +0xd8
created by github.com/anacrolix/torrent.(*PeerConn).startMessageWriter
        /root/go/pkg/mod/github.com/anacrolix/torrent@v1.47.1-0.20221211042123-f75989863cfc/peer-conn-msg-writer.go:40 +0x5b
anacrolix commented 6 months ago

I think I know what could cause this now. I suspect this might be possible if you're uploading heavily, and the request update runs on a buffer that is too full already. I wonder if https://github.com/anacrolix/torrent/commit/a1105a055cf4138deba564535eb34995fa014a0b fixes it.