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

Linux: Crash in wxPython example with GTK3 due to a segmentation fault in XRenderCreatePicture #534

Closed
dee42 opened this issue Aug 19, 2019 · 7 comments
Labels

Comments

@dee42
Copy link

dee42 commented Aug 19, 2019

In the wxPython example compiled with GTK3, after applying the CEF patch from #452, there is a secondary crash as soon as the main loop starts up.

The logging and traceback is as follows:

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[Detaching after vfork from child process 8815]
[wxpython.py] CEF Python 66.0
[Detaching after fork from child process 8821]
[wxpython.py] Python 2.7.16 64bit
[wxpython.py] wxPython 4.0.6 gtk3 (phoenix) wxWidgets 3.0.5
[New Thread 0x7fffe8475700 (LWP 8822)]
[Detaching after fork from child process 8823]
[New Thread 0x7fffe7c74700 (LWP 8824)]
[New Thread 0x7fffe7473700 (LWP 8825)]
[New Thread 0x7fffe6c72700 (LWP 8826)]
[New Thread 0x7fffe6471700 (LWP 8827)]
[New Thread 0x7fffe5c70700 (LWP 8828)]
[New Thread 0x7fffe546f700 (LWP 8829)]
[New Thread 0x7fffe4c6e700 (LWP 8830)]
[New Thread 0x7fffc7fff700 (LWP 8831)]
[New Thread 0x7fffc77fe700 (LWP 8832)]
[New Thread 0x7fffc6ffd700 (LWP 8833)]
[New Thread 0x7fffc67fc700 (LWP 8834)]
[New Thread 0x7fffc5ffb700 (LWP 8835)]
[New Thread 0x7fffc57fa700 (LWP 8836)]
[New Thread 0x7fffc4ff9700 (LWP 8837)]
[Detaching after fork from child process 8838]
[New Thread 0x7fff9fd56700 (LWP 8839)]
[0819/112542.762332:ERROR:sandbox_linux.cc(379)] InitializeSandbox() called with multiple threads in process gpu-process.
[New Thread 0x7fff9f555700 (LWP 8849)]
[New Thread 0x7fff9ed54700 (LWP 8850)]
[New Thread 0x7fff9e553700 (LWP 8851)]
[New Thread 0x7fff9dd52700 (LWP 8852)]

DevTools listening on ws://127.0.0.1:54417/devtools/browser/4bc7fd08-f299-46ae-8cc7-036b160ef36f
[New Thread 0x7fff9d286700 (LWP 8853)]
[New Thread 0x7fff9ca3f700 (LWP 8854)]
[wxpython.py] wx.GetDisplayPPI = (96, 96)
[wxpython.py] wx.GetDisplaySize = (3840, 1080)
[wxpython.py] MainFrame declared size: (900, 640)
[wxpython.py] MainFrame DPI scaled size: (900, 640)
[wxpython.py] MainFrame actual size: (900, 640)
[New Thread 0x7fff73d19700 (LWP 8855)]
[New Thread 0x7fff73518700 (LWP 8856)]
[0819/112543.136222:ERROR:gl_surface_glx.cc(581)] XGetWindowAttributes failed for window 67108866.
[0819/112543.136270:ERROR:gles2_command_buffer_stub.cc(226)] ContextResult::kFatalFailure: Failed to create surface.
[0819/112543.139327:ERROR:gpu_process_transport_factory.cc(1017)] Lost UI shared context.
[0819/112543.139957:ERROR:software_output_device_x11.cc(25)] XGetWindowAttributes failed for window 67108866

