proton-vpn-gtk-app icon indicating copy to clipboard operation
proton-vpn-gtk-app copied to clipboard

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

Open guoyunhe opened this issue 1 year ago • 7 comments

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

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

  • [x] I have searched open and closed issues for duplicates
  • [x] This isn't a feature request
  • [ ] This is not a report about my app not working as expected

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'

guoyunhe avatar Mar 23 '24 12:03 guoyunhe

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.

zacryol avatar Mar 27 '24 12:03 zacryol

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...

guoyunhe avatar Mar 27 '24 14:03 guoyunhe

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

Cherkah avatar Apr 02 '24 06:04 Cherkah

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.

calexandru2018 avatar Apr 17 '24 10:04 calexandru2018

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

Anonymous941 avatar Apr 18 '24 16:04 Anonymous941

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 ?

calexandru2018 avatar Jun 18 '24 10:06 calexandru2018

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?

Anonymous941 avatar Jun 22 '24 16:06 Anonymous941

@guoyunhe is this still an issue ? we've refactored a lot of code lately. If not, do you mind closing the ticket please.

calexandru2018 avatar Nov 07 '24 12:11 calexandru2018