[issue17922] Crash in clear_weakref

2013-05-07 Thread Jan Safranek
New submission from Jan Safranek: I have Python 2.7.4 running on Fedora Rawhide and I get segmentation fault with following backtrace: #0 0x7f73f69ca5f1 in clear_weakref (self=0x7f73ff515c00) at Objects/weakrefobject.c:56 #1 weakref_dealloc (self=0x7f73ff515c00) at Objects

[issue17922] Crash in clear_weakref

2013-05-07 Thread Jan Safranek
Jan Safranek added the comment: I can reproduce the crash in very unusual setup: 1. OpenPegasus (http://www.openpegasus.org/), for this bug we may consider it just a network daemon, listening on TCP port. When a request comes, it is eventually processed by a provider (= something like plugin

[issue17922] Crash in clear_weakref

2013-05-07 Thread Jan Safranek
Jan Safranek added the comment: Bisecting Python mercurial repository, I found the patch which causes the crash: changeset: 80762:7e771f0363e2 branch: 2.7 parent: 80758:29627bd5b333 user:Antoine Pitrou solip...@pitrou.net date:Sat Dec 08 21:15:26 2012 +0100 summary

[issue17922] Crash in clear_weakref

2013-05-07 Thread Jan Safranek
Jan Safranek added the comment: First, have you seen the following message on that bug report: http://bugs.python.org/issue16602#msg177180 I'm reading it now... I searched for PyWeakref_GET_OBJECT in cmpi-bindings and both occurrences generated by SWIG and both look safe. Is it hidden

[issue17922] Crash in clear_weakref

2013-05-07 Thread Jan Safranek
Jan Safranek added the comment: Could you try to inspect the `self` variable inside weakref_dealloc, especially `self-wr_object` and its Py_TYPE() value? Also, what is the value of Py_REFCNT(self-wr_object)? in weakref_dealloc at Objects/weakrefobject.c:106: (gdb) p *self $1 = {_ob_next

[issue17922] Crash in clear_weakref

2013-05-07 Thread Jan Safranek
Jan Safranek added the comment: Right. But this is an embedded interpreter, and SWIG does not call PyType_Ready() again; the old type is returned instead. Python crashes in Py_Initialize(). SWIG_init() is called right after it. So even if SWIG calls PyType_Ready, it would be too late. Why

[issue17922] Crash in clear_weakref

2013-05-09 Thread Jan Safranek
Jan Safranek added the comment: On 05/07/2013 06:06 PM, Antoine Pitrou wrote: a significant amount of static data inside CPython actually survives Py_Finalize :-/ As a solution, would it be possible to wipe all registered types in Py_Finalize? Jan

[issue17922] Crash in clear_weakref

2013-05-09 Thread Jan Safranek
Jan Safranek added the comment: On 05/07/2013 05:32 PM, Antoine Pitrou wrote: Jan, one possibility would be for Pegasus to stop unloading Python, it seems. It is always possibility. Actually, Pegasus plugin is just a shared object (.so) and the .so is linked with Python. Pegasus calls dlopen

[issue17922] Crash in clear_weakref

2013-05-14 Thread Jan Safranek
Jan Safranek added the comment: On 05/09/2013 09:07 AM, Jan Safranek wrote: Jan Safranek added the comment: On 05/07/2013 05:32 PM, Antoine Pitrou wrote: Jan, one possibility would be for Pegasus to stop unloading Python, it seems. It is always possibility. Actually, Pegasus plugin