You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[tkinter_.py] [Mac] Crashes with message "Segmentation fault: 11" #309
There are some issues with Tk <> CEF initializations, they are conflicting each other. Tk must be initialized before CEF otherwise there was an another error described in Issue #306.
I've tried debugging it using gdb/lldb instructions from KB however I couldn't get a meaningful stack trace. On Linux gdb can show Python stack trace with "py-bt", but I have no idea how to debug this on Mac.
changed the title [-]Mac: tkinter_.py example often crashes with Segmentation fault: 11[/-][+][Mac] tkinter_.py example: Crash with message "Segmentation fault: 11"[/+]on Mar 3, 2017
changed the title [-][Mac] tkinter_.py example: Crash with message "Segmentation fault: 11"[/-][+][Mac] tkinter_.py example: Crashes with message "Segmentation fault: 11"[/+]on Mar 3, 2017
I am walking through this under Wing IDE. It fails consistently on my system. The crash happens after the call to app.mainloop(). The window appears, then the crash, with no opportunity for user interaction. With log level set to DEBUG the following appear in the log prior to cef.Initialize():
Since the hello_world.py example does not crash, the only difference would seem to be the inclusion of "window_info" in the CreateBrowserSync call. Unfortunately window_info is an opaque object from cefWindowInfo() so I can't tell you what's in it.
However, if I delete the window_info argument from the call, the segfault does not occur.
Note that in both hello_world and tkinter_ examples, the resulting window is blank, there is no display of google.com. Is there supposed to be?
Edit: also the qt.py example works, except that it also displays no web page, here is a screen grab:
When you remove the window_info parameter then you stop embedding browser inside tkinter window, so it stops being a tkinter example and thus it doesn't crash, because CEF creates the root window itself, just like in the hello world example.
Thanks for trying to debug this. The only idea I have for this moment would be to play with various tkinter options - global options or window options. Maybe changing some property of the window or some other option would get rid of the error.
Or maybe the code that fetches window handle is not right - see Issue #308. You could try hardcoding the window handle value in the script - but first you would have to obtain such handle. On Linux you can do this using "xdotool" program, for Mac you would need to google that.
My motive in this is to replace QWebEngine in an app based on Python 3.5, PyQt and Qt5.9. The app already works on MacOS, Ubuntu and Windows 7, but the use of QWebEngine prevents bunding it with PyInstaller.
The local Python 3.5 is standard, located in /Library/Frameworks/Python.Framework, as normal when installed from the python.org download. The Mac system Python is at 2.7, located in /System/Library/Frameworks but is not involved in any way.
I haven't touched tkinter in years so hesitate to get into that aspect but will keep poking at this in hopes of learning something useful.
Your issue with a blank window is off-topic here (not a segmentation fault and not a tkinter issue). Please report it on the Forum and I can give you hints how to debug this.
I kept getting segmentation fault 11 every time i opened up a second instance of tk. wtf? well turns out you can only have one instance of tk even though i had destroyed and quit it in the previous module. i avoided this cryptic error by using toplevel instead of creating new root instances each time.. just in case someone had this issue
I was trying to symbolicate the stack trace provided by @tallforasmurf using your .dSYM file.
However, neither in this, nor in a stack trace of my own did I get any output using this command:
Activity
Fix errors in tkinter_.py example on Mac (#306, #308).
[-]Mac: tkinter_.py example often crashes with Segmentation fault: 11[/-][+][Mac] tkinter_.py example: Crash with message "Segmentation fault: 11"[/+][-][Mac] tkinter_.py example: Crash with message "Segmentation fault: 11"[/-][+][Mac] tkinter_.py example: Crashes with message "Segmentation fault: 11"[/+]tallforasmurf commentedon Jul 25, 2017
I am walking through this under Wing IDE. It fails consistently on my system. The crash happens after the call to
app.mainloop(). The window appears, then the crash, with no opportunity for user interaction. With log level set to DEBUG the following appear in the log prior to cef.Initialize():Upon
cef.Initialize()this appears,(which I think is a red herring). Upon the
app.mainloop()call these appear:then the window appears and the segfault happens.
By setting a lot of breakpoints I have verified that everything works fine up until entry to
embed_browser()on line 158. The crash happens duringI can't debug-step into this (actually I can, but the debugger next surfaces in re.py).
tallforasmurf commentedon Jul 25, 2017
Since the hello_world.py example does not crash, the only difference would seem to be the inclusion of "window_info" in the CreateBrowserSync call. Unfortunately window_info is an opaque object from cefWindowInfo() so I can't tell you what's in it.
However, if I delete the window_info argument from the call, the segfault does not occur.
Note that in both hello_world and tkinter_ examples, the resulting window is blank, there is no display of google.com. Is there supposed to be?
Edit: also the qt.py example works, except that it also displays no web page, here is a screen grab:

cztomczak commentedon Jul 26, 2017
When you remove the window_info parameter then you stop embedding browser inside tkinter window, so it stops being a tkinter example and thus it doesn't crash, because CEF creates the root window itself, just like in the hello world example.
A blank window might appear when your Python does not support GUI applications, see this explanation on KB page: https://github.com/cztomczak/cefpython/blob/master/docs/Knowledge-Base.md#a-blank-window-on-maclinux
cztomczak commentedon Jul 26, 2017
Thanks for trying to debug this. The only idea I have for this moment would be to play with various tkinter options - global options or window options. Maybe changing some property of the window or some other option would get rid of the error.
cztomczak commentedon Jul 26, 2017
Or maybe the code that fetches window handle is not right - see Issue #308. You could try hardcoding the window handle value in the script - but first you would have to obtain such handle. On Linux you can do this using "xdotool" program, for Mac you would need to google that.
tallforasmurf commentedon Jul 26, 2017
My motive in this is to replace QWebEngine in an app based on Python 3.5, PyQt and Qt5.9. The app already works on MacOS, Ubuntu and Windows 7, but the use of QWebEngine prevents bunding it with PyInstaller.
The local Python 3.5 is standard, located in /Library/Frameworks/Python.Framework, as normal when installed from the python.org download. The Mac system Python is at 2.7, located in /System/Library/Frameworks but is not involved in any way.
I haven't touched tkinter in years so hesitate to get into that aspect but will keep poking at this in hopes of learning something useful.
cztomczak commentedon Jul 26, 2017
Your issue with a blank window is off-topic here (not a segmentation fault and not a tkinter issue). Please report it on the Forum and I can give you hints how to debug this.
11 remaining items
cztomczak commentedon Jun 3, 2019
@freegroup Can you post a meaningful stack trace? Is it the same as in this comment #309 (comment) ?
freegroup commentedon Jun 3, 2019
how to get the stacktrace?
cztomczak commentedon Jan 14, 2020
Did anyone test tkinter example on Mac with Tk 8.6? That newer version of Tk seems to be more stable with CEF, at least on Windows.
jaywalkerpaz commentedon Feb 13, 2020
I kept getting segmentation fault 11 every time i opened up a second instance of tk. wtf? well turns out you can only have one instance of tk even though i had destroyed and quit it in the previous module. i avoided this cryptic error by using toplevel instead of creating new root instances each time.. just in case someone had this issue
cztomczak commentedon Feb 13, 2020
tkinter example never worked for me on Mac at all. Did you get it working somehow? What version of Tk, python and Mac OS version?
jaywalkerpaz commentedon Feb 13, 2020
Actually no.. sorry man I hope u get it
[x.py] CEF Python 66.0
[x.py] Python 3.7.5
[x.py] Tk 8.5.9
DevTools listening on ws://127.0.0.1:64947/devtools/browser/
Segmentation fault: 11
solydvision commentedon Mar 24, 2020
2 years! No solution
cztomczak commentedon Mar 24, 2020
This still haven't been debugged properly. We need a meaningful stack trace to understand the problem.
@tallforasmurf You've provided stack trace, but the Chromium's part of stack trace does not contain meaningful symbols. You can download CEF symbols from here: http://opensource.spotify.com/cefbuilds/cef_binary_3.3359.1774.gd49d25f_macosx64_release_symbols.tar.bz2
vollstock commentedon Apr 1, 2020
Python 3.7.7
Tk 8.6.8
no improvement
vollstock commentedon Apr 1, 2020
I was trying to symbolicate the stack trace provided by @tallforasmurf using your .dSYM file.
However, neither in this, nor in a stack trace of my own did I get any output using this command:
Does anybody know whether I am doing this wrong?
Just typing
without an address outputs loads and loads of stuff. Using an address from that output works with the above command.
yusuf8ahmed commentedon Jul 16, 2020
Does anyone have a solution to this issue???
cztomczak commentedon Jul 20, 2020
Here is the code that crashes:
Ref: https://bitbucket.org/chromiumembedded/cef/src/d49d25f881b68f418e243e12801cbbb7caebb563/libcef/browser/native/browser_platform_delegate_native_mac.mm#lines-214
Apple docs for NSView autoresizingMask:
https://developer.apple.com/documentation/appkit/nsview/1483281-autoresizingmask
Below is a meaningful stack trace for the crash:
Fix Mac issues in Tkinter example (#309, #441)
cztomczak commentedon Jul 20, 2020
Fixed some of the issues in commit 0da1393 .
There are still startup issues that occur randomly for me and that will be tracked in the newly created issue: #583
Closing this.