ProtonVPN / proton-vpn-gtk-app

Official ProtonVPN Linux app
https://protonvpn.com/download-linux
GNU General Public License v3.0
152 stars 20 forks source link

Fail to start if app crash or get killed unexpected last time #42

Open guoyunhe opened 3 months ago

guoyunhe commented 3 months ago

We are happy to answer your questions about the code or discuss technical ideas.

Please complete the following checklist (by adding [x]):


Step to reproduce:

  1. Start ProtonVPN GTK app
  2. Connect to a server
  3. Kill the app process or simply shutdown your system (this can happen when your laptop run out of battery)
  4. Try to start ProtonVPN again

Expected result:

The app should start with no problem

Actual result:

The app failed to start.

The reason is that when the ProtonVPN process was killed unexpectedly, here is no chance for it to clean up created NetworkManager connections for killswitch. Next time when you start ProtonVPN, it fails to recreate it.

截图_20240323_201804

2024-03-24T12:44:22.890956 | proton.vpn.connection.vpnconnector:238 | INFO | CONN:STATE_CHANGED | Disconnected (initial state)
Traceback (most recent call last):
  File "/usr/bin/protonvpn-app", line 33, in <module>
    sys.exit(load_entry_point('proton-vpn-gtk-app==4.2.0', 'console_scripts', 'protonvpn-app')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/proton/vpn/app/gtk/__main__.py", line 34, in main
    controller = Controller.get(executor)
                 ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/proton/vpn/app/gtk/controller.py", line 56, in get
    executor.submit(controller.initialize_vpn_connector).result()
  File "/usr/lib64/python3.11/concurrent/futures/_base.py", line 456, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/lib/python3.11/site-packages/proton/vpn/app/gtk/controller.py", line 89, in initialize_vpn_connector
    self._connector = await self._api.get_vpn_connector()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/proton/vpn/core/api.py", line 54, in get_vpn_connector
    vpn_connector = await VPNConnector.get_instance(settings)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/proton/vpn/connection/vpnconnector.py", line 66, in get_instance
    await cls._instance.initialize_state(initial_state)
  File "/usr/lib/python3.11/site-packages/proton/vpn/connection/vpnconnector.py", line 149, in initialize_state
    await self._update_state(state)
  File "/usr/lib/python3.11/site-packages/proton/vpn/connection/vpnconnector.py", line 250, in _update_state
    new_event = await state_tasks
                ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/proton/vpn/connection/states.py", line 176, in run_tasks
    await self.context.kill_switch.disable()
  File "/usr/lib/python3.11/site-packages/proton/vpn/killswitch/backend/linux/networkmanager/nmkillswitch.py", line 77, in disable
    await self._ks_handler.remove_full_killswitch_connection()
  File "/usr/lib/python3.11/site-packages/proton/vpn/killswitch/backend/linux/networkmanager/killswitch_connection_handler.py", line 202, in remove_full_killswitch_connection
    await self._remove_connection(_get_connection_id(permanent=False))
  File "/usr/lib/python3.11/site-packages/proton/vpn/killswitch/backend/linux/networkmanager/killswitch_connection_handler.py", line 228, in _remove_connection
    await _wrap_future(self.nm_client.remove_connection_async(connection))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/proton/vpn/killswitch/backend/linux/networkmanager/nmclient.py", line 230, in remove_connection_async
    self._run_on_glib_loop_thread(_remove_connection_async).result()
  File "/usr/lib64/python3.11/concurrent/futures/_base.py", line 456, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/lib/python3.11/site-packages/proton/vpn/killswitch/backend/linux/networkmanager/nmclient.py", line 118, in wrapper
    future.set_result(function(*args, **kwargs))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/proton/vpn/killswitch/backend/linux/networkmanager/nmclient.py", line 217, in _remove_connection_async
    handler_id = device.connect("state-changed", _on_interface_state_changed)
                 ^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'connect'
zacryol commented 3 months ago

I believe I have encountered this issue also, as well as a workaround: I deleted the killswitch connections manually via the Network Manager, enabling the PVPN app to recreate them from scratch.

guoyunhe commented 3 months ago

I believe I have encountered this issue also, as well as a workaround: I deleted the killswitch connections manually via the Network Manager, enabling the PVPN app to recreate them from scratch.

Yeah, I did the same. Still a bug for proton vpn. It should either be able to clean up old connections on boot, or reuse them, instead of crashing...

Cherkah commented 3 months ago

same probleme as @ guoyunhe

2024-04-02T05:43:30.645924 | proton.vpn.connection.vpnconnector:238 | INFO | CONN:STATE_CHANGED | Disconnected (initial state)
Traceback (most recent call last):
File "/usr/bin/protonvpn-app", line 33, in <module>
sys.exit(load_entry_point('proton-vpn-gtk-app==4.2.0', 'console_scripts', 'protonvpn-app')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/proton/vpn/app/gtk/__main__.py", line 34, in main
controller = Controller.get(executor)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/proton/vpn/app/gtk/controller.py", line 56, in get
executor.submit(controller.initialize_vpn_connector).result()
File "/usr/lib/python3.11/concurrent/futures/_base.py", line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/lib/python3.11/site-packages/proton/vpn/app/gtk/controller.py", line 89, in initialize_vpn_connector
self._connector = await self._api.get_vpn_connector()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/proton/vpn/core/api.py", line 54, in get_vpn_connector
vpn_connector = await VPNConnector.get_instance(settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/proton/vpn/connection/vpnconnector.py", line 66, in get_instance
await cls._instance.initialize_state(initial_state)
File "/usr/lib/python3.11/site-packages/proton/vpn/connection/vpnconnector.py", line 149, in initialize_state
await self._update_state(state)
File "/usr/lib/python3.11/site-packages/proton/vpn/connection/vpnconnector.py", line 250, in _update_state
new_event = await state_tasks
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/proton/vpn/connection/states.py", line 177, in run_tasks
await self.context.kill_switch.disable_ipv6_leak_protection()
File "/usr/lib/python3.11/site-packages/proton/vpn/killswitch/backend/linux/networkmanager/nmkillswitch.py", line 86, in disable_ipv6_leak_protection
await self._ks_handler.remove_ipv6_leak_protection()
File "/usr/lib/python3.11/site-packages/proton/vpn/killswitch/backend/linux/networkmanager/killswitch_connection_handler.py", line 215, in remove_ipv6_leak_protection
await self._remove_connection(_get_connection_id(permanent=False, ipv6=True))
File "/usr/lib/python3.11/site-packages/proton/vpn/killswitch/backend/linux/networkmanager/killswitch_connection_handler.py", line 228, in _remove_connection
await _wrap_future(self.nm_client.remove_connection_async(connection))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/proton/vpn/killswitch/backend/linux/networkmanager/nmclient.py", line 230, in remove_connection_async
self._run_on_glib_loop_thread(_remove_connection_async).result()
File "/usr/lib/python3.11/concurrent/futures/_base.py", line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/lib/python3.11/site-packages/proton/vpn/killswitch/backend/linux/networkmanager/nmclient.py", line 118, in wrapper
future.set_result(function(*args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/proton/vpn/killswitch/backend/linux/networkmanager/nmclient.py", line 216, in _remove_connection_async
device = self._nm_client.get_device_by_iface(connection.get_interface_name())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Argument 1 does not allow None as a value

the workaroud of @zacryol as temporary solution do the trick . Hope they will fix this bug as soon as possible

calexandru2018 commented 2 months ago

Hey all, thank you for your patience. We got some reports from CS about this and we'll prioritize this asap, we're currently trying to finalize WG.

Anonymous941 commented 2 months ago

Wow, WireGuard is being worked on! I wasn't expecting that, that's great

calexandru2018 commented 2 weeks ago

Hey all, we're still working on WireGuard but we've already released and experimental version for beta. Are you of you still experiencing this issue ?

Anonymous941 commented 1 week ago

Hey all, we're still working on WireGuard but we've already released and experimental version for beta. Are you of you still experiencing this issue ?

Do you mean a WG version? If so do you mind linking to it?