[pyOpenSSL] Python core dumps when using pyOpenSSL 0.8.0 and threads

M.-A. Lemburg mal at egenix.com
Wed Mar 25 00:24:29 CET 2009


On 2009-03-22 17:32, Jean-Paul Calderone wrote:
> Hello all,
> 
> I just pushed a branch to launchpad which may address the 0.8 thread-related
> crashes.
> 
> The bug, along with a reproduction script, is described here:
> 
>   https://bugs.launchpad.net/pyopenssl/+bug/344815
> 
> The branch, along with checkout instructions, which fixes the problem is here:
> 
>   https://code.launchpad.net/~exarkun/pyopenssl/thread-crash
> 
> If you're not in to bzr, then you can get just the revision which includes
> the fix here:
> 
>   http://bazaar.launchpad.net/~exarkun/pyopenssl/thread-crash/revision/98

This doesn't appear to cover all cases, esp. not if you have an
application that uses recursion in callbacks.

The patch causes an already existing thread state to get overwritten
by another one. If the application starts returning from a deeper
nesting, this will cause a wrong thread state to get restored (actually,
the last one will get restored multiple times).

To solve this, the thread state would have to be managed on a stack
or recursive callbacks would have to be prohibited by checking whether
there already is a saved thread state and then raising an exception
instead of overwriting the state with a new one.

The latter solution appears to be a lot easier to implement and
much safer overall.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Mar 25 2009)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2009-03-19: Released mxODBC.Connect 1.0.1      http://python.egenix.com/

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/




More information about the pyopenssl-users mailing list