Hello,

I've updated our software stack from Python 2.6.6 to Python 2.7.1. Since
the update I'm seeing random segfaults all related to
JCCEnv::deleteGlobalRef() and Python's GC. At first I thought the bug is
an incompatibility between Python 2.7 and JCC 2.7. However an update to
JCC 2.8 and Lucence 3.1.0 didn't resolve my issue.

So far all segfaults have the same pattern. The creation or removal of a
Python object triggers a cyclic GC run which runs into
t_JObject_dealloc() and crashes inside JCCEnv::deleteGlobalRef(). At
least some of the crashing code paths run inside threads with an
attached JCC thread.

(gdb) bt
#10 <signal handler called>
#11 0x00002ba7deb380c9 in JCCEnv::deleteGlobalRef(_jobject*, int) ()
   from
/opt/vlspy27/lib/python2.7/site-packages/JCC-2.8-py2.7-linux-x86_64.egg/libjcc.so
#12 0x00002ba7de36c649 in t_JObject_dealloc(t_JObject*) ()
   from
/opt/vlspy27/lib/python2.7/site-packages/lucene-3.1.0-py2.7-linux-x86_64.egg/lucene/_lucene.so
#13 0x00002ba7cee851eb in dict_dealloc (mp=0x9975720) at
Objects/dictobject.c:985
#14 0x00002ba7cee86edb in PyDict_Clear (op=<value optimized out>) at
Objects/dictobject.c:891
#15 0x00002ba7cee86f49 in dict_tp_clear (op=0x3) at
Objects/dictobject.c:2088
#16 0x00002ba7cef27b7e in delete_garbage (generation=<value optimized
out>) at Modules/gcmodule.c:769
#17 collect (generation=<value optimized out>) at Modules/gcmodule.c:930
#18 0x00002ba7cef283ae in collect_generations (basicsize=<value
optimized out>) at Modules/gcmodule.c:996
#19 _PyObject_GC_Malloc (basicsize=<value optimized out>) at
Modules/gcmodule.c:1457
#20 0x00002ba7cef2844d in _PyObject_GC_New (tp=0x2ba7cf197fa0) at
Modules/gcmodule.c:1467
#21 0x00002ba7cee84bbc in PyDict_New () at Objects/dictobject.c:277
#22 0x00002ba7cee8b188 in _PyObject_GenericSetAttrWithDict (obj=<value
optimized out>, name=0x12d5ae8, value=0x7c636b0, dict=0x0)
    at Objects/object.c:1510
#23 0x00002ba7cee8b537 in PyObject_SetAttr (v=0x77704d0, name=0x12d5ae8,
value=0x7c636b0) at Objects/object.c:1245
#24 0x00002ba7ceeee4b4 in PyEval_EvalFrameEx (f=0x50d7520,
throwflag=<value optimized out>) at Python/ceval.c:2003
#25 0x00002ba7ceef28b8 in PyEval_EvalCodeEx (co=0x2199ab0,
globals=<value optimized out>, locals=<value optimized out>,
args=0x8bd7b58,
(gdb) select-frame 24
(gdb) pyframe
/opt/vlspy27/lib/python2.7/site-packages/kinterbasdb-3.3.0-py2.7-linux-x86_64.egg/kinterbasdb/__init__.py
(1499): __init__


class _RowMapping(object):
    def __init__(self, description, row):
        self._description = description
        fields = self._fields = {} # <-- 1499
        pos = 0

(gdb) bt
#11 0x00002ba90298b0c9 in JCCEnv::deleteGlobalRef(_jobject*, int) ()
   from
/opt/vlspy27/lib/python2.7/site-packages/JCC-2.8-py2.7-linux-x86_64.egg/libjcc.so
#12 0x00002ba9021bf649 in t_JObject_dealloc(t_JObject*) ()
   from
