atomashpolskiy / bt

BitTorrent library and client with DHT, magnet links, encryption and more
https://atomashpolskiy.github.io/bt/
Apache License 2.0
2.41k stars 382 forks source link

Receiving bt.net.DataReceivingLoop Failed to process key error while triggering the torrent #86

Closed architm closed 6 years ago

architm commented 6 years ago

This is the stackTrace

2018-06-30 16:06:37.620 ERROR 90434 --- [t.data-receiver] bt.net.DataReceivingLoop  : Failed to process key

java.lang.RuntimeException: Unexpected I/O error at bt.net.pipeline.SocketChannelHandler.read(SocketChannelHandler.java:83) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.net.pipeline.DefaultChannelPipeline$DefaultChannelHandlerContext.fireChannelReady(DefaultChannelPipeline.java:192) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.net.DataReceivingLoop.processKey(DataReceivingLoop.java:161) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.net.DataReceivingLoop.run(DataReceivingLoop.java:126) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_92] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_92] at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_92] Caused by: java.io.EOFException: null at bt.net.pipeline.SocketChannelHandler.processInboundData(SocketChannelHandler.java:136) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.net.pipeline.SocketChannelHandler.read(SocketChannelHandler.java:80) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] ... 6 common frames omitted

Can you let me know why it is happening and implication of this in my application. The torrent is getting downloaded perfectly but want to root cause this issue before going forward.

atomashpolskiy commented 6 years ago

EOFException means that the remote peer closed the connection.

architm commented 6 years ago

Then is it good to log it as an error? It will try to find alternative peers then?

There are some other errors as well which i am getting.

