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

[PATCH] Fix locking-related segfaults and deadlocks in the SWIG Python bindings

From: David James <james82_at_gmail.com>
Date: 2005-10-18 08:32:54 CEST

This patch should fix the segfaults reported by Marc Haesen and Max
Bowsher when using the Python bindings with ViewCVS in mod_python
mode. I haven't tested this patch with mod_python yet, so please let
me know if it helps.

If you are using Python 2.3, this patch additionally solves a
theoretical deadlock bug in the Python bindings where the bindings
could hang if the same thread tried to acquire the global interpreter
lock recursively.

For more information on the Python threading APIs, see:
  http://www.etsimo.uniovi.es/python/dev/doc/devel/api/threads.html

[[[

Fix locking-related segfaults in the Python bindings. If you are using Python
2.3, this patch additionally solves a theoretical deadlock bug in the Python
bindings where the bindings could hang if the same thread tried to acquire the
global interpreter lock recursively.

* subversion/bindings/swig/include/svn_types.swg
  (exception): Use Py_BEGIN_ALLOW_THREADS instead of
  svn_swig_py_release_py_lock. Use Py_END_ALLOW_THREADS instead of
  svn_swig_py_acquire_py_lock.

* subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h
  (svn_swig_py_release_py_lock, svn_swig_py_acquire_py_lock): Remove.

* subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
  (SVN_SWIG_PY_BEGIN_PYTHON_CALL, SVN_SWIG_PY_END_PYTHON_CALL):
  New.
  (svn_swig_py_release_py_lock, svn_swig_py_acquire_py_lock,
   _saved_thread_key, _saved_thread_pool): Remove.
  (threads_terminated): New variable.
  (svn_swig_py__terminate): New.
  (svn_swig_py_initialize): Initialize Python and threads. Use
  svn_swig_py__terminate in place of apr_terminate.

  (svn_swig_py_pool_destroyed, svn_swig_py_pool_decref,
   svn_swig_py_register_cleanup, close_baton, set_target_revision,
   open_root, delete_entry, add_directory, open_directory,
   change_dir_prop, close_directory, add_file, open_file,
   window_handler, apply_textdelta, change_file_prop, close_file,
   read_handler_pyio, write_handler_pyio, svn_swig_py_notify_func,
   svn_swig_py_status_func, svn_swig_py_cancel_func,
   svn_swig_py_fs_get_locks_func, svn_swig_py_get_commit_log_func,
   svn_swig_py_repos_authz_func, svn_swig_py_repos_history_func,
   svn_swig_py_log_receiver, svn_swig_py_client_blame_receiver,
   svn_swig_py_auth_simple_prompt_func, svn_swig_py_username_prompt_func,
   svn_swig_py_auth_ssl_server_trust_prompt_func,
   svn_swig_py_auth_ssl_client_cert_prompt_func,
   svn_swig_py_auth_ssl_client_cert_pw_prompt_func):
   Use SVN_SWIG_PY_BEGIN_PYTHON_CALL instead of svn_swig_py_acquire_py_lock.
   Use SVN_SWIG_PY_END_PYTHON_CALL instead of svn_swig_py_release_py_lock.

]]]

--
David James -- http://www.cs.toronto.edu/~james


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Received on Tue Oct 18 08:34:17 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.