transmission / transmission

Official Transmission BitTorrent client repository
https://transmissionbt.com
Other
12.31k stars 1.22k forks source link

Transmission for Mac (and probably not only) doesn't seem to open ports (also says "port closed" in Network settings) #7202

Open arsradu opened 1 month ago

arsradu commented 1 month ago

What is the issue?

Hey guys,

I have an issue here with Transmission (even with older versions like 2.9.2). So, first of all, the port shows always as "Closed". But here's the thing...it doesn't show up the clients connected in the router interface. It doesn't show up anywhere. So, it looks like it's not even opening those ports. At least they don't show up as open (under UPnP clients).

UPnP is enabled, port is the default one. And if I don't use UPnP and try to set Port Forwarding manually, I get this error.

Screenshot 2024-09-28 at 15 08 12

It does the same thing with any other port, as long as it's also set up in Transmission. Also, just to clarify, there is no other setting for that port, on my router. So...whatever the router is detecting...is not actually displayed on its interface. It's not like I'm trying to duplicate an existing rule I created earlier. From a UI standpoint, there is no other setting previously added. And trying to add it for the first time, results in that error.

However, with another bittorrent app (qBittorrent in this case), I do get the clients showing up in the router's interface.

Screenshot 2024-09-28 at 14 53 49

And the download speeds are also a lot better.

Point is, with qBittorrent, and the ports showing as in my screenshot above, I get faaar, far better speeds, downloading the exact same thing. Just for comparison, 50-60Mb/s vs 1.5Mb/s with Transmission. So it's a HUGE difference.

So, right now, looks like an app issue to me. Looks like the app is listening to the port (I ran lsof -i :[portNumber] and the port shows up as "LISTEN", but there is no "ESTABLISHED" connection during download), so, I think it might not be connecting through it). It probably does connect somehow, cause I can download...but the speeds are not great, as I mentioned above.

I also want to mention that I tested: curl -4 https://portcheck.transmissionbt.com/PortNumber; echo and curl -6 https://portcheck.transmissionbt.com/PortNumber; echo and they both return 0.

CanYouSeeMe.org shows: Error: I could not see your service on [IP] on port (51413) Reason: Connection timed out

But again, since it works fine with other apps, I think the problem is likely somewhere else.

I feel like this might be a combination of app issue and network setup. For reference, my setup looks like this: ISP > ONT > My Router (tp-link C80 in case it makes a difference) > PC/laptop etc.

I tested multiple versions, and this also occurs with previous OSes as well. So, I think it's probably just an unusual setup that hasn't been taken into account yet. I tested with Firewall turned OFF, just to have one less point of failure and be able to work only with router issues, not combinations of router and firewall.

I also tested the exact same app on another WiFi network, on another ISP, with a different setup (only ONT, which also doubles as wifi router) and the issue did NOT occur. Port showed up as Open, and everything ok.

I also read about other people's experiences and tested the theory of the IPv6 being the cause of this. However, I have IPv6 already disabled in my router. And even with it enabled, it doesn't make any difference to the issue.

So yeah....I know probably most people won't have this issue, if they're just using the default router/ONT, and it could also be ISP dependent. Mine is using PPPoE, just as a reference, the other one was not (not sure what exactly is it using, but it's not PPPoE).

Anyway, I wrote a lot, and I apologise for this. But I've had this issue for a looong time and never had the time to test different scenarios until recently. So I hope that helps.

If you have any questions or things you want me to try, please, let me know. I'd be glad to help, however I can.

Which application of Transmission?

macOS app

Which version of Transmission?

4.1.0-dev (5cc0934ddb)

Coeur commented 3 weeks ago

I can confirm this issue with the macOS client.

By the way, @arsradu, can you try and tell us if this is also happening or not with the QT and GTK clients on macOS? https://github.com/transmission/transmission/blob/main/docs/Building-Transmission.md

building the GTK client:

brew install gtk4 gtkmm4
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_GTK=ON -DENABLE_MAC=OFF
cmake --build build -t transmission-gtk
./build/gtk/transmission-gtk

building the Qt client:

brew install qt
brew services start dbus
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_QT=ON -DENABLE_MAC=OFF
cmake --build build -t transmission-qt
./build/qt/transmission-qt
arsradu commented 3 weeks ago

Hey there!

Thank you so much for the reply!

Unfortunately I haven't been able to compile those builds. I keep getting errors related to GTK not being found (though it's installed...).

"CMake Error at CMakeLists.txt:345 (message):
  GTK is required but wasn't found"

Most likely it's a setup issue on my side. Haven't used brew before, so I'm not quite familiar with how it works.

