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

Segfault at launch #648

Closed
Th3l5D opened this Issue Dec 16, 2017 · 6 comments

Comments

Projects
None yet
5 participants
@Th3l5D

Th3l5D commented Dec 16, 2017

Operating system: Linux Mint 18 64bits
wxPython version:4.0.0rc1.dev3512+dfda2a9 gtk3 (phoenix)
Stock or custom build:Stock (through pip)
Python version:3.5.2
Stock or custom build:Stock

Description of the problem:

wxpython crashes when wx is used. Compilation has been done automatically with pip3

import wx
test = wx.App()

Output :

python3 interface.py 
Erreur de segmentation

gdb output :

gdb python3
(gdb) run interface.py 
Starting program: /usr/bin/python3 interface.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe9602700 (LWP 21316)]
[New Thread 0x7fffe8e01700 (LWP 21317)]

Thread 1 "python3" received signal SIGSEGV, Segmentation fault.
strlen () at ../sysdeps/x86_64/strlen.S:106
106	../sysdeps/x86_64/strlen.S: Aucun fichier ou dossier de ce type.
(gdb)  bt
#0  strlen () at ../sysdeps/x86_64/strlen.S:106
#1  0x00007ffff78aa68a in __mbsrtowcs_l (dst=0x0, src=0x7fffffffcb78, len=<optimized out>, 
    ps=<optimized out>, l=<optimized out>) at mbsrtowcs_l.c:73
#2  0x00007ffff4ef782e in wxMB2WC(wchar_t*, char const*, unsigned long) ()
   from /usr/local/lib/python3.5/dist-packages/wx/libwx_baseu-3.0.so.0
#3  0x00007ffff4ea5feb in wxMBConv::ToWChar(wchar_t*, unsigned long, char const*, unsigned long) const
    () from /usr/local/lib/python3.5/dist-packages/wx/libwx_baseu-3.0.so.0
#4  0x00007ffff4ea73a0 in wxMBConv::cMB2WC(char const*, unsigned long, unsigned long*) const ()
   from /usr/local/lib/python3.5/dist-packages/wx/libwx_baseu-3.0.so.0
#5  0x00007ffff4eb6f2f in wxString::ConvertStr(char const*, unsigned long, wxMBConv const&) ()
   from /usr/local/lib/python3.5/dist-packages/wx/libwx_baseu-3.0.so.0
#6  0x00007ffff56f4a35 in wxGUIAppTraits::GetStandardCmdLineOptions(wxArrayString&, wxArrayString&) const () from /usr/local/lib/python3.5/dist-packages/wx/libwx_gtk3u_core-3.0.so.0
#7  0x00007ffff56be3c5 in wxApp::Initialize(int&, wchar_t**) ()
   from /usr/local/lib/python3.5/dist-packages/wx/libwx_gtk3u_core-3.0.so.0
#8  0x00007ffff4e79e46 in wxEntryStart(int&, wchar_t**) ()
   from /usr/local/lib/python3.5/dist-packages/wx/libwx_baseu-3.0.so.0
#9  0x00007ffff61816bf in wxPyApp::_BootstrapApp() ()
   from /usr/local/lib/python3.5/dist-packages/wx/_core.cpython-35m-x86_64-linux-gnu.so
#10 0x00007ffff618500c in meth_wxPyApp__BootstrapApp.lto_priv.16567 ()
   from /usr/local/lib/python3.5/dist-packages/wx/_core.cpython-35m-x86_64-linux-gnu.so
#11 0x00000000004e10ef in PyCFunction_Call ()
#12 0x00000000005240b4 in PyEval_EvalFrameEx ()
#13 0x000000000052dd1b in PyEval_EvalCodeEx ()
#14 0x00000000004e31c8 in ?? ()
#15 0x00000000005b5da7 in PyObject_Call ()
#16 0x00000000004f40de in ?? ()
#17 0x00000000005b5da7 in PyObject_Call ()
#18 0x000000000054e829 in ?? ()
#19 0x000000000055835c in ?? ()
#20 0x00000000005b5da7 in PyObject_Call ()
#21 0x0000000000528956 in PyEval_EvalFrameEx ()
#22 0x000000000052cf19 in ?? ()
#23 0x000000000052dbcf in PyEval_EvalCode ()
#24 0x0000000000601682 in ?? ()
#25 0x0000000000603b2a in PyRun_FileExFlags ()
#26 0x0000000000603d1c in PyRun_SimpleFileExFlags ()
#27 0x000000000063e756 in Py_Main ()
#28 0x00000000004cfbd1 in main ()

strace output (only the end)

open("/usr/share/X11/locale/en_US.UTF-8/XLC_LOCALE", O_RDONLY) = 10
fstat(10, {st_mode=S_IFREG|0644, st_size=4250, ...}) = 0
read(10, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"..., 4096) = 4096
read(10, " \n#\tcs20 class\ncs15\t{\n\tside\t\tGR\n"..., 4096) = 154
read(10, "", 4096)                      = 0
close(10)                               = 0
uname({sysname="Linux", nodename="l5boy-PC", ...}) = 0
open("/home/l5boy/.Xdefaults-l5boy-PC", O_RDONLY) = 10
fstat(10, {st_mode=S_IFREG|0755, st_size=30, ...}) = 0
read(10, "xterm*geometry: 90x30+50-100'\n", 30) = 30
close(10)                               = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x30336b7467} ---
+++ killed by SIGSEGV +++
Erreur de segmentation

Please note that the .Xdefaults-l5boy-PC file was not present at begining, but the result was the same. I created the file and wrote "xterm*geometry: 90x30+50-100" in it.

@RobinD42

This comment has been minimized.

Member

