xpra icon
Bug tracker and wiki

Opened 4 months ago

Closed 4 months ago

Last modified 4 months ago

#2328 closed defect (fixed)

ubuntu 16.04 python3 shadow server segfault on exit

Reported by: Antoine Martin Owned by: Antoine Martin
Priority: minor Milestone: 3.0
Component: server Version: 2.5.x
Keywords: Cc:

Description

Discovered whilst testing for #2296.

Only seems to affect Ubuntu 16.04: also tested on Fedora and Ubuntu 18.04.

The server segfault can be triggered from both xpra stop and the exit-with-client switch.

Change History (3)

comment:1 Changed 4 months ago by Antoine Martin

Status: newassigned

One does not need to ever have connected a client to trigger the segfault, which should rule out x11 shared memory race conditions during cleanup.

Still occurs when running with minimal features enabled:

--no-clipboard --no-windows --no-speaker --no-microphone \
--video-encoders=none --encodings=rgb \
--xsettings=no --no-system-tray --no-notifications --no-mdns

(though I did find a bug along the way: r22927)

Backtrace from gdb:

#0  0x00007ffff0b82134 in gdk_error_trap_push ()
    at /build/gtk+3.0-2Ut_nl/gtk+3.0-3.18.9/./gdk/gdkdisplay.c:2185
#1  0x00007fffec53de40 in ffi_call_unix64 () from /usr/lib/x86_64-linux-gnu/libffi.so.6
#2  0x00007fffec53d8ab in ffi_call () from /usr/lib/x86_64-linux-gnu/libffi.so.6
#3  0x00007fffe9b2d8fc in ?? () from /usr/lib/python3/dist-packages/gi/_gi.cpython-35m-x86_64-linux-gnu.so
#4  0x00007fffe9b2f3e8 in ?? () from /usr/lib/python3/dist-packages/gi/_gi.cpython-35m-x86_64-linux-gnu.so
#5  0x00000000005c20e7 in PyObject_Call () at ../Objects/abstract.c:2165
#6  0x000000000053b656 in do_call (nk=<optimized out>, na=<optimized out>, pp_stack=0x7fffffffb550, 
    func=<optimized out>) at ../Python/ceval.c:4936
#7  call_function (oparg=<optimized out>, pp_stack=0x7fffffffb550) at ../Python/ceval.c:4732
#8  PyEval_EvalFrameEx () at ../Python/ceval.c:3236
#9  0x000000000053b294 in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, 
    pp_stack=0x7fffffffb680, func=<optimized out>) at ../Python/ceval.c:4803
#10 call_function (oparg=<optimized out>, pp_stack=0x7fffffffb680) at ../Python/ceval.c:4730
#11 PyEval_EvalFrameEx () at ../Python/ceval.c:3236
#12 0x0000000000540b0b in _PyEval_EvalCodeWithName (qualname=0x0, name=0x0, closure=0x0, kwdefs=0x0, 
    defcount=0, defs=0x0, kwcount=0, kws=<optimized out>, argcount=<optimized out>, args=<optimized out>, 
    locals=<optimized out>, globals=<optimized out>, _co=<code at remote 0x7fffe978a1e0>)
    at ../Python/ceval.c:4018
#13 PyEval_EvalCodeEx () at ../Python/ceval.c:4039
#14 0x00000000004ec2e3 in function_call.lto_priv () at ../Objects/funcobject.c:627
#15 0x00000000005c20e7 in PyObject_Call () at ../Objects/abstract.c:2165
#16 0x00000000004fbfce in method_call.lto_priv () at ../Objects/classobject.c:330
#17 0x00000000005c20e7 in PyObject_Call () at ../Objects/abstract.c:2165
#18 0x00000000005c22d8 in PyObject_CallFunctionObjArgs () at ../Objects/abstract.c:2445
---Type <return> to continue, or q <return> to quit---
#19 0x00000000005387c5 in PyEval_EvalFrameEx () at ../Python/ceval.c:3107
#20 0x000000000053b294 in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, 
    pp_stack=0x7fffffffbbe0, func=<optimized out>) at ../Python/ceval.c:4803
