[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: Hopefully this is fixed for good now. Thank you! -- resolution: -> fixed status: open -> closed ___ Python tracker ___ ___

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Roundup Robot
Roundup Robot added the comment: New changeset b196bcd7c34f by Antoine Pitrou in branch '3.2': Fix the fix for issue #12149: it was incorrect, although it had the side http://hg.python.org/cpython/rev/b196bcd7c34f New changeset 195bfd4c3ea1 by Antoine Pitrou in branch 'default': Fix the fix for

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Since PyType_Modified is generally called whenever a type is modified, > it is likely to act as a guardian for any future optimisations that > require classes to be unchanged. > > Thus, given these two reasons, it seems wise to call PyType_Modified > anywh

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Mark Shannon
Mark Shannon added the comment: Antoine Pitrou wrote: > Antoine Pitrou added the comment: > >> I have added a call to PyType_Modified in type_clear (as well as >> type_set_name and type_set_qualname, which also modify the type). > > Can __name__ and __qualname__ be looked up through the metho

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Davide Rizzo
Davide Rizzo added the comment: As much as I hate being wrong, I must concur with you. ;) Thank you, Mark. -- ___ Python tracker ___

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: > I have added a call to PyType_Modified in type_clear (as well as > type_set_name and type_set_qualname, which also modify the type). Can __name__ and __qualname__ be looked up through the method cache? -- ___ Pyth

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Mark Shannon
Mark Shannon added the comment: Beat me to it, Antoine! Don't forget type_set_name and type_set_qualname. -- ___ Python tracker ___

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Mark Shannon
Mark Shannon added the comment: What's happening is that the cycle GC calls type_clear to clear the type, but the method-cache is not invalidated. I have added a call to PyType_Modified in type_clear (as well as type_set_name and type_set_qualname, which also modify the type). Patch is attach

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: Thanks for the writeup, Mark. Here is a patch, calling PyType_Modified in the type's (not the instance's) tp_clear. -- resolution: fixed -> status: closed -> open Added file: http://bugs.python.org/file23963/type_clear.patch _

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Mark Shannon
Mark Shannon added the comment: Absolutely. subtype_dealloc deals with deallocation of subtype *instances*, not the types themselves. > Maybe we can try and explore the reference graph again? This sort of thing is one of the reasons that the cycle GC does not call any finalisers. Attempting

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Davide Rizzo
Davide Rizzo added the comment: Mark, it's been a long time since I went through this bug and don't remember the details. Are you sure subtype_dealloc should not call PyType_Modified? It looked like the appropriate place at the time. In the example the reference cycle was introduced on purpos

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-14 Thread Mark Shannon
Mark Shannon added the comment: Please reopen this bug as the fix is wrong. This fix merely hides the symptoms of _PyType_Lookup returning a dead object, by calling PyType_Modified() frequently, thus ensuring the type method cache is almost always invalidated. This results in a significant sl

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-07-13 Thread STINNER Victor
STINNER Victor added the comment: Oooh, an interesting and complex bug with an one-liner fix! -- ___ Python tracker ___ ___ Python-bu

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-07-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: Should be fixed now. Thanks again Davide for the patch. -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed ___ Python tracker __

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-07-12 Thread Roundup Robot
Roundup Robot added the comment: New changeset 9618303852da by Antoine Pitrou in branch '2.7': Issue #12149: Update the method cache after a type's dictionnary gets http://hg.python.org/cpython/rev/9618303852da -- ___ Python tracker

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-07-12 Thread Roundup Robot
Roundup Robot added the comment: New changeset cd40ea4087b0 by Antoine Pitrou in branch '3.2': Issue #12149: Update the method cache after a type's dictionnary gets http://hg.python.org/cpython/rev/cd40ea4087b0 New changeset 5992cbbedf59 by Antoine Pitrou in branch 'default': Issue #12149: Upda

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-07-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: Thank you very much! -- stage: needs patch -> patch review versions: -Python 3.1 ___ Python tracker ___ __

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-07-12 Thread Davide Rizzo
Davide Rizzo added the comment: The attached test segfaults (and passes with the patch). It wasn't clear to me where to put the test (it is a typeobject issue triggered by io) but Antoine on IRC agreed it would make sense to add it to test_io anyway. Python 2.7 is affected too by the bug, but

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-07-05 Thread Davide Rizzo
Davide Rizzo added the comment: Invalidating the cache in subtype_clear prevents the "close" method to be called in the collected object. I'm not sure that's the right place where to put the PyType_Modified, but apparently it works. -- Added file: http://bugs.python.org/file22587/subt

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-07-05 Thread Andreas Stührk
Changes by Andreas Stührk : -- nosy: +Trundle ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pytho

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-07-05 Thread Davide Rizzo
Davide Rizzo added the comment: Looking through Antoine's example code. When garbage is collected, the subtype and its tp_dict are cleared before the instance object itself. When the dict is cleared as part of the garbage collection, the methods get deallocated but the method cache is not upd

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-07-05 Thread Senthil Kumaran
Changes by Senthil Kumaran : -- nosy: +orsenthil ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-07-05 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-05-22 Thread Davide Rizzo
Changes by Davide Rizzo : -- nosy: +davide.rizzo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-05-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ezio, in the meantime, you can simply put the FakeSocket declaration at the top level. -- ___ Python tracker ___ _

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-05-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: Here is a quick script to reproduce. It seems that the type of the object has to be caught in a reference cycle for this to happen: apparently the descriptors start being deallocated but the method cache isn't updated yet (?). -- nosy: +amaury.forgeot

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-05-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: This occurs when running the GC and then calling the finalization of an IO object, which temporarily resurrects the object to call its close() method: #0 0x7fc20bc1609b in raise () from /lib64/libpthread.so.0 #1 0x005328e7 in faulthandler_fatal_e

[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-05-22 Thread Ezio Melotti
New submission from Ezio Melotti : The attached patch causes a segfault while running test_urllib: $ ./python -m test test_urllib [1/1] test_urllib Fatal Python error: Segmentation fault Current thread 0xb77de8d0: File "/home/wolf/dev/py/py3k/Lib/http/client.py", line 451 in close Fil