[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Crash in python bindings on windows (in apache)

From: David James <james82_at_gmail.com>
Date: 2005-10-16 04:37:54 CEST

On 10/14/05, Marc Haesen <Marc.Haesen@telindus.be> wrote:
> The current python bindings crash in windows when used with viewcvs in
> apache. The crash occurs when the apache server is restarted or stopped.
>
> It is the routine svn_swig_py_pool_destroyed that is crashing because
> the function call apr_threadkey_private_get(&val, _saved_thread_key);
> returns NULL as val. This is because the svn_swig_py_pool_destroyed is
> not called from the same thread that created the pool.
>
> One possible fix is to replace the svn_swig_py_release_py_lock and
> svn_swig_py_acquire_py_lock with the following two functions (only using
> one thread_state for all threads):
>
> #ifdef ACQUIRE_PYTHON_LOCK
> static PyThreadState *thread_state;
> #endif
>
> void svn_swig_py_release_py_lock(void)
> {
> #ifdef ACQUIRE_PYTHON_LOCK
> thread_state = PyEval_SaveThread();
> #endif
> }
>
> void svn_swig_py_acquire_py_lock(void)
> {
> #ifdef ACQUIRE_PYTHON_LOCK
> PyEval_RestoreThread(thread_state);
> #endif
> }
Thanks Marc! Max, Daniel, do you think it would be a good idea to
change our bindings to use a single threadstate on Windows? (Using
#ifdef WIN32 around Marc's code)

Cheers,

David

--
David James -- http://www.cs.toronto.edu/~james
Received on Sun Oct 16 04:38:44 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.