[2m2018-06-30 16:15:34.267 ERROR 90434 --- [ecutor-thread-1] bt.torrent.TrackerAnnouncer  : Failed to announce 'complete' event due to unexpected error during interaction with the tracker: MultiTracker{trackerTiers=[[UdpTracker{trackerUrl=http://zer0day.ch:1337/announce}], [UdpTracker{trackerUrl=http://tracker.coppersurfer.tk:6969/announce}], [UdpTracker{trackerUrl=http://tracker.openbittorrent.com:80/announce}], [UdpTracker{trackerUrl=http://glotorrents.pw:6969/announce}], [UdpTracker{trackerUrl=http://glotorrents.com:6969/announce}], [UdpTracker{trackerUrl=http://tracker.sktorrent.net:6969/announce}]]}

bt.BtException: All trackers failed; responses (in chrono order): [bt.tracker.TrackerResponse@51702634, bt.tracker.TrackerResponse@7518dbe9, bt.tracker.TrackerResponse@3b8be989, bt.tracker.TrackerResponse@27016a70, bt.tracker.TrackerResponse@7710b922, bt.tracker.TrackerResponse@44e4f3ba] at bt.tracker.MultiTracker$1.tryForAllTrackers(MultiTracker.java:145) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.tracker.MultiTracker$1.complete(MultiTracker.java:85) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.torrent.TrackerAnnouncer.lambda$complete$2(TrackerAnnouncer.java:98) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at java.util.Optional.ifPresent(Optional.java:159) ~[na:1.8.0_92] at bt.torrent.TrackerAnnouncer.complete(TrackerAnnouncer.java:96) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at java.util.Optional.ifPresent(Optional.java:159) ~[na:1.8.0_92] at bt.processor.torrent.ProcessTorrentStage.onCompleted(ProcessTorrentStage.java:97) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.torrent.ProcessTorrentStage.complete(ProcessTorrentStage.java:90) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.torrent.ProcessTorrentStage.doExecute(ProcessTorrentStage.java:66) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.torrent.ProcessTorrentStage.doExecute(ProcessTorrentStage.java:34) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.TerminateOnErrorProcessingStage.doExecute(TerminateOnErrorProcessingStage.java:38) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.RoutingProcessingStage.execute(RoutingProcessingStage.java:39) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.ChainProcessor.doExecute(ChainProcessor.java:112) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.ChainProcessor.executeStage(ChainProcessor.java:96) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.ChainProcessor.executeStage(ChainProcessor.java:98) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.ChainProcessor.executeStage(ChainProcessor.java:98) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.ChainProcessor.executeStage(ChainProcessor.java:98) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.ChainProcessor.executeStage(ChainProcessor.java:98) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.ChainProcessor.lambda$process$0(ChainProcessor.java:81) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1626) ~[na:1.8.0_92] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_92] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_92] at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_92]

It seems that it is unable to announce completion of torrent. Am i missing something in setup?

atomashpolskiy commented 6 years ago

Nope, most probably trackers are unavailable for some reason

On Sat, 30 Jun 2018, 13:53 Archit Maheshwari, notifications@github.com wrote:

Then is it good to log it as an error? It will try to find alternative peers then?

There some other errors i am getting

[2m2018-06-30 16:15:34.267�[0;39m �[31mERROR�[0;39m �[35m90434�[0;39m �[2m---�[0;39m �[2m[ecutor-thread-1]�[0;39m �[36mbt.torrent.TrackerAnnouncer �[0;39m �[2m:�[0;39m Failed to announce 'complete' event due to unexpected error during interaction with the tracker: MultiTracker{trackerTiers=[[UdpTracker{trackerUrl= http://zer0day.ch:1337/announce}], [UdpTracker{trackerUrl= http://tracker.coppersurfer.tk:6969/announce}], [UdpTracker{trackerUrl= http://tracker.openbittorrent.com:80/announce}], [UdpTracker{trackerUrl= http://glotorrents.pw:6969/announce}], [UdpTracker{trackerUrl= http://glotorrents.com:6969/announce}], [UdpTracker{trackerUrl= http://tracker.sktorrent.net:6969/announce}]]}

bt.BtException: All trackers failed; responses (in chrono order): [bt.tracker.TrackerResponse@51702634, bt.tracker.TrackerResponse@7518dbe9, bt.tracker.TrackerResponse@3b8be989, bt.tracker.TrackerResponse@27016a70, bt.tracker.TrackerResponse@7710b922, bt.tracker.TrackerResponse@44e4f3ba] at bt.tracker.MultiTracker$1.tryForAllTrackers(MultiTracker.java:145) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.tracker.MultiTracker$1.complete(MultiTracker.java:85) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.torrent.TrackerAnnouncer.lambda$complete$2(TrackerAnnouncer.java:98) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at java.util.Optional.ifPresent(Optional.java:159) ~[na:1.8.0_92] at bt.torrent.TrackerAnnouncer.complete(TrackerAnnouncer.java:96) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at java.util.Optional.ifPresent(Optional.java:159) ~[na:1.8.0_92] at bt.processor.torrent.ProcessTorrentStage.onCompleted(ProcessTorrentStage.java:97) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.torrent.ProcessTorrentStage.complete(ProcessTorrentStage.java:90) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.torrent.ProcessTorrentStage.doExecute(ProcessTorrentStage.java:66) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.torrent.ProcessTorrentStage.doExecute(ProcessTorrentStage.java:34) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.TerminateOnErrorProcessingStage.doExecute(TerminateOnErrorProcessingStage.java:38) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.RoutingProcessingStage.execute(RoutingProcessingStage.java:39) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.ChainProcessor.doExecute(ChainProcessor.java:112) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.ChainProcessor.executeStage(ChainProcessor.java:96) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.ChainProcessor.executeStage(ChainProcessor.java:98) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.ChainProcessor.executeStage(ChainProcessor.java:98) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.ChainProcessor.executeStage(ChainProcessor.java:98) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.ChainProcessor.executeStage(ChainProcessor.java:98) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at bt.processor.ChainProcessor.lambda$process$0(ChainProcessor.java:81) ~[bt-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT] at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1626) ~[na:1.8.0_92] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_92] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_92] at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_92]

It seems that it is unable to announce completion of torrent. Am i missing something in setup?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/atomashpolskiy/bt/issues/86#issuecomment-401533567, or mute the thread https://github.com/notifications/unsubscribe-auth/ADk0hu2ejNzP7Q1abvbcpwZWtDOVdn2nks5uB1ihgaJpZM4U97e- .

architm commented 6 years ago

Appreciate your quick response!

There are some other issues like the way i am calling library is like this btClient.startAsync(state -> { if (state.getPiecesRemaining() == 0) { btClient.stop(); isCompleted = true; System.out.println("Successfully completed torrent task!"); } else { System.out.println("Waiting for the torrent download to complete!"); } }, 1000);

How can i get the list of files information that is getting downloaded from my application? Basically after download is complete i want to process those files.

Any example would also work.

architm commented 6 years ago

Never mind got the example.