#21 call_function (oparg=<optimized out>, pp_stack=0x7fffffffbbe0) at ../Python/ceval.c:4730
#22 PyEval_EvalFrameEx () at ../Python/ceval.c:3236
#23 0x000000000053b294 in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, 
    pp_stack=0x7fffffffbd10, func=<optimized out>) at ../Python/ceval.c:4803
#24 call_function (oparg=<optimized out>, pp_stack=0x7fffffffbd10) at ../Python/ceval.c:4730
#25 PyEval_EvalFrameEx () at ../Python/ceval.c:3236
#26 0x000000000053b294 in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, 
    pp_stack=0x7fffffffbe40, func=<optimized out>) at ../Python/ceval.c:4803
#27 call_function (oparg=<optimized out>, pp_stack=0x7fffffffbe40) at ../Python/ceval.c:4730
#28 PyEval_EvalFrameEx () at ../Python/ceval.c:3236
#29 0x000000000053b294 in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, 
    pp_stack=0x7fffffffbf70, func=<optimized out>) at ../Python/ceval.c:4803
#30 call_function (oparg=<optimized out>, pp_stack=0x7fffffffbf70) at ../Python/ceval.c:4730
#31 PyEval_EvalFrameEx () at ../Python/ceval.c:3236
#32 0x00000000005401ef in _PyEval_EvalCodeWithName () at ../Python/ceval.c:4018
#33 0x000000000053b83f in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, 
    pp_stack=0x7fffffffc180, func=<optimized out>) at ../Python/ceval.c:4813
#34 call_function (oparg=<optimized out>, pp_stack=0x7fffffffc180) at ../Python/ceval.c:4730
#35 PyEval_EvalFrameEx () at ../Python/ceval.c:3236
#36 0x000000000053b294 in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, 
    pp_stack=0x7fffffffc2b0, func=<optimized out>) at ../Python/ceval.c:4803
#37 call_function (oparg=<optimized out>, pp_stack=0x7fffffffc2b0) at ../Python/ceval.c:4730
---Type <return> to continue, or q <return> to quit---
#38 PyEval_EvalFrameEx () at ../Python/ceval.c:3236
#39 0x000000000053b294 in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, 
    pp_stack=0x7fffffffc3e0, func=<optimized out>) at ../Python/ceval.c:4803
#40 call_function (oparg=<optimized out>, pp_stack=0x7fffffffc3e0) at ../Python/ceval.c:4730
#41 PyEval_EvalFrameEx () at ../Python/ceval.c:3236
#42 0x0000000000540b0b in _PyEval_EvalCodeWithName (qualname=0x0, name=0x0, closure=0x0, kwdefs=0x0, 
    defcount=0, defs=0x0, kwcount=0, kws=<optimized out>, argcount=<optimized out>, args=<optimized out>, 
    locals=<optimized out>, globals=<optimized out>, _co=<code at remote 0x7fffe967cd20>)
    at ../Python/ceval.c:4018
#43 PyEval_EvalCodeEx () at ../Python/ceval.c:4039
#44 0x00000000004ec2e3 in function_call.lto_priv () at ../Objects/funcobject.c:627
#45 0x00000000005c20e7 in PyObject_Call () at ../Objects/abstract.c:2165
#46 0x00000000004fbfce in method_call.lto_priv () at ../Objects/classobject.c:330
#47 0x00000000005c20e7 in PyObject_Call () at ../Objects/abstract.c:2165
#48 0x0000000000534870 in PyEval_CallObjectWithKeywords () at ../Python/ceval.c:4580
#49 0x00007fffe9b2b4cc in ?? () from /usr/lib/python3/dist-packages/gi/_gi.cpython-35m-x86_64-linux-gnu.so
#50 0x00007fffec53dc2f in ffi_closure_unix64_inner () from /usr/lib/x86_64-linux-gnu/libffi.so.6
#51 0x00007fffec53dfa8 in ffi_closure_unix64 () from /usr/lib/x86_64-linux-gnu/libffi.so.6
#52 0x00007fffefa2d04a in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#53 0x00007fffefa2d3f0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#54 0x00007fffefa2d712 in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#55 0x00007fffe8f5b395 in gtk_main () at /build/gtk+3.0-2Ut_nl/gtk+3.0-3.18.9/./gtk/gtkmain.c:1241
#56 0x00007fffec53de40 in ffi_call_unix64 () from /usr/lib/x86_64-linux-gnu/libffi.so.6
#57 0x00007fffec53d8ab in ffi_call () from /usr/lib/x86_64-linux-gnu/libffi.so.6
#58 0x00007fffe9b2d8fc in ?? () from /usr/lib/python3/dist-packages/gi/_gi.cpython-35m-x86_64-linux-gnu.so
---Type <return> to continue, or q <return> to quit---
#59 0x00007fffe9b2f3e8 in ?? () from /usr/lib/python3/dist-packages/gi/_gi.cpython-35m-x86_64-linux-gnu.so
#60 0x00000000005c20e7 in PyObject_Call () at ../Objects/abstract.c:2165
#61 0x000000000053b656 in do_call (nk=<optimized out>, na=<optimized out>, pp_stack=0x7fffffffcd60, 
    func=<optimized out>) at ../Python/ceval.c:4936
