Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server crash with client switch #3537

Closed
totaam opened this issue May 7, 2022 · 3 comments
Closed

server crash with client switch #3537

totaam opened this issue May 7, 2022 · 3 comments
Labels
bug Something isn't working server

Comments

@totaam
Copy link
Collaborator

totaam commented May 7, 2022

Was testing #3439, so the server is Ubuntu 20.04.
The bug only occurs if I first connect with a dual 4K Fedora client, then with a much smaller MS Windows client.

Traceback (most recent call first):
  File "/usr/lib/python3/dist-packages/xpra/x11/models/window.py", line 498, in _do_update_client_geometry
    self.corral_window.move_resize(x, y, w, h)
  File "/usr/lib/python3/dist-packages/xpra/x11/models/window.py", line 487, in _update_client_geometry
    self._do_update_client_geometry(window_size, window_position)
  File "/usr/lib/python3/dist-packages/xpra/x11/models/window.py", line 1275, in _handle_wm_normal_hints_change
  File "/usr/lib/python3/dist-packages/xpra/x11/models/core.py", line 565, in _handle_property_change
    handler(self)
  File "/usr/lib/python3/dist-packages/xpra/x11/models/core.py", line 531, in do_xpra_property_notify_event
    self._handle_property_change(str(event.atom))
  File "/usr/lib/python3/dist-packages/xpra/x11/models/window.py", line 395, in do_xpra_property_notify_event
    super().do_xpra_property_notify_event(event)
  <built-in method emit of WindowModel object at remote 0x7fffaf949e40>
  File "/usr/lib/python3/dist-packages/gi/overrides/Gtk.py", line 1632, in main
    return _Gtk_main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/xpra/server/gtk_server_base.py", line 119, in do_run
--Type <RET> for more, q to quit, c to continue without paging--
    Gtk.main()
  File "/usr/lib/python3/dist-packages/xpra/server/server_core.py", line 434, in run
    self.do_run()
  File "/usr/lib/python3/dist-packages/xpra/scripts/server.py", line 4450, in _do_run_server
  File "/usr/lib/python3/dist-packages/xpra/scripts/server.py", line 924, in do_run_server
    if xrd=="/run/user/%i" % uid:
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 4071, in run_server
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 458, in do_run_mode
    return run_server(script_file, cmdline, error_cb, options, args, mode, defaults)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 680, in run_mode
    d = {}
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 142, in main
    return run_mode(script_file, cmdline, err, options, args, mode, defaults)
  File "/usr/bin/xpra", line 10, in <module>
    sys.exit(main(sys.argv[0], sys.argv))
#0  0x00007ffff4d588b5 in ?? () from /lib/x86_64-linux-gnu/libgdk-3.so.0
#1  0x00007ffff4d59389 in ?? () from /lib/x86_64-linux-gnu/libgdk-3.so.0
#2  0x00007ffff4d33467 in ?? () from /lib/x86_64-linux-gnu/libgdk-3.so.0
#3  0x00007ffff6798ff5 in ?? () from /lib/x86_64-linux-gnu/libffi.so.7
#4  0x00007ffff679840a in ?? () from /lib/x86_64-linux-gnu/libffi.so.7
#5  0x00007ffff69880a5 in ?? ()
   from /usr/lib/python3/dist-packages/gi/_gi.cpython-38-x86_64-linux-gnu.so
#6  0x00007ffff697f25c in ?? ()
   from /usr/lib/python3/dist-packages/gi/_gi.cpython-38-x86_64-linux-gnu.so
#7  0x00007ffff698319d in ?? ()
   from /usr/lib/python3/dist-packages/gi/_gi.cpython-38-x86_64-linux-gnu.so
#8  0x00000000005f3e1e in _PyObject_MakeTpCall (
    callable=<gi.FunctionInfo at remote 0x7fffc3f84fb0>, args=<optimized out>, 
    nargs=<optimized out>, keywords=<optimized out>)
    at ../Include/internal/pycore_pyerrors.h:13
#9  0x0000000000570674 in _PyObject_Vectorcall (kwnames=0x0, 
    nargsf=<optimized out>, args=0x150afd8, 
    callable=<gi.FunctionInfo at remote 0x7fffc3f84fb0>)
    at ../Include/cpython/abstract.h:125
#10 _PyObject_Vectorcall (kwnames=0x0, nargsf=<optimized out>, args=0x150afd8, 
    callable=<gi.FunctionInfo at remote 0x7fffc3f84fb0>)
    at ../Include/cpython/abstract.h:115