/opt/vlspy27/lib/python2.7/site-packages/lucene-3.1.0-py2.7-linux-x86_64.egg/lucene/_lucene.so
#13 0x00002ba8f2cd81eb in dict_dealloc (mp=0x105df800) at
Objects/dictobject.c:985
#14 0x00002ba8f2cd9edb in PyDict_Clear (op=<value optimized out>) at
Objects/dictobject.c:891
#15 0x00002ba8f2cd9f49 in dict_tp_clear (op=0x3) at
Objects/dictobject.c:2088
#16 0x00002ba8f2d7ab7e in delete_garbage (generation=<value optimized
out>) at Modules/gcmodule.c:769
#17 collect (generation=<value optimized out>) at Modules/gcmodule.c:930
#18 0x00002ba8f2d7b3ae in collect_generations (basicsize=<value
optimized out>) at Modules/gcmodule.c:996
#19 _PyObject_GC_Malloc (basicsize=<value optimized out>) at
Modules/gcmodule.c:1457
#20 0x00002ba8f2d7b44d in _PyObject_GC_New (tp=0x2ba8f2fddfc0) at
Modules/gcmodule.c:1467
#21 0x00002ba8f2cb0aa8 in PyWrapper_New (d=0x1e5e140,
self=0x2ba9242509e0) at Objects/descrobject.c:1051
#22 0x00002ba8f2cb0be3 in wrapperdescr_call (descr=0x1e5e140,
args=0x28f87520, kwds=0x0) at Objects/descrobject.c:296
#23 0x00002ba8f2c93533 in PyObject_Call (func=0x1e5e140,
arg=0x2ba9242509e0, kw=0x2ba928815a40) at Objects/abstract.c:2529
#24 0x00002ba8f89b8d6c in __pyx_pf_4lxml_5etree_9_ErrorLog___init__
(__pyx_v_self=0x229db820, __pyx_args=<value optimized out>,
    __pyx_kwds=<value optimized out>) at src/lxml/lxml.etree.c:28498
#25 0x00002ba8f2cf6068 in type_call (type=<value optimized out>,
args=0x2ba8f3c64050, kwds=0x0) at Objects/typeobject.c:728
#26 0x00002ba8f2c93533 in PyObject_Call (func=0x2ba8f8cbb1e0,
arg=0x2ba9242509e0, kw=0x2ba928815a40) at Objects/abstract.c:2529
#27 0x00002ba8f89b91c0 in
__pyx_pf_4lxml_5etree_19_XPathEvaluatorBase___cinit__
(__pyx_v_self=0x6c5cdb8, __pyx_args=<value optimized out>,
    __pyx_kwds=<value optimized out>) at src/lxml/lxml.etree.c:111873
#28 0x00002ba8f89bcb7c in __pyx_tp_new_4lxml_5etree__XPathEvaluatorBase
(t=<value optimized out>, a=<value optimized out>,
    k=<value optimized out>) at src/lxml/lxml.etree.c:149259
#29 __pyx_tp_new_4lxml_5etree_XPath (t=<value optimized out>, a=<value
optimized out>, k=<value optimized out>)
    at src/lxml/lxml.etree.c:18769
#30 0x00002ba8f2cf6023 in type_call (type=0x3, args=0x20515510,
kwds=0x2ba9243a0bb0) at Objects/typeobject.c:712
#31 0x00002ba8f2c93533 in PyObject_Call (func=0x2ba8f8cc26e0,
arg=0x2ba9242509e0, kw=0x2ba928815a40) at Objects/abstract.c:2529
#32 0x00002ba8f2d4303e in do_call (f=0x23b8e80, throwflag=<value
optimized out>) at Python/ceval.c:4230
#33 call_function (f=0x23b8e80, throwflag=<value optimized out>) at
Python/ceval.c:4035
#34 PyEval_EvalFrameEx (f=0x23b8e80, throwflag=<value optimized out>) at
Python/ceval.c:2665
#35 0x00002ba8f2d458b8 in PyEval_EvalCodeEx (co=0x1bf87b0,
globals=<value optimized out>, locals=<value optimized out>, args=0x3,
(gdb) select-frame 34
(gdb) pyframe
.../smc/tools/lxml.py (73): xpath

    def xpath(self, xp, namespaces=None, **kwargs):
        try:
            xpath = etree.XPath(xp, namespaces=NS_MAP, regexp=False)
        except etree.XPathSyntaxError, e: # <-- 73
            log.error('cannot parse %s' % xp)
            raise e


My setup:
Python 2.7.1 (X86_64 on Ubuntu)
JCC: 2.7, 2.8
Lucence: 3.0.3, 3.1.0


Christian

Reply via email to