#62 call_function (oparg=<optimized out>, pp_stack=0x7fffffffcd60) at ../Python/ceval.c:4732
#63 PyEval_EvalFrameEx () at ../Python/ceval.c:3236
#64 0x000000000053b294 in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, 
    pp_stack=0x7fffffffce90, func=<optimized out>) at ../Python/ceval.c:4803
#65 call_function (oparg=<optimized out>, pp_stack=0x7fffffffce90) at ../Python/ceval.c:4730
#66 PyEval_EvalFrameEx () at ../Python/ceval.c:3236
#67 0x00000000005401ef in _PyEval_EvalCodeWithName () at ../Python/ceval.c:4018
#68 0x000000000053bc93 in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, 
    pp_stack=0x7fffffffd0a0, func=<optimized out>) at ../Python/ceval.c:4813
#69 call_function (oparg=<optimized out>, pp_stack=0x7fffffffd0a0) at ../Python/ceval.c:4730
#70 PyEval_EvalFrameEx () at ../Python/ceval.c:3236
#71 0x00000000005401ef in _PyEval_EvalCodeWithName () at ../Python/ceval.c:4018
#72 0x000000000053b83f in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, 
    pp_stack=0x7fffffffd2b0, func=<optimized out>) at ../Python/ceval.c:4813
#73 call_function (oparg=<optimized out>, pp_stack=0x7fffffffd2b0) at ../Python/ceval.c:4730
#74 PyEval_EvalFrameEx () at ../Python/ceval.c:3236
#75 0x000000000053fc97 in _PyEval_EvalCodeWithName () at ../Python/ceval.c:4018
#76 0x000000000053b83f in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, 
    pp_stack=0x7fffffffd4c0, func=<optimized out>) at ../Python/ceval.c:4813
#77 call_function (oparg=<optimized out>, pp_stack=0x7fffffffd4c0) at ../Python/ceval.c:4730
#78 PyEval_EvalFrameEx () at ../Python/ceval.c:3236
---Type <return> to continue, or q <return> to quit---
#79 0x00000000005401ef in _PyEval_EvalCodeWithName () at ../Python/ceval.c:4018
#80 0x000000000053bc93 in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, 
    pp_stack=0x7fffffffd6d0, func=<optimized out>) at ../Python/ceval.c:4813
#81 call_function (oparg=<optimized out>, pp_stack=0x7fffffffd6d0) at ../Python/ceval.c:4730
#82 PyEval_EvalFrameEx () at ../Python/ceval.c:3236
#83 0x000000000053b294 in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, 
    pp_stack=0x7fffffffd800, func=<optimized out>) at ../Python/ceval.c:4803
#84 call_function (oparg=<optimized out>, pp_stack=0x7fffffffd800) at ../Python/ceval.c:4730
#85 PyEval_EvalFrameEx () at ../Python/ceval.c:3236
#86 0x000000000053fc97 in _PyEval_EvalCodeWithName () at ../Python/ceval.c:4018
#87 0x00000000005409bf in PyEval_EvalCodeEx () at ../Python/ceval.c:4039
#88 PyEval_EvalCode (co=<optimized out>, globals=<optimized out>, locals=<optimized out>)
    at ../Python/ceval.c:777