So unfortunately I wasn't able to compile any of these.

Can I use one of the nightly builds instead? Or would you be able to build it?

Thank you very much! :)

Coeur commented 3 weeks ago

Then, hum, what about the Qt build? I'm afraid I don't share executables (it would be a bad habit to trust strangers sharing executables).

Maybe if you just installed brew for the first time, then close your Terminal and re-open it?

arsradu commented 3 weeks ago

I tried that… still no luck. The QT build also gets stuck on “GTK not found”. I’ll try again later. Maybe I missed something. But I doubt it. It’s probably just the setup. But I’m not sure how to build with Brew and where do I need to put the source files to be able to compile. Maybe that’s the problem. Anyway, I’ll give it another try. Thank you very much!

arsradu commented 3 weeks ago

Update: I managed to build the QT version. Will test and come back. The GTK version still shows the same error.

I also had to install cmake and ninja from brew (brew install cmake and brew install ninja). But yeah, at least the QT version was built successfully.

For the GTK version...I still have no idea why it's not found... But anyway, I'll come back with results from the QT version.

Thank you!

arsradu commented 3 weeks ago

Managed to build the GTK version as well. Yay!

Two things I was missing:

  1. setting Brew path to .zshrc file (basically just creating a file called ".zshrc" and adding eval "$(/opt/homebrew/bin/brew shellenv)" (for Apple Silicon) to it. I missed this because at first I was installing Brew from Terminal, instead of downloading the pkg installer which also provides some very useful instructions.
  2. I installed pkg-config from Brew (brew install pkg-config) and did pkg-config gtk4 then pkg-config gtk4 --exists && echo Found, which returned "Found", so that's ok.

After that, I just followed the steps for cmake, build and all that. There are some (probably intended) visual issues with icons on the GTK version, and there is no port checker feature with this one (or maybe I couldn't find it), but otherwise it's ok.

With that being said, since I'm not currently at home right now, and only tried to see if I can build it and get it to work, I'll come back with fresh results tomorrow.

Once again, thank you very much for all your help. :)

arsradu commented 2 weeks ago

Update here:

I managed to test this.

With the QT version, port checker says "Closed" and it doesn't show in the router's interface (under UPnP connected devices).

Screenshot 2024-11-07 at 16 20 04

With the GTK version, I can't test port since there is no such feature, and there is also no difference in the router's interface.

So right now, looks like it's exactly the same regardless whether it's QT or GTK.

Please let me know if there's anything else I can help you with. :)

And once again, thank you very much for taking a look at this issue.

Coeur commented 2 weeks ago

Thank you. That's enough information to clarify that it's not specific to the Mac client, but that it's a core issue affecting Mac users.

cdowen commented 1 week ago

I build the daemon with current master(836e020) on mac, the port seems all right.

image

I also test with a 4.0.3 macos gui release, and the port is also open.

image
Coeur commented 1 week ago

Well evidently if the port is already opened, @cdowen, it will find it open. The issue is when the port is closed, it won't open it for you, although it should:

If your router supports NAT-PMP, UPnP, or you have Apple AirPort, Transmission can map its port automatically. Most routers manufactured since 2001 have this feature.

Also you wrote:

macos gui release

Maybe that's a hint that the app needs to be signed for the feature to work? (although I'd be surprised if code signing is the issue here). Care to try on newer builds, @cdowen, like 4.0.6 or building the main branch from source?

cdowen commented 1 week ago

The issue is when the port is closed, it won't open it for you, although it should:

I build the daemon from current main branch(836e020), and the port will be opened. I cannot test the gui build because I don't have xcode for now. The daemon is run with:

./daemon/transmission-daemon -f --peerport 51412

image

The screenshot is captured after I restart the router. It indicates UPnP is enabled and transmission opened tcp and udp ports.

Maybe its related to mac os version? I am still on Ventura 13.5.2.

arsradu commented 1 week ago

It's not related to the OS version. This is a really old issue. To me, it looks like a combination of Transmission app and network configuration.

It does work properly with other torrent clients, on the same network, with the same router, as I mentioned above, so this is not a router issue. Also I disabled Firewall, just so I can have a single point of failure, in case it fails. So it can't be Firewall either. Also, it's not the Mac, cause the same Mac and Transmission client work on other networks. Also other Torrent clients work on the same mac, on the same network where Transmission does not. Not to mention, I've got the exact same issue on different machines (including Windows). So this is definitely a broader issue.

cdowen commented 1 week ago

Maybe its related to GUI. I test again with the 4.0.3 release and enable randomized port on launch. This time the port is not opened. But after I manually edit the port, the port is opened.