Thread 1 "python2.7" received signal SIGSEGV, Segmentation fault.
0x00007ffff35242e1 in XRenderCreatePicture () from /usr/lib/libXrender.so.1
(gdb) bt
#0  0x00007ffff35242e1 in XRenderCreatePicture () at /usr/lib/libXrender.so.1
#1  0x00007fffef81b298 in EndPaint() () at ../../components/viz/service/display_embedder/software_output_device_x11.cc:86
#2  0x00007fffef7e2840 in FinishDrawingFrame() () at ../../components/viz/service/display/software_renderer.cc:66
#3  0x00007fffef7b8831 in DrawFrame() () at ../../components/viz/service/display/direct_renderer.cc:332
#4  0x00007fffef7bc402 in DrawAndSwap() () at ../../components/viz/service/display/display.cc:356
#5  0x00007fffef7be49e in DrawAndSwap () at ../../components/viz/service/display/display_scheduler.cc:213
#6  0x00007fffef7be49e in AttemptDrawAndSwap() () at ../../components/viz/service/display/display_scheduler.cc:487
#7  0x00007fffef7bdcda in OnBeginFrameDeadline() () at ../../components/viz/service/display/display_scheduler.cc:503
#8  0x00007fffee7b6a0d in Run () at ../../base/callback.h:95
#9  0x00007fffee7b6a0d in RunTask() () at ../../base/debug/task_annotator.cc:61
#10 0x00007fffee7d2c6b in RunTask() () at ../../base/message_loop/message_loop.cc:395
#11 0x00007fffee7d32b5 in DeferOrRunPendingTask () at ../../base/message_loop/message_loop.cc:407
#12 0x00007fffee7d32b5 in DoWork() () at ../../base/message_loop/message_loop.cc:451
#13 0x00007fffee7d444d in base::MessagePumpGlib::Run(base::MessagePump::Delegate*) () at ../../base/message_loop/message_pump_glib.cc:309
#14 0x00007fffee7f2788 in Run () at ../../base/run_loop.cc:133
#15 0x00007fffee7f2788 in RunUntilIdle() () at ../../base/run_loop.cc:146
#16 0x00007fffee6596bf in CefBrowserMessageLoop::DoMessageLoopIteration() () at ../../cef/libcef/browser/browser_message_loop.cc:116
#17 0x00007fffea5d66a8 in __pyx_pw_14cefpython_py27_35MessageLoopWork(_object*, _object*) [clone .lto_priv.278] ()
    at /home/deem/j5-environments/28.0/python/lib/python2.7/site-packages/cefpython3/cefpython_py27.so
