Tribler / tribler

Privacy enhanced BitTorrent client with P2P content discovery
https://www.tribler.org
GNU General Public License v3.0
4.74k stars 445 forks source link

[7.14.0] ValueError: invalid literal for int() with base 10 (in DownloadManager.set_proxy_settings) #8014

Closed kozlovsky closed 1 month ago

kozlovsky commented 2 months ago
Traceback (most recent call last):, 
  File "tribler/core/components/component.py", line 42, in start, 
  File "tribler/core/components/libtorrent/libtorrent_component.py", line 31, in run, 
  File "tribler/core/components/libtorrent/download_manager/download_manager.py", line 150, in initialize, 
  File "tribler/core/components/libtorrent/download_manager/download_manager.py", line 340, in get_session, 
  File "tribler/core/components/libtorrent/download_manager/download_manager.py", line 296, in create_session, 
  File "tribler/core/components/libtorrent/download_manager/download_manager.py", line 354, in set_proxy_settings, 
ValueError: invalid literal for int() with base 10: '//rutorrent.frixa.appboxes.co'

Here:

    def set_proxy_settings(self, ltsession, ptype, server=None, auth=None):
        """
        Apply the proxy settings to a libtorrent session. This mechanism changed significantly in libtorrent 1.1.0.
        """
        settings = {}
        settings["proxy_type"] = ptype
        settings["proxy_hostnames"] = True
        settings["proxy_peer_connections"] = True
        if server and server[0] and server[1]:
            settings["proxy_hostname"] = server[0]
            settings["proxy_port"] = int(server[1])  # <-- here

It looks like the user specified an incorrect value for the LibtorrentSettings.proxy_server config option.

The error does not look serious, but instead of a generic ValueError, it is better to raise a specific error that describes the problem to the user so he can fix the configuration settings.

sentry-for-tribler[bot] commented 2 months ago

Sentry issue: TRIBLER-1PH