#15 Reference error in test.py after install

closed-fixed
5
2002-09-24
2002-09-19
No

I installed Psyco using Python 2.2.1c1, which seemed to work. Then
I ran the tests:

[knepley@khan test]$ python ./test.py
Adding parser accelerators ...
Done.
--------------------------------------------------------------------------------
950
^^^ computed by Psyco in 0.0 seconds
Python got the same result in 0.0 seconds
--------------------------------------------------------------------------------
1083876708
^^^ computed by Psyco in 0.02 seconds
Python got the same result in 4.96 seconds, Psyco is 248.00 times faster
--------------------------------------------------------------------------------
Fatal Python error: UNREF invalid object
Aborted

I ran python uder the debugger to get an idea what the problem was:

[knepley@khan test]$ pygdb
GNU gdb 5.0
Copyright 2000 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 "i686-pc-linux-gnu"...
(gdb) run test.py
Starting program: /usr/local/python/bin/python test.py
Adding parser accelerators ...
Done.
--------------------------------------------------------------------------------
950
^^^ computed by Psyco in 0.0 seconds
Python got the same result in 0.0 seconds
--------------------------------------------------------------------------------
1083876708
^^^ computed by Psyco in 0.02 seconds
Python got the same result in 5.2 seconds, Psyco is 260.00 times faster
--------------------------------------------------------------------------------
Fatal Python error: UNREF invalid object

Program received signal SIGABRT, Aborted.
0x40092b41 in kill () from /lib/libc.so.6
(gdb) up
#1 0x400318c2 in pthread_kill () from /lib/libpthread.so.0
(gdb)
#2 0x40031da1 in raise () from /lib/libpthread.so.0
(gdb)
#3 0x40093feb in abort () from /lib/libc.so.6
(gdb)
#4 0x80b20a4 in Py_FatalError () at Python/pythonrun.c:1276
1276 abort();
(gdb)
#5 0x8059cd1 in _Py_ForgetReference (op=0x81a22d8) at Objects/object.c:1804
1804 Py_FatalError("UNREF invalid object");
(gdb)
#6 0x8059d2d in _Py_Dealloc (op=0x81a22d8) at Objects/object.c:1825
1825 _Py_ForgetReference(op);
(gdb)
#7 0x80db481 in file_dealloc (f=0x81ab0f0) at Objects/fileobject.c:214
214 Py_XDECREF(f->f_name);
(gdb) down
#6 0x8059d2d in _Py_Dealloc (op=0x81a22d8) at Objects/object.c:1825
1825 _Py_ForgetReference(op);
(gdb) p op
$1 = (PyObject *) 0x81a22d8
(gdb) p *op
$2 = {_ob_next = 0x81ab0f0, _ob_prev = 0x81a18d8, ob_refcnt = 0,
ob_type = 0x8115c80}
(gdb) p *op->ob_type
$3 = {_ob_next = 0x0, _ob_prev = 0x0, ob_refcnt = 59, ob_type = 0x8116180,
ob_size = 0, tp_name = 0x80fdda3 "str", tp_basicsize = 32, tp_itemsize = 1,
tp_dealloc = 0x805b300 <string_dealloc>,
tp_print = 0x805b560 <string_print>, tp_getattr = 0, tp_setattr = 0,
tp_compare = 0, tp_repr = 0x805b7c0 <string_repr>, tp_as_number = 0x0,
tp_as_sequence = 0x8114320, tp_as_mapping = 0x0,
tp_hash = 0x805c330 <string_hash>, tp_call = 0,
tp_str = 0x805ba00 <string_str>,
tp_getattro = 0x8058990 <PyObject_GenericGetAttr>,
tp_setattro = 0x8058be0 <PyObject_GenericSetAttr>, tp_as_buffer = 0x8114348,
tp_flags = 5611,
tp_doc = 0x8115be0 "str(object) -> string\n\nReturn a nice string representation of the object.\nIf the argument is a string, the return value is the same object.", tp_traverse = 0, tp_clear = 0,
tp_richcompare = 0x805c040 <string_richcompare>, tp_weaklistoffset = 0,
tp_iter = 0, tp_iternext = 0, tp_methods = 0x81159a0, tp_members = 0x0,
tp_getset = 0x0, tp_base = 0x81162c0, tp_dict = 0x8157d7c, tp_descr_get = 0,
tp_descr_set = 0, tp_dictoffset = 0, tp_init = 0x8067910 <object_init>,
tp_alloc = 0x8064200 <PyType_GenericAlloc>, tp_new = 0x805fcb0 <string_new>,
tp_free = 0x80560b0 <_PyObject_Del>, tp_is_gc = 0, tp_bases = 0x8153bac,
tp_mro = 0x8156764, tp_cache = 0x0, tp_subclasses = 0x0,
tp_weaklist = 0x8167afc}
(gdb) call PyString_AsString(op)
$4 = 0x81a22f4 "../c/codemanager.h"
(gdb) quit
The program is running. Exit anyway? (y or n) y

So it looks like some file is getting dereferenced too many times,
although the error actually comes from its name. This package
looks really great and I would love to get it working. Its possible
that this is the same incompatibility as with 2.3 I guess, but you
can tell me.

Thanks,

Matt

Discussion

  • Armin Rigo

    Armin Rigo - 2002-09-20
    • assigned_to: nobody --> arigo
     
  • Armin Rigo

    Armin Rigo - 2002-09-20

    Logged In: YES
    user_id=4771

    The problem seems to come from the fact you are using a
    debugging version of Python, e.g. compiled with the
    --with-pydebug configure option, as can be seen by the
    "adding parser accelerators" texts. I could reproduce the
    problem with Python 2.2.1, and it disappeared in
    the non-debugging Python.

    That said, I will still investigate this problem to know if
    it reveals a bug that could potentially show up in the
    non-debugging Python as well.

     
  • Armin Rigo

    Armin Rigo - 2002-09-24

    Logged In: YES
    user_id=4771

    Fixed. It was caused by Python's debugging mode
    Py_TRACE_REF. In this mode, the Python standard
    Py_DECREF() macro calls a function _Py_Dealloc() instead
    of directly calling the object destructor. This behavior was not
    properly emulated by Psyco.

     
  • Armin Rigo

    Armin Rigo - 2002-09-24
    • status: open --> closed-fixed
     

Log in to post a comment.