I2P SAM connection not recovered when lost #15136

Open
opened 2026-02-22 01:48:42 -05:00 by deekerman · 3 comments
Owner

Originally created by @mpeter50 on GitHub (Nov 5, 2023).

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

Originally created by @mpeter50 on GitHub (Nov 5, 2023). ### 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](https://github.com/qbittorrent/qBittorrent/assets/83356418/39c07fff-cd3d-4657-8ce0-a109513a0de3) 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](https://geti2p.net/en/download) (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_
Author
Owner

@glassez commented on GitHub (Nov 5, 2023):

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

@glassez commented on GitHub (Nov 5, 2023): This issue shoud be reported to [libtorrent](https://github.com/arvidn/libtorrent) since it is actually responsible for such backend stuff.
Author
Owner

@mpeter50 commented on GitHub (Nov 5, 2023):

Oh, thanks!

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

@mpeter50 commented on GitHub (Nov 5, 2023): Oh, thanks! It seems there is a similar issue for it already there: arvidn/libtorrent#7453
Author
Owner

@Neustradamus commented on GitHub (Jan 27, 2025):

@arvidn has done a recent PR about I2P:

@Neustradamus commented on GitHub (Jan 27, 2025): @arvidn has done a recent PR about I2P: - https://github.com/arvidn/libtorrent/pull/7831
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/qBittorrent#15136
No description provided.