visit_decref: Assertion `gc->gc.gc_refs != 0' failed.

Michael Tharp <gxti-1pawZKhx9Om5WRpDikjj11aTQe2KTcn/@public.gmane.org> Tue, 23 Mar 2010 11:39:29 -0400
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
Seeing python bomb out on a GC-related assertion during some heavy load 
testing:

#3  0x000000000048bd2c in visit_decref (op=0x7f7b78037c58,
     data=<value optimized out>) at Modules/gcmodule.c:275
         __PRETTY_FUNCTION__ = "visit_decref"

(gdb) p op->ob_type->tp_name
$3 = 0x7f7b7fb16398 "psycopg2._psycopg.type"

It always happens eventually, although it takes anywhere from a few 
minutes to two hours to trigger. I've seen it in these configurations:

* Python 2.4, psycopg 2.0.14
* Python 2.6, psycopg 2.0.13
* Python 2.4, psycopg 2.0.12

See attachment for larger backtrace.

-- m. tharp

_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/psycopg
stack.17182.txt (text/plain, 7.4 KB)
Core was generated by `python2.4 rmake/server/dispatcher.py -j rmake-q8EDhD6uEhtkeCUmBO/GZ7Vn/[email protected]/rmake -p as'.
Program terminated with signal 6, Aborted.
#0  0x0000003c7e0326c5 in raise (sig=<value optimized out>)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64	  return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
#0  0x0000003c7e0326c5 in raise (sig=<value optimized out>)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
        resultvar = 0
        pid = <value optimized out>
        selftid = <value optimized out>
#1  0x0000003c7e033ea5 in abort () at abort.c:92
        save_stage = 2
        act = {__sigaction_handler = {sa_handler = 0x4c6bbf, 
            sa_sigaction = 0x4c6bbf}, sa_mask = {__val = {259813264372, 
              140168136730592, 275, 140168136730832, 259812380694, 
              206158430232, 140168136730848, 140168136730624, 259812289720, 
              206158430256, 140168136730872, 140167935466080, 117, 117, 0, 
              140734455687404}}, sa_flags = 2115220813, sa_restorer = 0x4c6b9a}
        sigs = {__val = {32, 0 <repeats 15 times>}}
#2  0x0000003c7e02b7b5 in __assert_fail (
    assertion=0x4c6bbf "gc->gc.gc_refs != 0", file=<value optimized out>, 
    line=275, function=<value optimized out>) at assert.c:81
        buf = 0x7f7b64009a60 "python2.4: Modules/gcmodule.c:275: visit_decref: Assertion `gc->gc.gc_refs != 0' failed.\n"
#3  0x000000000048bd2c in visit_decref (op=0x7f7b78037c58, 
    data=<value optimized out>) at Modules/gcmodule.c:275
        __PRETTY_FUNCTION__ = "visit_decref"
#4  0x000000000043eafe in tupletraverse (o=0x1e49408, 
    visit=0x48bcb0 <visit_decref>, arg=0x0) at Objects/tupleobject.c:444
        i = 0
        err = <value optimized out>
        x = 0x431e
#5  0x000000000048c227 in subtract_refs (generation=1)
    at Modules/gcmodule.c:294
        gc = 0x1e493e8
#6  collect (generation=1) at Modules/gcmodule.c:776
        i = <value optimized out>
        m = <value optimized out>
        n = <value optimized out>
        young = 0x6fb110
        old = 0x6fb140
        unreachable = {gc = {gc_next = 0x1, gc_prev = 0x42d7c5, gc_refs = 0}, 
          dummy = <invalid float value>}
        finalizers = {gc = {gc_next = 0x7f7b8ca91300, gc_prev = 0x42b962, 
            gc_refs = 2013640252}, dummy = <invalid float value>}
        gc = <value optimized out>
#7  0x000000000048cab2 in collect_generations (basicsize=<value optimized out>)
    at Modules/gcmodule.c:872
No locals.
#8  _PyObject_GC_Malloc (basicsize=<value optimized out>)
    at Modules/gcmodule.c:1266
        op = <value optimized out>
#9  0x000000000044c269 in PyType_GenericAlloc (type=0x16e8410, nitems=9)
    at Objects/typeobject.c:453
        obj = <value optimized out>
        size = 48
#10 0x000000000042d893 in long_subtype_new (type=0x16e8410, 
    args=<value optimized out>, kwds=<value optimized out>)
    at Objects/longobject.c:2995
        __PRETTY_FUNCTION__ = "long_subtype_new"
#11 long_new (type=0x16e8410, args=<value optimized out>, 
    kwds=<value optimized out>) at Objects/longobject.c:2953
        x = 0x0
        base = -909
        kwlist = {0x4b7eaf "x", 0x4b3f0f "base", 0x0}
#12 0x0000000000447645 in tp_new_wrapper (self=0x6e9280, args=0x7f7b78038210, 
    kwds=0x0) at Objects/typeobject.c:3946
        type = <value optimized out>
        subtype = 0x431e
        staticbase = <value optimized out>
        arg0 = 0x16e8410
        res = 0x0
#13 0x0000000000467f18 in call_function (f=0x1e769d0) at Python/ceval.c:3568
No locals.
#14 PyEval_EvalFrame (f=0x1e769d0) at Python/ceval.c:2167
        sp = 0x1e76bd0
        stack_pointer = <value optimized out>
        next_instr = 0x16c8534 "S"
        opcode = <value optimized out>
        oparg = <value optimized out>
        why = WHY_NOT
        err = 0
        x = <value optimized out>
        v = <value optimized out>
        w = <value optimized out>
        u = <value optimized out>
        t = <value optimized out>
        stream = 0x7f7b80efa950
        fastlocals = 0x1e76b58
        freevars = 0x1e76bc8
        retval = 0x0
        tstate = 0x7f7b64014a70
        co = 0x7f7b8619e7a0
        instr_ub = -1
        instr_lb = 0
        instr_prev = -1
        first_instr = <value optimized out>
        names = 0x16e2470
        consts = 0x16ee7d0
        __PRETTY_FUNCTION__ = "PyEval_EvalFrame"
#15 0x0000000000468cc0 in PyEval_EvalCodeEx (co=0x7f7b8619e7a0, 
    globals=<value optimized out>, locals=<value optimized out>, args=0x5, 
    argcount=2, kws=0x0, kwcount=0, defs=0x7f7b8445dbc8, defcount=6, 
    closure=0x0) at Python/ceval.c:2741
        f = 0x1e769d0
        retval = <value optimized out>
        fastlocals = 0x1e76b58
        freevars = 0x1e76bc8
        tstate = 0x7f7b64014a70
        x = <value optimized out>
        u = <value optimized out>
        __PRETTY_FUNCTION__ = "PyEval_EvalCodeEx"
#16 0x00000000004aaec7 in function_call (func=0x7f7b848c7cf8, 
    arg=0x7f7b78044dd0, kw=0x0) at Objects/funcobject.c:548
        result = <value optimized out>
        argdefs = <value optimized out>
        d = 0x7f7b8445dbc8
        k = <value optimized out>
        nk = <value optimized out>
        nd = 6
#17 0x00000000004148e0 in PyObject_Call (func=0x431e, arg=0x408b, kw=0x6)
    at Objects/abstract.c:1795
        result = <value optimized out>
        call = 0
#18 0x00000000004429c6 in slot_tp_new (type=0x16e8410, args=0x7f7b78038f10, 
    kwds=0x0) at Objects/typeobject.c:4817
        func = 0x7f7b848c7cf8
        newargs = 0x7f7b78044dd0
        x = 0x0
        i = -1
        n = 1
        new_str = 0x7f7b8cac59c0
        __PRETTY_FUNCTION__ = "slot_tp_new"
#19 0x00000000004424a3 in type_call (type=0x431e, args=0x7f7b78038f10, 
    kwds=0x0) at Objects/typeobject.c:421
        obj = <value optimized out>
#20 0x00000000004148e0 in PyObject_Call (func=0x431e, arg=0x408b, kw=0x6)
    at Objects/abstract.c:1795
        result = <value optimized out>
        call = 0
#21 0x00000000004655b9 in call_function (f=0x1e6eb10) at Python/ceval.c:3776
        w = <value optimized out>
        pfunc = 0x1e6eca8
#22 PyEval_EvalFrame (f=0x1e6eb10) at Python/ceval.c:2167
        sp = 0x1e6ecb0
        stack_pointer = <value optimized out>
        next_instr = 0x7f7b801c391f "p\004"
        opcode = <value optimized out>
        oparg = <value optimized out>
        why = <value optimized out>
        err = 0
        x = <value optimized out>
        v = <value optimized out>
        w = <value optimized out>
        u = <value optimized out>
        t = <value optimized out>
        stream = <value optimized out>
        fastlocals = 0x1e6ec98
        freevars = 0x1e6eca8
        retval = 0x0
        tstate = 0x7f7b64014a70
        co = 0x7f7b80f5f110
        instr_ub = -1
        instr_lb = <value optimized out>
        instr_prev = -1
        first_instr = <value optimized out>
        names = 0x7f7b80f82158
        consts = 0x7f7b80fd9790
        __PRETTY_FUNCTION__ = "PyEval_EvalFrame"
#23 0x0000000000468cc0 in PyEval_EvalCodeEx (co=0x7f7b80f5f110, 
    globals=<value optimized out>, locals=<value optimized out>, 
    args=0x7f7b7803e848, argcount=2, kws=0x0, kwcount=0, defs=0x0, defcount=0, 
    closure=0x0) at Python/ceval.c:2741
        f = 0x1e6eb10
        retval = <value optimized out>
        fastlocals = 0x1e6ec98
        freevars = 0x1e6eca8
        tstate = 0x7f7b64014a70
        x = <value optimized out>
        u = <value optimized out>
        __PRETTY_FUNCTION__ = "PyEval_EvalCodeEx"