# HG changeset patch # User Alain Mazy # Date 1589897945 -7200 # Node ID cf6eb4fc6841413b4826258477ee4bc4f52e20ed # Parent 1f33ed7f82e6dad51abb4425ea4685ead208bf0d fix issue 179: use a shared mutex to avoid deadlock in python plugins diff -r 1f33ed7f82e6 -r cf6eb4fc6841 NEWS --- a/NEWS Tue May 19 13:44:56 2020 +0200 +++ b/NEWS Tue May 19 16:19:05 2020 +0200 @@ -58,6 +58,7 @@ * Fix issue #169 (TransferSyntaxUID change from Explicit to Implicit during C-STORE SCU) * Upgraded dependencies for static builds (notably on Windows and LSB): - openssl 1.1.1g +* Fix issue #179 (deadlock in Python plugins) Version 1.6.1 (2020-04-21) diff -r 1f33ed7f82e6 -r cf6eb4fc6841 OrthancServer/ServerContext.cpp --- a/OrthancServer/ServerContext.cpp Tue May 19 13:44:56 2020 +0200 +++ b/OrthancServer/ServerContext.cpp Tue May 19 16:19:05 2020 +0200 @@ -84,7 +84,7 @@ { const ServerIndexChange& change = dynamic_cast(*obj.get()); - boost::recursive_mutex::scoped_lock lock(that->listenersMutex_); + boost::shared_lock lock(that->listenersMutex_); for (ServerListeners::iterator it = that->listeners_.begin(); it != that->listeners_.end(); ++it) { @@ -331,7 +331,7 @@ if (!done_) { { - boost::recursive_mutex::scoped_lock lock(listenersMutex_); + boost::unique_lock lock(listenersMutex_); listeners_.clear(); } @@ -418,7 +418,7 @@ bool accepted = true; { - boost::recursive_mutex::scoped_lock lock(listenersMutex_); + boost::shared_lock lock(listenersMutex_); for (ServerListeners::iterator it = listeners_.begin(); it != listeners_.end(); ++it) { @@ -508,7 +508,7 @@ if (status == StoreStatus_Success || status == StoreStatus_AlreadyStored) { - boost::recursive_mutex::scoped_lock lock(listenersMutex_); + boost::shared_lock lock(listenersMutex_); for (ServerListeners::iterator it = listeners_.begin(); it != listeners_.end(); ++it) { @@ -858,7 +858,7 @@ #if ORTHANC_ENABLE_PLUGINS == 1 void ServerContext::SetPlugins(OrthancPlugins& plugins) { - boost::recursive_mutex::scoped_lock lock(listenersMutex_); + boost::unique_lock lock(listenersMutex_); plugins_ = &plugins; @@ -871,7 +871,7 @@ void ServerContext::ResetPlugins() { - boost::recursive_mutex::scoped_lock lock(listenersMutex_); + boost::unique_lock lock(listenersMutex_); plugins_ = NULL; diff -r 1f33ed7f82e6 -r cf6eb4fc6841 OrthancServer/ServerContext.h --- a/OrthancServer/ServerContext.h Tue May 19 13:44:56 2020 +0200 +++ b/OrthancServer/ServerContext.h Tue May 19 16:19:05 2020 +0200 @@ -203,7 +203,7 @@ #endif ServerListeners listeners_; - boost::recursive_mutex listenersMutex_; + boost::shared_mutex listenersMutex_; bool done_; bool haveJobsChanged_;