RobinD42 commented Dec 29, 2017

The crash is happening in code that is converting GTK options from a character string to a wide character string, but this is heavily tested in wxWidgets so I'm not sure where the problem may be. Perhaps it is picking the wrong encoding or something? You may want to try fiddling with your locale settings to see if that changes anything.

@insumo-w

This comment has been minimized.

Contributor

insumo-w commented Jan 13, 2018

@Th3l5D Did you manage to resolve this?

I installed a fresh Ubuntu 16.04.3 and followed installation+build steps as instructed. And have received the same error.

Operating system: Ubuntu 16.04.3 64bit
wxPython version: 4.0.0rc2
Stock or custom build: Stock
Python version: 3.5.2
Stock or custom build:Stock

Tried simple app:

import wx
app = wx.App()

And ran:

python3 -mtrace --trace main.py

Which outputs (not sure if this contains any useful info)

 --- modulename: _bootstrap, funcname: __exit__
<frozen importlib._bootstrap>(322): <frozen importlib._bootstrap>(323): <frozen importlib._bootstrap>(324):  --- modulename: _bootstrap, funcname: <genexpr>
<frozen importlib._bootstrap>(324):  --- modulename: _bootstrap, funcname: <genexpr>
<frozen importlib._bootstrap>(324):  --- modulename: _bootstrap, funcname: <genexpr>
<frozen importlib._bootstrap>(324):  --- modulename: _bootstrap, funcname: <genexpr>
<frozen importlib._bootstrap>(324): <frozen importlib._bootstrap>(330):  --- modulename: _bootstrap, funcname: _verbose_message
<frozen importlib._bootstrap>(227): <frozen importlib._bootstrap>(332): <frozen importlib._bootstrap>(678): <frozen importlib._bootstrap>(959): <frozen importlib._bootstrap>(963):  --- modulename: _bootstrap, funcname: __exit__
<frozen importlib._bootstrap>(171):  --- modulename: _bootstrap, funcname: release
<frozen importlib._bootstrap>(120): <frozen importlib._bootstrap>(121): <frozen importlib._bootstrap>(122): <frozen importlib._bootstrap>(124): <frozen importlib._bootstrap>(125): <frozen importlib._bootstrap>(126): <frozen importlib._bootstrap>(127): <frozen importlib._bootstrap>(128):  --- modulename: _bootstrap, funcname: cb
<frozen importlib._bootstrap>(191): core.py(2041):                 signal.signal(signal.SIGINT, signal.SIG_DFL)
 --- modulename: signal, funcname: signal
signal.py(47):     handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
 --- modulename: signal, funcname: _enum_to_int
signal.py(39):     try:
signal.py(40):         return int(value)
 --- modulename: signal, funcname: _enum_to_int
signal.py(39):     try:
signal.py(40):         return int(value)
signal.py(48):     return _int_to_enum(handler, Handlers)
 --- modulename: signal, funcname: _int_to_enum
signal.py(29):     try:
signal.py(30):         return enum_klass(value)
 --- modulename: enum, funcname: __call__
enum.py(240):         if names is None:  # simple value lookup
enum.py(241):             return cls.__new__(cls, value)
 --- modulename: enum, funcname: __new__
enum.py(463):         if type(value) is cls:
enum.py(468):         try:
enum.py(469):             if value in cls._value2member_map_:
enum.py(476):         raise ValueError("%r is not a valid %s" % (value, cls.__name__))
signal.py(31):     except ValueError:
signal.py(32):         return value
core.py(2046):         self.stdioWin = None
core.py(2047):         self.saveStdio = (_sys.stdout, _sys.stderr)
core.py(2048):         if redirect:
core.py(2052):         wx.StandardPaths.Get().SetInstallPrefix(_sys.prefix)
core.py(2055):         wx.SystemOptions.SetOption("mac.listctrl.always_use_generic", 1)
core.py(2059):         self._BootstrapApp()
Segmentation fault (core dumped)
test@test-VirtualBox:~/phoenix$ 
@Th3l5D

This comment has been minimized.

Th3l5D commented Jan 13, 2018

@swprojects sorry, I did not resolved this issue. The only workaround is to use python2.

But as @RobinD42 said, it could be an encoding issue. As I'm using a french locale, it may be related.

What is your locale ?

@insumo-w

This comment has been minimized.

Contributor

insumo-w commented Jan 13, 2018

locale is en_GB but I changed to en_US and that didn't have an effect (unless there are additional steps?)

@hoehermann

This comment has been minimized.

hoehermann commented Jan 18, 2018

Operating system: Ubuntu Linux 16.04
wxPython version: wxPython-4.0.0rc1.dev3607+c1a0a4d
Stock or custom build: Stock (through pip)
Python version: 3.5.2
Stock or custom build: Stock

I ran into this problem a few days ago after installing via pip.
Trying to debug the issue, I cloned the git repo at tag wxPython-4.0.0b2 with the wxWidgets git submodule clone at 6dd0af6. I compiled with python3 build.py dox etg sip build and encountered the problem as expected. I did not manage to track down the issue, called a day and removed the local clones.
Today, I tried to tackle the issue again, cloned the same versions from git anew, but this time I compiled with python3 build.py --debug dox etg sip build. The problem does not occur with this build.
I do not see what else I could have done differently. I find this inconsistent behaviour concerning, but I rather not touch anything now that it works for the time being.

@mesalu

This comment has been minimized.

Collaborator

mesalu commented Feb 2, 2018

Fixed by #724, and will be available in 4.0.1 and on.

@mesalu mesalu closed this Feb 2, 2018

@MrObvious MrObvious referenced this issue Apr 3, 2018

Open

Segfault #35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment