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

Support notifying user of internal client errors #811

Open
colinmarc opened this issue Feb 11, 2023 · 1 comment
Open

Support notifying user of internal client errors #811

colinmarc opened this issue Feb 11, 2023 · 1 comment

Comments

@colinmarc
Copy link
Contributor

It's possible to get a torrent into an infinite error loop. For example, if you chown -R root /tmp/torrents and then try to run the default file storage over that directory, the torrent client will just spew errors forever like:

2023-02-11T15:45:07+0100 ERR [github.com/anacrolix/torrent.(*Peer).receiveChunk:1536]: *torrent.PeerConn 0xc001414000 [id="-qB4500-vtmhGE65sBwN", exts=0000000000180005, v="qBittorrent/4.5.0"]: writing received chunk 402: open /tmp/torrentd/downloads/dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c/Big Buck Bunny.mp4: permission denied
2023-02-11T15:45:07+0100 CRT [torrent dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c github.com/anacrolix/torrent.(*Torrent).onWriteChunkErr:2314]: "Big Buck Bunny": default chunk write error handler: disabling data download
2023-02-11T15:45:07+0100 NIL [torrent dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c github.com/anacrolix/torrent.(*Torrent).pieceHasher:2198]: "Big Buck Bunny": piece dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c/130 (f4578464fe213415b4d55c7d1527cf2519078d95) hash failure copy error: open /tmp/torrentd/downloads/dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c/Big Buck Bunny.mp4: permission denied
2023-02-11T15:45:08+0100 ERR [github.com/anacrolix/torrent.(*Peer).receiveChunk:1536]: *torrent.PeerConn 0xc00139c000 [id="-qB4250-*P2a7~)8(cC)", exts=0000000000180005, v="qBittorrent/4.2.5"]: writing received chunk 307: open /tmp/torrentd/downloads/dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c/Big Buck Bunny.mp4: permission denied
2023-02-11T15:45:08+0100 NIL [torrent dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c github.com/anacrolix/torrent.(*Torrent).pieceHasher:2198]: "Big Buck Bunny": piece dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c/131 (c16b55e2675f4693a82355bad030f234e130cd11) hash failure copy error: open /tmp/torrentd/downloads/dd8255ecdc7ca55fb0bbf81323d87062db1f6d1c/Big Buck Bunny.mp4: permission denied

Is there a way for a caller to detect that the torrent is in an errored state and cancel it, or at least report that to the user?

@anacrolix
Copy link
Owner

I haven't tested the case where hash checks fail. A unit test for this would be fantastic and easy to do. Let me know if you're interested, or I can create one.

There isn't really any errors exposed at the moment, this would be a good case to expose one. Let me know if you have thoughts on how that should look. The only existing precedent I think for something like this is https://pkg.go.dev/github.com/anacrolix/torrent#Torrent.SetOnWriteChunkError. I expect this could be generalized to serious errors like this case.

@anacrolix anacrolix changed the title Error state Support notifying user of internal client errors May 28, 2023
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