#89 0x000000000060cb42 in run_mod () at ../Python/pythonrun.c:976
#90 0x000000000060efea in PyRun_FileExFlags () at ../Python/pythonrun.c:929
#91 0x000000000060f7dc in PyRun_SimpleFileExFlags () at ../Python/pythonrun.c:396
#92 0x0000000000640256 in run_file (p_cf=0x7fffffffda70, filename=0xa752e0 L"/usr/bin/xpra", fp=0xad5e80)
    at ../Modules/main.c:318
#93 Py_Main () at ../Modules/main.c:768
#94 0x00000000004d0001 in main () at ../Programs/python.c:65
#95 0x00007ffff7810830 in __libc_start_main (main=0x4cff20 <main>, argc=19, argv=0x7fffffffdc88, 
    init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdc78)
    at ../csu/libc-start.c:291
#96 0x00000000005d6999 in _start ()
(gdb) py-bt
Traceback (most recent call first):
  File "/usr/lib/python3/dist-packages/xpra/gtk_common/error.py", line 109, in Xenter
    gdk.error_trap_push()
  File "/usr/lib/python3/dist-packages/xpra/gtk_common/error.py", line 207, in __enter__
    trap.Xenter()
  File "/usr/lib/python3/dist-packages/xpra/x11/x11_server_core.py", line 310, in do_cleanup
    with xswallow:
  File "/usr/lib/python3/dist-packages/xpra/server/server_core.py", line 433, in cleanup
    self.do_cleanup()
  File "/usr/lib/python3/dist-packages/xpra/server/shadow/gtk_shadow_server_base.py", line 54, in cleanup
    GTKServerBase.cleanup(self)     #@UndefinedVariable
  File "/usr/lib/python3/dist-packages/xpra/x11/shadow_x11_server.py", line 143, in cleanup
    GTKShadowServerBase.cleanup(self)
  File "/usr/lib/python3/dist-packages/xpra/server/server_core.py", line 354, in clean_quit
    self.cleanup()
  File "/usr/lib/python3/dist-packages/xpra/server/server_base.py", line 842, in last_client_exited
    self.clean_quit(False)
  File "/usr/lib/python3/dist-packages/xpra/server/shadow/gtk_shadow_server_base.py", line 69, in last_client_exited
    GTKServerBase.last_client_exited(self)
  File "/usr/lib/python3/dist-packages/xpra/x11/shadow_x11_server.py", line 152, in last_client_exited
    GTKShadowServerBase.last_client_exited(self)
  File "/usr/lib/python3/dist-packages/xpra/server/gtk_server_base.py", line 94, in do_run
    gtk_main()
  File "/usr/lib/python3/dist-packages/xpra/server/server_core.py", line 409, in run
---Type <return> to continue, or q <return> to quit---
    self.do_run()
  File "/usr/lib/python3/dist-packages/xpra/scripts/server.py", line 958, in do_run_server
    r = app.run()
  File "/usr/lib/python3/dist-packages/xpra/scripts/server.py", line 444, in run_server
    return do_run_server(error_cb, opts, mode, xpra_file, extra_args, desktop_display)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 432, in run_mode
    return run_server(error_cb, options, mode, script_file, args, current_display)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 97, in main
    return run_mode(script_file, err, options, args, mode, defaults)
  File "/usr/bin/xpra", line 26, in <module>
    sys.exit(main(sys.argv[0], sys.argv))
Last edited 4 months ago by Antoine Martin (previous) (diff)

comment:2 Changed 4 months ago by Antoine Martin

Resolution: fixed
Status: assignedclosed

The crash is triggered by close_gtk_display.
Skipping this cleanup step with XPRA_CLOSE_GTK_DISPLAY=0 fixes the problem.

r22928 re-orders the cleanup code (related, but not a fix for this crash).

r22929 + r22930 just skips closing the display for python3 shadow servers on Ubuntu 16.04 only!
(note: this cleanup code runs more than once, but that's not the cause of the crash)

comment:3 Changed 4 months ago by Antoine Martin

close_gtk_display had been moved in r22678 for #1123.

Note: See TracTickets for help on using tickets.