atomashpolskiy / bt

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

[BUG] Can't seem to instantiate BtClientBuilder #145

Open Larsg310 opened 3 years ago

Larsg310 commented 3 years ago

Describe the bug I can't seem to create an instance of BtClient (both using shared and private runtime)

I have these snippets of code: image image

Running this code line by line will result in the first breakpoint being hit (Bt.client(BtRuntime)), but second breakpoint never gets hit...

In the logs I get this after the call to Bt.client(BtRuntime):

[23:08:34] [INFO] [BtRuntimeBuilder] Loading standard extension module bt.peer.lan.LocalServiceDiscoveryModule [23:08:34] [INFO] [BtRuntimeBuilder] Loading standard extension module bt.peerexchange.PeerExchangeModule [23:08:34] [INFO] [BtRuntimeBuilder] Overriding auto-loaded module bt.dht.DHTModule [23:08:34] [INFO] [BtRuntimeBuilder] Auto-loading module bt.portmapping.upnp.UpnpPortMapperModule with default configuration [23:08:34] [INFO] [BtRuntimeBuilder] Auto-loading module bt.tracker.http.HttpTrackerModule with default configuration

Nothing else relating to Bt appears in the logs... (I'm using Log4j to Slf4j)

The magnet url:

magnet:?xt=urn:btih:4e8a37043ca23f814de726049568e11fd3422c9c&dn=The.Boys.S02E02.720p.HEVC.x265-MeGusta%5Beztv%5D&tr=udp://tracker.coppersurfer.tk:80&tr=udp://glotorrents.pw:6969/announce&tr=udp://tracker.leechers-paradise.org:6969&tr=udp://tracker.opentrackr.org:1337/announce&tr=udp://exodus.desync.com:6969

Desktop (please complete the following information):

atomashpolskiy commented 3 years ago

Seems like it's stuck on creating the injector. Can you post a thread dump of the stuck process (it can be called from the debug pane in IDE or by using jmap)?

On Tue, 19 Jan 2021, 23:33 Lars Gerrits, notifications@github.com wrote:

Describe the bug I can't seem to create an instance of BtClient (both using shared and private runtime) using BtClientBuilder.

I have these snippets of code: [image: image] https://user-images.githubusercontent.com/5021026/105100576-b821d880-5aad-11eb-8db8-d56a330cb3a2.png [image: image] https://user-images.githubusercontent.com/5021026/105100842-367e7a80-5aae-11eb-8c20-58604dd5034d.png

Running this code line by line will result in the first breakpoint being hit (Bt.client()), but the breakpoint after the In the logs I get this:

[23:08:34] [INFO] [BtRuntimeBuilder] Loading standard extension module bt.peer.lan.LocalServiceDiscoveryModule [23:08:34] [INFO] [BtRuntimeBuilder] Loading standard extension module bt.peerexchange.PeerExchangeModule [23:08:34] [INFO] [BtRuntimeBuilder] Overriding auto-loaded module bt.dht.DHTModule [23:08:34] [INFO] [BtRuntimeBuilder] Auto-loading module bt.portmapping.upnp.UpnpPortMapperModule with default configuration [23:08:34] [INFO] [BtRuntimeBuilder] Auto-loading module bt.tracker.http.HttpTrackerModule with default configuration

Nothing else relating to Bt appears in the logs... (I'm using Log4j to Slf4j)

The magnet url:

magnet:?xt=urn:btih:4e8a37043ca23f814de726049568e11fd3422c9c&dn=The.Boys.S02E02.720p.HEVC.x265-MeGusta%5Beztv%5D&tr=udp://tracker.coppersurfer.tk:80 &tr=udp:// glotorrents.pw:6969/announce&tr=udp://tracker.leechers-paradise.org:6969&tr=udp://tracker.opentrackr.org:1337/announce&tr=udp://exodus.desync.com:6969

Desktop (please complete the following information):

  • Device: Desktop
  • OS: Windows 10
  • Java version: Java 14
  • NAT/Firewall/VPN etc.:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/atomashpolskiy/bt/issues/145, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4TJBSA2JXPPYUTCJPEZ73S2YCCTANCNFSM4WJT3TUA .

Larsg310 commented 3 years ago

threads_report.txt

This is the thread dump from IntelliJ right after the Bt.client(BtRuntime) call. I'm calling this from the "Download Thread@6811" thread.

Though what seems weird to me, is that the thread doesn't wait, because any subsequent calls to the same thread still run directly.

Larsg310 commented 3 years ago

This particular bug is solved! The reason: Java 9 modules!

image

After some debugging, I found out Guice isn't able to instantiate classes because the module system prevented that. I had to add an --add-opens to allow Guice to do it's job.

I am now able to instantiate and start an instance of BtClient, and I've successfully downloaded a torrent.

However, I'm getting some errors connecting to peers, do you mind if I post the logs here or should I make a new report?

They are both trimmed in size, as they are repeating the same thing over and over: bt.log bt-dht.log

image

atomashpolskiy commented 3 years ago

Glad that you found the solution! As for peer connectivity issues, these are OK in general case, and there is a long-standing task to somehow address the log verbosity.

On Wed, 20 Jan 2021, 20:36 Lars Gerrits, notifications@github.com wrote:

This particular bug is solved! The reason: Java 9 modules!

[image: image] https://user-images.githubusercontent.com/5021026/105221390-55861680-5b59-11eb-8fb5-77bd8e3e69c6.png

After some debugging, I found out Guice isn't able to instantiate classes because the module system prevented that. I had to add an --add-opens to allow Guice to do it's job.

I am now able to instantiate and start an instance of BtClient, and I've successfully downloaded a torrent.

However, I'm getting some errors connecting to peers, do you mind if I post the logs here or should I make a new report?

They are both trimmed in size, as they are repeating the same thing over and over: bt.log https://github.com/atomashpolskiy/bt/files/5844849/bt.log bt-dht.log https://github.com/atomashpolskiy/bt/files/5844852/bt-dht.log

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/atomashpolskiy/bt/issues/145#issuecomment-763883706, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4TJBUH2KRX4KHNBMSPUP3S24WDBANCNFSM4WJT3TUA .