Xpra-org / xpra

Persistent remote applications for X11; screen sharing for X11, MacOS and MSWindows.
https://xpra.org/
GNU General Public License v2.0
1.99k stars 169 forks source link

Clients cannot connect, server logs: TypeError: object of type 'NoneType' has no len() #4390

Closed Oblomov closed 1 month ago

Oblomov commented 1 month ago

Describe the bug Clients fail to connect, with the following error recorded in the log:

2024-10-14 16:11:12,498 Error in worker thread processing item <bound method MenuProvider.got_menu_data of <xpra.server.menu_provider.MenuProvider object at 0x7f6f35d726b0>>
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/xpra/server/background_worker.py", line 74, in run
    item()
  File "/usr/lib/python3/dist-packages/xpra/server/menu_provider.py", line 173, in got_menu_data
    cb(self.menu_data)
  File "/usr/lib/python3/dist-packages/xpra/server/mixins/child_command.py", line 183, in send_updated_menu
    self.do_send_xdg_menu_data(source, xdg_menu)
  File "/usr/lib/python3/dist-packages/xpra/server/mixins/child_command.py", line 178, in do_send_xdg_menu_data
    log(f"{len(xdg_menu)} menu data entries sent to {ss}")
           ^^^^^^^^^^^^^
TypeError: object of type 'NoneType' has no len()
2024-10-14 16:11:12,500 Error: error in network packet write/format
2024-10-14 16:11:12,502  invalid None value in 'setting-change' packet at index 2
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/xpra/net/protocol/socket_handler.py", line 487, in write_format_thread_loop
    self._add_packet_to_queue(*gpc())
  File "/usr/lib/python3/dist-packages/xpra/net/protocol/socket_handler.py", line 503, in _add_packet_to_queue
    chunks: tuple[NetPacketType, ...] = tuple(self.encode(packet))
                                              ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/xpra/net/protocol/socket_handler.py", line 661, in encode
    raise TypeError(f"invalid None value in {packet_type!r} packet at index {i}")
TypeError: invalid None value in 'setting-change' packet at index 2
2024-10-14 16:11:12,509 DPI set to 96 x 96
2024-10-14 16:11:12,509 1 packets received (5.6K bytes)
2024-10-14 16:11:12,509 8 packets sent (5.1K bytes)
2024-10-14 16:11:12,512 Python/GTK3 client 1 disconnected.

Repeated attempts are done by the client, always failing the same way, until the client gives up.

To Reproduce Steps to reproduce the behavior:

  1. server command
  2. client command
  3. specific action to trigger the bug

System Information (please complete the following information):

Additional context The client works correctly on another installation with an older xpra server installed. This is a fresh server-only installation on a server with no X or DE environment configured for any of the users. The issue comes from xdg_menu being None in do_send_xdg_menu_data as called from send_updated_menu . send_updated_menu should either skip sending when xdg_menu is None, or do_send_xdg_menu should have something like xdg_menu = xdg_menu or {} similarly to how send_xdg_menu_data wraps self._get_xdg_menu_data() or {}.

EgosOwn commented 1 month ago

Looks like a dupe of #4389 . totaam made a commit you can find there that fixed it for me.