Refcount problem in ceval.c

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Berthold =?iso-8859-15?Q?H=F6llmann?=

    Refcount problem in ceval.c

    I have a problem with my debug Python 2.5.2 executable with Py_REF_DEBUG
    and Py_TRACE_REFS set. With one of my scripts I get:

    ....
    Fatal Python error: Python/ceval.c:947 object at 0x2aa3f4d840 has negative ref count -260424622217076 0230

    Program received signal SIGABRT, Aborted.
    [Switching to Thread 182905044128 (LWP 2595)]
    0x0000002a95dde 479 in raise () from /lib64/tls/libc.so.6
    (gdb) p ((PyObject*)0x2 aa3f4d840)->ob_type
    $1 = (struct _typeobject *) 0xdbdbdbdbdbdbd bdb
    (gdb) p ((PyObject*)0x2 aa3f4d840)->ob_refcnt
    $2 = -260424622217076 0230
    (gdb) p ((PyObject*)0x2 aa3f4d840)->_ob_next
    $3 = (struct _object *) 0xdbdbdbdbdbdbd bdb
    (gdb) p ((PyObject*)0x2 aa3f4d840)->_ob_prev
    $4 = (struct _object *) 0xdbdbdbdbdbdbd bdb
    (gdb)


    Is there any "common" reason to for such a strange object on the command
    stack, or is it more likely that any of my extension modules is causing
    havoc?

    Kind regards
    Berthold
    --
    __ Address:
    G / \ L Germanischer Lloyd
    phone: +49-40-36149-7374 -+----+- Vorsetzen 35 P.O.Box 111606
    fax : +49-40-36149-7320 \__/ D-20459 Hamburg D-20416 Hamburg
  • Christian Heimes

    #2
    Re: Refcount problem in ceval.c

    Berthold Höllmann wrote:
    Is there any "common" reason to for such a strange object on the command
    stack, or is it more likely that any of my extension modules is causing
    havoc?
    It's very likely that your extension has a reference counting bug. It
    looks like you are either missing a Py_INCREF or you have a Py_DECREF
    too much. Newly freed memory is filled with 0xDB (see Objects/obmalloc.c
    DEADBYTE).

    Wild guess: Are you using PyModule_AddObj ect with a PyTypeObject w/o
    Py_INCREF()ing the type object first?

    Christian

    Comment

    • Berthold =?iso-8859-15?Q?H=F6llmann?=

      #3
      Re: Refcount problem in ceval.c

      Christian Heimes <lists@cheimes. dewrites:
      Berthold Höllmann wrote:
      >Is there any "common" reason to for such a strange object on the command
      >stack, or is it more likely that any of my extension modules is causing
      >havoc?
      >
      It's very likely that your extension has a reference counting bug. It
      looks like you are either missing a Py_INCREF or you have a Py_DECREF
      too much. Newly freed memory is filled with 0xDB (see
      Objects/obmalloc.c DEADBYTE).
      I was suspecting this, that's why I build the debugging version of
      Python. I hoped I would get the error message somewhere near the code
      causing the error, but I seems i have to continue the search.
      Wild guess: Are you using PyModule_AddObj ect with a PyTypeObject w/o
      Py_INCREF()ing the type object first?
      That would have been easy :-) I have only one occurrence of
      PyModule_AddObj ect, and its PyTypeObject is Py_INCREF()ed

      Thanks
      Berthold
      --
      __ Address:
      G / \ L Germanischer Lloyd
      phone: +49-40-36149-7374 -+----+- Vorsetzen 35 P.O.Box 111606
      fax : +49-40-36149-7320 \__/ D-20459 Hamburg D-20416 Hamburg

      -----BEGIN PGP SIGNATURE-----
      Version: GnuPG v1.4.0 (GNU/Linux)

      iD8DBQFIyMTEvnK LBupGT+8RArWiAK CBY40o5X7cfXEaJ tIE34aII67kEQCf dUte
      ScgFJcxTta5fd3e VQcy7NZM=
      =Z6Xr
      -----END PGP SIGNATURE-----

      Comment

      Working...