#18 0x00007ffff7ebba8d in call_function (oparg=<optimized out>, pp_stack=0x7fffffffbef0) at Python/ceval.c:4360
#19 0x00007ffff7ebba8d in PyEval_EvalFrameEx (f=f@entry=0x7fffe9c22208, throwflag=throwflag@entry=0) at Python/ceval.c:3013
#20 0x00007ffff7ebe278 in PyEval_EvalCodeEx
    (co=<optimized out>, globals=<optimized out>, locals=locals@entry=0x0, args=args@entry=0x7ffff6ed1800, argcount=<optimized out>, kws=kws@entry=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3608
#21 0x00007ffff7e3a07b in function_call (func=0x7ffff2a828c0, arg=0x7ffff6ed17e8, kw=0x0) at Objects/funcobject.c:523
#22 0x00007ffff7e0d4a3 in PyObject_Call (func=func@entry=0x7ffff2a828c0, arg=arg@entry=0x7ffff6ed17e8, kw=kw@entry=0x0) at Objects/abstract.c:2544
#23 0x00007ffff7e1c4cc in instancemethod_call (func=0x7ffff2a828c0, arg=0x7ffff6ed17e8, kw=0x0) at Objects/classobject.c:2600

#24 0x00007ffff7e0d4a3 in PyObject_Call (func=func@entry=0x7ffff2b23910, arg=arg@entry=0x7ffff2a84290, kw=0x0) at Objects/abstract.c:2544
#25 0x00007ffff7eb3d68 in PyEval_CallObjectWithKeywords (func=func@entry=0x7ffff2b23910, arg=arg@entry=0x7ffff2a84290, kw=kw@entry=0x0) at Python/ceval.c:4245
#26 0x00007ffff62ab357 in wxPyCallback::EventThunker(wxEvent&) (this=<optimized out>, event=...) at ../../../../sip/cpp/sip_corewxEvtHandler.cpp:71
#27 0x00007ffff569906e in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) ()
    at /home/deem/j5-environments/28.0/python/lib/python2.7/site-packages/wx/libwx_baseu-3.0.so.0
#28 0x00007ffff56993ea in wxEvtHandler::SearchDynamicEventTable(wxEvent&) () at /home/deem/j5-environments/28.0/python/lib/python2.7/site-packages/wx/libwx_baseu-3.0.so.0
#29 0x00007ffff5699480 in wxEvtHandler::TryHereOnly(wxEvent&) () at /home/deem/j5-environments/28.0/python/lib/python2.7/site-packages/wx/libwx_baseu-3.0.so.0
#30 0x00007ffff5699533 in wxEvtHandler::ProcessEventLocally(wxEvent&) () at /home/deem/j5-environments/28.0/python/lib/python2.7/site-packages/wx/libwx_baseu-3.0.so.0
#31 0x00007ffff56995d1 in wxEvtHandler::ProcessEvent(wxEvent&) () at /home/deem/j5-environments/28.0/python/lib/python2.7/site-packages/wx/libwx_baseu-3.0.so.0
#32 0x00007ffff64cf693 in sipwxPyApp::ProcessEvent(wxEvent&) (this=0x555555bd9080, event=...) at ../../../../sip/cpp/sip_corewxPyApp.cpp:660
#33 0x00007ffff5699367 in wxEvtHandler::SafelyProcessEvent(wxEvent&) () at /home/deem/j5-environments/28.0/python/lib/python2.7/site-packages/wx/libwx_baseu-3.0.so.0
#34 0x00007ffff55f3cd0 in wxTimerImpl::SendEvent() () at /home/deem/j5-environments/28.0/python/lib/python2.7/site-packages/wx/libwx_baseu-3.0.so.0
#35 0x00007ffff65f0290 in sipwxTimer::Notify() (this=0x555556072ee0) at ../../../../sip/cpp/sip_corewxTimer.cpp:115
#36 0x00007ffff5a4a2b2 in timeout_callback () at /home/deem/j5-environments/28.0/python/lib/python2.7/site-packages/wx/libwx_gtk3u_core-3.0.so.0
#37 0x00007ffff44ce3c4 in  () at /usr/lib/libglib-2.0.so.0
#38 0x00007ffff44cebb0 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#39 0x00007ffff44d0b11 in  () at /usr/lib/libglib-2.0.so.0
#40 0x00007ffff44d1a63 in g_main_loop_run () at /usr/lib/libglib-2.0.so.0
#41 0x00007ffff4dd6eef in gtk_main () at /usr/lib/libgtk-3.so.0
#42 0x00007ffff5a38455 in wxGUIEventLoop::DoRun() () at /home/deem/j5-environments/28.0/python/lib/python2.7/site-packages/wx/libwx_gtk3u_core-3.0.so.0
#43 0x00007ffff554608d in wxEventLoopBase::Run() () at /home/deem/j5-environments/28.0/python/lib/python2.7/site-packages/wx/libwx_baseu-3.0.so.0
#44 0x00007ffff55096b6 in wxAppConsoleBase::MainLoop() () at /home/deem/j5-environments/28.0/python/lib/python2.7/site-packages/wx/libwx_baseu-3.0.so.0
#45 0x00007ffff64d4741 in wxPyApp::MainLoop() (this=0x555555bd9080) at ../../../../sip/cpp/sip_corewxPyApp.cpp:316
--Type <RET> for more, q to quit, c to continue without paging--
#46 0x00007ffff64d4957 in meth_wxPyApp_MainLoop(PyObject*, PyObject*) (sipSelf=<optimized out>, sipArgs=<optimized out>) at ../../../../sip/cpp/sip_corewxPyApp.cpp:1837
#47 0x00007ffff7ebc42f in call_function (oparg=<optimized out>, pp_stack=0x7fffffffc8b0) at Python/ceval.c:4376
#48 0x00007ffff7ebc42f in PyEval_EvalFrameEx (f=f@entry=0x7fffe9c23210, throwflag=throwflag@entry=0) at Python/ceval.c:3013
#49 0x00007ffff7ebda3d in fast_function (nk=<optimized out>, na=<optimized out>, n=1, pp_stack=0x7fffffffc9c0, func=0x7ffff2b28668) at Python/ceval.c:4461
#50 0x00007ffff7ebda3d in call_function (oparg=<optimized out>, pp_stack=0x7fffffffc9c0) at Python/ceval.c:4396
#51 0x00007ffff7ebda3d in PyEval_EvalFrameEx (f=f@entry=0x7ffff6d2ecc8, throwflag=throwflag@entry=0) at Python/ceval.c:3013
#52 0x00007ffff7ebda3d in fast_function (nk=<optimized out>, na=<optimized out>, n=0, pp_stack=0x7fffffffcad0, func=0x7ffff2a82050) at Python/ceval.c:4461
#53 0x00007ffff7ebda3d in call_function (oparg=<optimized out>, pp_stack=0x7fffffffcad0) at Python/ceval.c:4396
#54 0x00007ffff7ebda3d in PyEval_EvalFrameEx (f=f@entry=0x7ffff6d2e938, throwflag=throwflag@entry=0) at Python/ceval.c:3013
#55 0x00007ffff7ebe278 in PyEval_EvalCodeEx
    (co=co@entry=0x7ffff7591a30, globals=globals@entry=0x7ffff7a11168, locals=locals@entry=0x7ffff7a11168, args=args@entry=0x0, argcount=argcount@entry=0, kws=kws@entry=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3608
#56 0x00007ffff7ebe429 in PyEval_EvalCode (co=co@entry=0x7ffff7591a30, globals=globals@entry=0x7ffff7a11168, locals=locals@entry=0x7ffff7a11168) at Python/ceval.c:669
#57 0x00007ffff7ee3dd9 in run_mod
    (arena=0x555555b8c840, flags=0x7fffffffcd1c, locals=0x7ffff7a11168, globals=0x7ffff7a11168, filename=0x7ffff7591a30 "\002", mod=0x555555bdd2d0)
    at Python/pythonrun.c:1385
#58 0x00007ffff7ee3dd9 in PyRun_FileExFlags
    (fp=fp@entry=0x55555558d5a0, filename=filename@entry=0x7fffffffd361 "wxpython.py", start=start@entry=257, globals=globals@entry=0x7ffff7a11168, locals=locals@entry=0x7ffff7a11168, closeit=closeit@entry=1, flags=0x7fffffffcd1c) at Python/pythonrun.c:1371
#59 0x00007ffff7ee526c in PyRun_SimpleFileExFlags
    (fp=fp@entry=0x55555558d5a0, filename=0x7fffffffd361 "wxpython.py", closeit=closeit@entry=1, flags=flags@entry=0x7fffffffcd1c) at Python/pythonrun.c:957
#60 0x00007ffff7ee593c in PyRun_AnyFileExFlags (fp=fp@entry=0x55555558d5a0, filename=<optimized out>, closeit=closeit@entry=1, flags=flags@entry=0x7fffffffcd1c)
    at Python/pythonrun.c:761
#61 0x00007ffff7ef9237 in Py_Main (argc=<optimized out>, argv=<optimized out>) at Modules/main.c:641
#62 0x00007ffff7a65ee3 in __libc_start_main () at /usr/lib/libc.so.6
#63 0x000055555555507e in _start ()
@cztomczak
Copy link
Owner

To support GTK 3 you need to build CEF with GTK 3 enabled, this can be done with the automate.py script by providing --use-gtk3 flag. Also you need to patch cefpython sources with the patch that is attached in one of the comments in Issue #446.

After following the instructions above and if the issue still persists answer these two questions:

  1. Do you use any custom window settings in OS that e.g. forces transparency on windows?
  2. Does disabling GPU by passing --disable-gpu and disable-gpu-compositing switches make any difference?

@dee42
Copy link
Author

dee42 commented Aug 19, 2019

Hi, thanks for this information. I recompiled with --with-gtk3 (I didn't clean, but since it rebuilt everything where the Makefile was touched this seemed unnecessary). I applied the patch from #446. I disabled compositing on my Window Manager. I passed in the disable-gpu and disable-gpu-compositing switches to cef Initialize in the wxpython example. Exact same segmentation fault and traceback.

@cztomczak
Copy link
Owner

What GTK 3 version is installed in your OS? Can you try installing version <= 3.14? Versions >= 3.15 are known to have issues with CEF (see this comment cztomczak/cefcapi#9 (comment)).

@dee42
Copy link
Author

dee42 commented Aug 20, 2019

Unfortunately I need to work off a base of Ubuntu 18.04, which comes with GTK 3.22. Do you have a patch that gets it to work without transparency? Reading your comment, I can see that was the blocker, but I do not need transparency.

@cztomczak
Copy link
Owner

The referenced issue reports that CEF has issues with GTK 3.22 default visual in general. You can try changing the visual, there is C code available there. I can't say if that will help you resolve the issue here, but it's worth a try.

@dee42
Copy link
Author

dee42 commented Aug 20, 2019

Thanks. I have fixed the issue for me by installing wxPython wheels linked to GTK2. The standard pip install ends up linked to GTK3. The wheels are available here: https://extras.wxpython.org/wxPython4/extras/linux/gtk2/ubuntu-18.04. I'm going to stop looking into this now, as that's a good enough solution for me, and it looks like next version of cefpython, when it is released, will have full GTK3 support.

@cztomczak
Copy link
Owner

Duplicate of #447.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants