kmonsoor / pyglet

Automatically exported from code.google.com/p/pyglet
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Seg fault on OpenBSD #560

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run hello world from the documentation.

Sorry, I do not have python, libGL and libGLU built with debug symbols, but 
here is the trace nevertheless:

% LD_PRELOAD=/usr/X11R6/lib/libGL.so.12.0 gdb /usr/local/bin/python2.7
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-unknown-openbsd5.1"...(no debugging symbols 
found)

(gdb) run 
Starting program: /usr/local/bin/python2.7 
Python 2.7.2 (default, Mar 16 2012, 06:30:10) 
[GCC 4.2.1 20070719 ] on openbsd5
Type "help", "copyright", "credits" or "license" for more information.

(gdb) import pyglet
Undefined command: "import".  Try "help".
(gdb) run 
Starting program: /usr/local/bin/python2.7 
Python 2.7.2 (default, Mar 16 2012, 06:30:10) 
[GCC 4.2.1 20070719 ] on openbsd5
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyglet
>>> window = pyglet.window.Window()
>>> label = pyglet.text.Label('Hello, world',
...                           font_name='Times New Roman',
...                           font_size=36,
...                           x=window.width//2, y=window.height//2,
...                           anchor_x='center', anchor_y='center')

Program received signal SIGSEGV, Segmentation fault.
0x000000021ae691e1 in FcPatternObjectAddWithBinding () from 
/usr/X11R6/lib/libfontconfig.so.7.0
(gdb) 
(gdb) bt
#0  0x000000021ae691e1 in FcPatternObjectAddWithBinding () from 
/usr/X11R6/lib/libfontconfig.so.7.0
#1  0x00000002111803ac in ffi_call_unix64 () from /usr/local/lib/libffi.so.0.0
#2  0x0000000211180214 in ffi_call (cif=0x7f7ffffe4830, fn=0x21ae69cc0 
<IA__FcPatternAddDouble>, rvalue=0x7f7ffffe4730, avalue=0x7f7ffffe4700)
    at src/x86/ffi64.c:484
#3  0x0000000210d6e544 in _ctypes_callproc () from 
/usr/local/lib/python2.7/lib-dynload/_ctypes.so
#4  0x0000000210d6869c in PyCFuncPtr_call () from 
/usr/local/lib/python2.7/lib-dynload/_ctypes.so
#5  0x000000020b513b78 in PyObject_Call () from 
/usr/local/lib/libpython2.7.so.0.0
#6  0x000000020b5a8d85 in PyEval_EvalFrameEx () from 
/usr/local/lib/libpython2.7.so.0.0
#7  0x000000020b5aaddf in PyEval_EvalFrameEx () from 
/usr/local/lib/libpython2.7.so.0.0
#8  0x000000020b5ac3f5 in PyEval_EvalCodeEx () from 
/usr/local/lib/libpython2.7.so.0.0
#9  0x000000020b53b309 in function_call () from 
/usr/local/lib/libpython2.7.so.0.0
#10 0x000000020b513b78 in PyObject_Call () from 
/usr/local/lib/libpython2.7.so.0.0
#11 0x000000020b522072 in instancemethod_call () from 
/usr/local/lib/libpython2.7.so.0.0
#12 0x000000020b513b78 in PyObject_Call () from 
/usr/local/lib/libpython2.7.so.0.0
#13 0x000000020b56b2ac in slot_tp_init () from 
/usr/local/lib/libpython2.7.so.0.0
#14 0x000000020b566e18 in type_call () from /usr/local/lib/libpython2.7.so.0.0
#15 0x000000020b513b78 in PyObject_Call () from 
/usr/local/lib/libpython2.7.so.0.0
#16 0x000000020b5a8d85 in PyEval_EvalFrameEx () from 
/usr/local/lib/libpython2.7.so.0.0
#17 0x000000020b5ac3f5 in PyEval_EvalCodeEx () from 
/usr/local/lib/libpython2.7.so.0.0
#18 0x000000020b5aa93d in PyEval_EvalFrameEx () from 
/usr/local/lib/libpython2.7.so.0.0
#19 0x000000020b5ac3f5 in PyEval_EvalCodeEx () from 
/usr/local/lib/libpython2.7.so.0.0
#20 0x000000020b5aa93d in PyEval_EvalFrameEx () from 
/usr/local/lib/libpython2.7.so.0.0
#21 0x000000020b5ac3f5 in PyEval_EvalCodeEx () from 
/usr/local/lib/libpython2.7.so.0.0
#22 0x000000020b5aa93d in PyEval_EvalFrameEx () from 
/usr/local/lib/libpython2.7.so.0.0
#23 0x000000020b5aaddf in PyEval_EvalFrameEx () from 
/usr/local/lib/libpython2.7.so.0.0
#24 0x000000020b5aaddf in PyEval_EvalFrameEx () from 
/usr/local/lib/libpython2.7.so.0.0
#25 0x000000020b5aaddf in PyEval_EvalFrameEx () from 
/usr/local/lib/libpython2.7.so.0.0
#26 0x000000020b5aaddf in PyEval_EvalFrameEx () from 
/usr/local/lib/libpython2.7.so.0.0
#27 0x000000020b5ac3f5 in PyEval_EvalCodeEx () from 
/usr/local/lib/libpython2.7.so.0.0
#28 0x000000020b53b309 in function_call () from 
/usr/local/lib/libpython2.7.so.0.0
#29 0x000000020b513b78 in PyObject_Call () from 
/usr/local/lib/libpython2.7.so.0.0
#30 0x000000020b5143a1 in call_function_tail () from 
/usr/local/lib/libpython2.7.so.0.0
#31 0x000000020b514842 in PyObject_CallFunction () from 
/usr/local/lib/libpython2.7.so.0.0
#32 0x000000020b52adc3 in property_descr_set () from 
/usr/local/lib/libpython2.7.so.0.0
#33 0x000000020b5503d4 in _PyObject_GenericSetAttrWithDict () from 
/usr/local/lib/libpython2.7.so.0.0
#34 0x000000020b550854 in PyObject_SetAttr () from 
/usr/local/lib/libpython2.7.so.0.0
#35 0x000000020b5a7d2d in PyEval_EvalFrameEx () from 
/usr/local/lib/libpython2.7.so.0.0
#36 0x000000020b5ac3f5 in PyEval_EvalCodeEx () from 
/usr/local/lib/libpython2.7.so.0.0
#37 0x000000020b5aa93d in PyEval_EvalFrameEx () from 
/usr/local/lib/libpython2.7.so.0.0
#38 0x000000020b5ac3f5 in PyEval_EvalCodeEx () from 
/usr/local/lib/libpython2.7.so.0.0
#39 0x000000020b5aa93d in PyEval_EvalFrameEx () from 
/usr/local/lib/libpython2.7.so.0.0
#40 0x000000020b5ac3f5 in PyEval_EvalCodeEx () from 
/usr/local/lib/libpython2.7.so.0.0
#41 0x000000020b53b309 in function_call () from 
/usr/local/lib/libpython2.7.so.0.0
#42 0x000000020b513b78 in PyObject_Call () from 
/usr/local/lib/libpython2.7.so.0.0
#43 0x000000020b522072 in instancemethod_call () from 
/usr/local/lib/libpython2.7.so.0.0
#44 0x000000020b513b78 in PyObject_Call () from 
/usr/local/lib/libpython2.7.so.0.0
#45 0x000000020b56b2ac in slot_tp_init () from 
/usr/local/lib/libpython2.7.so.0.0
#46 0x000000020b566e18 in type_call () from /usr/local/lib/libpython2.7.so.0.0
#47 0x000000020b513b78 in PyObject_Call () from 
/usr/local/lib/libpython2.7.so.0.0
#48 0x000000020b5a8d85 in PyEval_EvalFrameEx () from 
/usr/local/lib/libpython2.7.so.0.0
#49 0x000000020b5ac3f5 in PyEval_EvalCodeEx () from 
/usr/local/lib/libpython2.7.so.0.0
#50 0x000000020b5ac4f2 in PyEval_EvalCode () from 
/usr/local/lib/libpython2.7.so.0.0
#51 0x000000020b5c8212 in run_mod () from /usr/local/lib/libpython2.7.so.0.0
#52 0x000000020b5c9c8d in PyRun_InteractiveOneFlags () from 
/usr/local/lib/libpython2.7.so.0.0
#53 0x000000020b5c9e6e in PyRun_InteractiveLoopFlags () from 
/usr/local/lib/libpython2.7.so.0.0
#54 0x000000020b5c9f7c in PyRun_AnyFileExFlags () from 
/usr/local/lib/libpython2.7.so.0.0
#55 0x000000020b5da168 in Py_Main () from /usr/local/lib/libpython2.7.so.0.0
#56 0x0000000000400931 in ___start ()
#57 0x0000000000000000 in ?? ()

You may notice the use of LD_PRELOAD. This prevents undefined symbol errors. 
Alternatively:
https://github.com/vext01/ports-wip/blob/master/x11/py-pyglet/patches/patch-pygl
et_lib_py

I am using OpenBSD-current on amd64. Python 2.7.2 and pyglet 1.1.4.

Cheers

Original issue reported on code.google.com by vex...@gmail.com on 20 Mar 2012 at 10:50

GoogleCodeExporter commented 9 years ago
For the record, this only happens on amd64 openbsd. Seems to work OK on i386.

Any idea?

Original comment by vex...@gmail.com on 30 May 2012 at 4:15

GoogleCodeExporter commented 9 years ago
The crash is in font/freetype.py:

pattern = fontconfig.FcPatternCreate()
fontconfig.FcPatternAddDouble(pattern, FC_SIZE, c_double(size))
BOOM!

Stuff I have tried:
 * Wrapping FC_SIZE in c_char_p()
 * Checking the return of  fontconfig.FcPatternCreate(). It is not a NULL ptr.
 * Checking type(pattern). It is an int. Is this correct? Can an int contain a 64-bit ptr?
 * Define restype of fontconfig.FcPatternCreate() as c_void_p

As of yet have not been able to resolve the crash.

Any input from the pyglet developers?

Original comment by vex...@gmail.com on 30 May 2012 at 5:18

GoogleCodeExporter commented 9 years ago
This appears to be a duplicate of #529

Original comment by vex...@gmail.com on 30 May 2012 at 5:48