[xmltooling] 18/24: CPPXT-116 - Apache 2.4 / Shibboleth Deadlock

Etienne Dysli Metref edm-guest at moszumanska.debian.org
Fri Jan 12 15:53:58 UTC 2018


This is an automated email from the git hooks/post-receive script.

edm-guest pushed a commit to branch master
in repository xmltooling.

commit 41d6804b8a86291a9833d1a8c8af6b13042cc467
Author: Scott Cantor <cantor.2 at osu.edu>
Date:   Fri Jan 5 16:26:22 2018 -0500

    CPPXT-116 - Apache 2.4 / Shibboleth Deadlock
    
    https://issues.shibboleth.net/jira/browse/CPPXT-116
    
    Attempt to fix the fix, wrap the stat calls in a conditional.
---
 xmltooling/util/ReloadableXMLFile.cpp | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/xmltooling/util/ReloadableXMLFile.cpp b/xmltooling/util/ReloadableXMLFile.cpp
index d296ca8..6ffcf04 100644
--- a/xmltooling/util/ReloadableXMLFile.cpp
+++ b/xmltooling/util/ReloadableXMLFile.cpp
@@ -289,25 +289,27 @@ void* ReloadableXMLFile::reload_fn(void* pv)
             r->m_reload_wait->timedwait(mutex.get(), r->m_reloadInterval);
         if (r->m_shutdown)
             break;
-		
+
+        if (r->m_local) {
 #ifdef WIN32
-        struct _stat stat_buf;
-        if (_stat(r->m_source.c_str(), &stat_buf) != 0)
-            continue;
+            struct _stat stat_buf;
+            if (_stat(r->m_source.c_str(), &stat_buf) != 0)
+                continue;
 #else
-        struct stat stat_buf;
-        if (stat(r->m_source.c_str(), &stat_buf) != 0)
-	    continue;
+            struct stat stat_buf;
+            if (stat(r->m_source.c_str(), &stat_buf) != 0)
+                continue;
 #endif
-        if (r->m_filestamp >= stat_buf.st_mtime)
-            continue;
-
-        // Grab lock to protect m_filestamp.
-        r->m_log.debug("timestamp of local resource changed, obtaining write lock");
-        r->m_lock->wrlock();
-        r->m_filestamp = stat_buf.st_mtime;
-        r->m_log.debug("timestamp of local resource changed, releasing write lock");
-        r->m_lock->unlock();
+            if (r->m_filestamp >= stat_buf.st_mtime)
+                continue;
+
+            // Grab lock to protect m_filestamp.
+            r->m_log.debug("timestamp of local resource changed, obtaining write lock");
+            r->m_lock->wrlock();
+            r->m_filestamp = stat_buf.st_mtime;
+            r->m_log.debug("timestamp of local resource changed, releasing write lock");
+            r->m_lock->unlock();
+        }
 		
         try {
             r->m_log.info("reloading %s resource...", r->m_local ? "local" : "remote");

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-shibboleth/xmltooling.git



More information about the Pkg-shibboleth-devel mailing list