qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
28.66k stars 4.01k forks source link

I2P SAM connection not recovered when lost #19886

Open mpeter50 opened 1 year ago

mpeter50 commented 1 year ago

qBittorrent & operating system versions

qBittorrent: 4.6.0 x64 Qt: 6.4.3 Libtorrent: 2.0.9.0 Boost: 1.83.0 OpenSSL: 1.1.1w zlib: 1.3

What is the problem?

When the SAM connection to the I2P router is lost, it is not recovered automatically. This is not directly visible in qBittorrent (or is it?), but the I2P router console shows on the sidebar whether there are any SAM clients connected to it: image

When qBittorrent loses the SAM connection, the above list does not include the "SAM TCP Client" line anymore, as my router has no other SAM clients. Upon disabling and re-enabling I2P in the qBittorrent Connection settings, the "SAM TCP Client" line reappears in the above list.

So far I have identified sleep/hibernation for a longer period of time to cause this issue. It happening for as short as 2 minutes does not do so.

Steps to reproduce

  1. set up an I2P router, have it accept SAM connections
  2. set up qBittorrent for I2P through this router
  3. put your computer to sleep, prefereably for the night
  4. check the I2P router console for the list of local tunnels, and whether it includes "SAM TCP Client"
  5. disable and enable I2P in qBittorrent
  6. check the I2P router console for the list of local tunnels, and whether it includes "SAM TCP Client"

Additional context

The I2P router to which qBittorrent connects is running on a different machine on the local network. It is the Java version available here (ran on Linux, in Docker), version 2.3.0-0

I remember as if qB would log losing the SAM connection, but now I don't see it. Maybe that was only happening in the pre-release.

Another thing to note is that according to my I2P Router, something on my computer (I assumq qB, because I did not set up any SAM clients) is constantly re-registering it's SAM Handlers and SAM Bridges at the I2P Router. I do not know whether it is normal. I suspect that it is not, so I have mentioned this here. I see this in the logs:

2023-11-05 17:53:02.11 INFO  [HelloHandler] net.i2p.sam.SAMBridge         : Register net.i2p.sam.SAMBridge$1HelloHandler@e7c0178
2023-11-05 17:53:02.12 INFO  [HelloHandler] net.i2p.sam.SAMBridge         : Unregister net.i2p.sam.SAMBridge$1HelloHandler@e7c0178
2023-11-05 17:53:02.12 INFO  [SAMv3Handler] net.i2p.sam.SAMBridge         : Register SAMv3Handler; SAM version: 3.1; client: /192.168.1.20:56271)
2023-11-05 17:53:02.13 INFO  [andler 48885] net.i2p.sam.SAMBridge         : Unregister SAMv3Handler; SAM version: 3.1; client: /192.168.1.20:56271)
2023-11-05 17:53:06.28 INFO  [HelloHandler] net.i2p.sam.SAMBridge         : Register net.i2p.sam.SAMBridge$1HelloHandler@44b5a03d
2023-11-05 17:53:06.28 INFO  [HelloHandler] net.i2p.sam.SAMBridge         : Unregister net.i2p.sam.SAMBridge$1HelloHandler@44b5a03d
2023-11-05 17:53:06.28 INFO  [SAMv3Handler] net.i2p.sam.SAMBridge         : Register SAMv3Handler; SAM version: 3.1; client: /192.168.1.20:56398)
2023-11-05 17:53:06.29 INFO  [andler 48886] net.i2p.sam.SAMBridge         : Unregister SAMv3Handler; SAM version: 3.1; client: /192.168.1.20:56398)

What is repeated here 2 times, 4 seconds apart, seem to be happening every 3-6 seconds. It does not go an at all times, but when it does, it gets repeated this way. Now that I'm looking at it again, this might be happening all the while qB is not connected according to the Local Tunnels list that I have screenshotted.

Log(s) & preferences file(s)

No response

glassez commented 1 year ago

This issue shoud be reported to libtorrent since it is actually responsible for such backend stuff.

mpeter50 commented 1 year ago

Oh, thanks!

It seems there is a similar issue for it already there: arvidn/libtorrent#7453