#11 call_function (kwnames=0x0, oparg=<optimized out>, 
--Type <RET> for more, q to quit, c to continue without paging--
    pp_stack=<synthetic pointer>, tstate=0x9634f0) at ../Python/ceval.c:4963
#12 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>)
    at ../Python/ceval.c:3469
#13 0x00000000005f6836 in PyEval_EvalFrameEx (throwflag=0, 
    f=Frame 0x150ae10, for file /usr/lib/python3/dist-packages/xpra/x11/models/window.py, line 498, in _do_update_client_geometry (self=<WindowModel(_gproperties={'client-window': <X11Window(_xpra_window_event_receivers={<...>, <CompositeHelper(client_window=<...>, xid=16777222, _use_xshm=True, _damage_handle=4194339, _xshm_handle=<xpra.x11.bindings.ximage.XShmWrapper at remote 0x7fffaf7b70b0>, _contents_handle=<xpra.x11.bindings.ximage.PixmapWrapper at remote 0x7fffb60368d0>, _border_width=0, _listening_to=[<X11Window(_xpra_window_event_receivers={<...>, <...>}) at remote 0x7fffaf7b9740>]) at remote 0x7fffaf94dc80>}) at remote 0x7fffaf949e00>, 'geometry': (182, 167, 894, 582), 'decorations': -1, 'state': frozenset(), 'depth': 32, 'xid': 16777222, 'pid': 9931, 'has-alpha': True, 'allowed-actions': ['_NET_WM_ACTION_CLOSE', '_NET_WM_ACTION_MOVE', '_NET_WM_ACTION_RESIZE', '_NET_WM_ACTION_FULLSCREEN', '_NET_WM_ACTION_MINIMIZE', '_NET_WM_ACTION_SHADE', '_NET_WM_ACTION_STICK', '_NET_WM_ACTION_MAXIMIZE_HORZ', '_NET_WM_ACT...(truncated)) at ../Python/ceval.c:741
@totaam
Copy link
Collaborator Author

totaam commented May 7, 2022

Last messages from -d all:

2022-05-07 14:11:50,515 startup_complete()
2022-05-07 14:11:50,515 org.xpra.Server.Event(startup-complete, ['5a89bfb8332bc10ead38d9eda7ae04fc35e8d2682df02ba2b975bddf01ec21f0'])
2022-05-07 14:11:50,516 changed tcp socket to nodelay=False
2022-05-07 14:11:50,520 server-event: ('startup-complete', '5a89bfb8332bc10ead38d9eda7ae04fc35e8d2682df02ba2b975bddf01ec21f0')
2022-05-07 14:11:50,520 exec_on_connect_commands() start=[], start_child=[]
2022-05-07 14:11:50,521 x_event_filter event=('xpra-property-notify-event', None)/PropertyNotify window=0x400002
2022-05-07 14:11:50,521 parse_event(..)=<X11:PropertyNotify {'send_event': '0', 'serial': '0x1660', 'delivered_to': '0x400002', 'window': '0x400002', 'atom': '_XSETTINGS_SETTINGS', 'time': '8377186'}>
2022-05-07 14:11:50,521 x_event_filter event=('xpra-property-notify-event', None)/PropertyNotify took 0.6ms
2022-05-07 14:11:50,522 packet type send alias not found for 'stop'
2022-05-07 14:11:50,528 read thread: eof
2022-05-07 14:11:50,529 io_thread_loop(read, <bound method Protocol._read of Protocol(Pipe(audio capture))>) loop ended, closed=False
[Thread 0x7fffcdfbb700 (LWP 10464) exited]
2022-05-07 14:11:50,529 parse thread: empty marker, exiting
[Thread 0x7fffb6b8a700 (LWP 10511) exited]
2022-05-07 14:11:50,530 packet type send alias not found for 'exit'
2022-05-07 14:11:50,532 source_subprocess_wrapper(10462).stop_process() sending stop request to audio capture
2022-05-07 14:11:50,534 source_subprocess_wrapper(None).stop_protocol() calling <bound method Protocol.close of Protocol(Pipe(audio capture))>
2022-05-07 14:11:50,534 Protocol.close(None) closed=False, connection=Pipe(audio capture)
2022-05-07 14:11:50,534 Protocol.close(None) calling <bound method TwoFileConnection.close of Pipe(audio capture)>
2022-05-07 14:11:50,535 Pipe(audio capture).close() close callback=<bound method subprocess_caller.subprocess_exit of source_subprocess_wrapper(None)>, readable=<_io.BufferedReader name=48>, writeable=<_io.BufferedWriter name=47>
2022-05-07 14:11:50,538 Pipe(audio capture).close() calling <bound method subprocess_caller.subprocess_exit of source_subprocess_wrapper(None)>
2022-05-07 14:11:50,539 subprocess_exit() command=['python3.8', '/usr/bin/xpra', '--windows=no', '--video-encoders=none', '--csc-modules=none', '--video-decoders=none', '--proxy-video-encoders=none', '_sound_record', '-', '-', 'pulsesrc', 'device=Xpra-Speaker.monitor', 'opus', '', '1.0']
2022-05-07 14:11:50,539 firing callback for 'exit': [(<bound method AudioMixin.sound_source_exit of ClientConnectionMuxer(1 : None)>, [])]
[New Thread 0x7fffb6b8a700 (LWP 10625)]
2022-05-07 14:11:50,540 close_files_thread() _readable=<_io.BufferedReader name=48>
2022-05-07 14:11:50,541 Pipe(audio capture).close() done
2022-05-07 14:11:50,566 terminate_queue_threads()
[Thread 0x7fffb764c700 (LWP 10612) exited]
2022-05-07 14:11:50,567 write thread: empty marker, exiting
2022-05-07 14:11:50,568 Protocol.close(None) closed=True, connection=None
2022-05-07 14:11:50,568 io_thread_loop(write, <bound method Protocol._write of Protocol(None)>) loop ended, closed=True
[Thread 0x7ffff0b9b700 (LWP 10613) exited]
2022-05-07 14:11:50,570 Protocol.close(None) done
[New Thread 0x7ffff0b9b700 (LWP 10626)]
2022-05-07 14:11:50,545 close_files_thread() calling <built-in method close of _io.BufferedReader object at 0x7ffff274df60>
2022-05-07 14:11:50,574 close_files_thread() _writeable=<_io.BufferedWriter name=47>
2022-05-07 14:11:50,574 close_files_thread() calling <built-in method close of _io.BufferedWriter object at 0x7fffd821b510>
[Thread 0x7fffb6b8a700 (LWP 10625) exited]
2022-05-07 14:11:50,576 compress_and_send_window_icon() 64x64 in RGBA format, 16384 bytes for wid=1
2022-05-07 14:11:50,577 get_cursor_image() cursor=[1665, 1223, 16, 16, 7, 7, 1, '1024 bytes', b'']
2022-05-07 14:11:50,587 get_cursor_data(): default cursor - clearing it
2022-05-07 14:11:50,587 send_empty_cursor(..)
2022-05-07 14:11:50,589 x_event_filter event=('xpra-property-notify-event', None)/PropertyNotify window=0x1400006
2022-05-07 14:11:50,584 compress_and_send_window_icon: 64x64 (max-size=(128, 128), standard-size=(64, 64)), pixel_format=RGBA
2022-05-07 14:11:50,594  must convert=True, must scale=False
2022-05-07 14:11:50,596 queuing window icon update: ('window-icon', 1, 64, 64, 'png', Compressed(png: 3346 bytes))
2022-05-07 14:11:50,597 parse_event(..)=<X11:PropertyNotify {'send_event': '0', 'serial': '0x1670', 'delivered_to': '0x1400006', 'window': '0x1400006', 'atom': 'WM_NORMAL_HINTS', 'time': '8377216'}>
2022-05-07 14:11:50,597 changed tcp socket to cork=True
2022-05-07 14:11:50,602 changed tcp socket to cork=False
2022-05-07 14:11:50,603 Property changed on 0x1400006: WM_NORMAL_HINTS
2022-05-07 14:11:50,603 WM_NORMAL_HINTS={'min_size': (327, 72), 'base_size': (14, 33), 'resize_inc': (11, 23), 'win_gravity': 1}
2022-05-07 14:11:50,604 get(decorations, -1) using get_property=-1
2022-05-07 14:11:50,604 updateprop(size-hints, {'base-size': (14, 33), 'increment': (11, 23), 'gravity': 1, 'minimum-size': (327, 72)}) previous value={'base-size': (14, 28), 'increment': (9, 18), 'gravity': 1, 'minimum-size': (327, 72)}
2022-05-07 14:11:50,604 updating metadata on WindowModel(0x1400006): <GParamBoxed 'size-hints'>
2022-05-07 14:11:50,604 can_send_window(WindowModel(0x1400006))=True
2022-05-07 14:11:50,605 make_metadata(2, WindowModel(0x1400006), size-hints)={'size-constraints': {'base-size': (14, 33), 'increment': (11, 23), 'gravity': 1, 'minimum-size': (327, 72)}}
2022-05-07 14:11:50,605 changed tcp socket to nodelay=True
2022-05-07 14:11:50,606 updated: size-hints={'base-size': (14, 33), 'increment': (11, 23), 'gravity': 1, 'minimum-size': (327, 72)}
2022-05-07 14:11:50,606 _update_client_geometry: ignored, owner=None, setup_done=True
2022-05-07 14:11:50,606 _do_update_client_geometry: allocated 734x460 (from <function WindowModel._update_client_geometry.<locals>.window_size at 0x7fffb5fc2940>)
2022-05-07 14:11:50,606 calc_constrained_size(734, 460, typedict({'base-size': (14, 33), 'increment': (11, 23), 'gravity': 1, 'minimum-size': (327, 72)}))=(729, 447) (size_constraints=(166, 47, 32767, 32767))
2022-05-07 14:11:50,606 _do_update_client_geometry: size({'base-size': (14, 33), 'increment': (11, 23), 'gravity': 1, 'minimum-size': (327, 72)})=729x447
2022-05-07 14:11:50,606 _do_update_client_geometry: position=3922x114 (from <function WindowModel._update_client_geometry.<locals>.window_position at 0x7fffb5fc29d0>)
2022-05-07 14:11:50,597 compress_and_send_window_icon() 48x48 in BGRA format, 9216 bytes for wid=2
2022-05-07 14:11:50,627 compress_and_send_window_icon: 48x48 (max-size=(128, 128), standard-size=(64, 64)), pixel_format=BGRA
2022-05-07 14:11:50,628  must convert=True, must scale=False
2022-05-07 14:11:50,629 queuing window icon update: ('window-icon', 2, 48, 48, 'png', Compressed(png: 1193 bytes))
2022-05-07 14:11:50,638 changed tcp socket to nodelay=False
2022-05-07 14:11:50,638 changed tcp socket to cork=True
2022-05-07 14:11:50,638 changed tcp socket to cork=False

Summary:

  • startup_complete() and associated dbus event
  • XSettings update
  • audio stop / exit for previous connection, close_files_thread etc
  • send_empty_cursor
  • update to WM_NORMAL_HINTS={'min_size': (327, 72), 'base_size': (14, 33), 'resize_inc': (11, 23), 'win_gravity': 1}
  • updated: size-hints={'base-size': (14, 33), 'increment': (11, 23), 'gravity': 1, 'minimum-size': (327, 72)}
  • _do_update_client_geometry: position=3922x114 (from <function WindowModel._update_client_geometry.<locals>.window_position at 0x7fffb5fc29d0>)
  • compress_and_send_window_icon

Suspicions: possibly the audio subprocess exit and one of its callbacks.
More likely: the update-client-geometry calls.

Reproducible with Fedora 4.4 latest server.

@totaam
Copy link
Collaborator Author

totaam commented May 7, 2022

With XPRA_WINDOW_PROPERTIES_DEBUG="size-hints":

2022-05-07 15:59:32,576 updateprop(size-hints, {'base-size': (16, 31), 'increment': (11, 26), 'gravity': 1, 'minimum-size': (371, 80)}) previous value={'base-size': (16, 31), 'increment': (11, 26), 'gravity': 1, 'minimum-size': (317, 75)}

The minimum size has changed from (317, 75) to (371, 80).
Why gnome-terminal does this isn't clear, perhaps due to some XSettings or DPI value change.
In any case, we end up calling _do_update_client_geometry and this should never crash.
Commenting out self.corral_window.move_resize(x, y, w, h) "fixes" things, except the window is no longer visible since it remains mapped where it was before, which is now outside the new client's desktop area.

@totaam
Copy link
Collaborator Author

totaam commented May 7, 2022

I couldn't figure it out because the ownership-election logic was just far too complicated for my brain.
So in the end, I removed it in an attempt to understand what was really going on... and that fixed things?!

The new problems are:

  • what to backport? (as this is too big a change to backport)
  • should the DesktopManager also be removed? (probably)

totaam added a commit that referenced this issue May 8, 2022
we keep track of the 'shown' attribute, 'resize-counter' and 'client-geometry' as window properties
totaam added a commit that referenced this issue May 9, 2022
for some reason, this is what causes the GDK crash
totaam added a commit that referenced this issue May 9, 2022
don't update the client geometry of a window which is not shown
@totaam totaam closed this as completed May 9, 2022
totaam added a commit that referenced this issue May 9, 2022
for some reason, this is what causes the GDK crash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working server
Projects
None yet
Development

No branches or pull requests

1 participant