[cpp-xmltooling] branch master updated: CPPXT-116 - Apache 2.4 / Shibboleth Deadlock

Scott Cantor cantor.2 at osu.edu
Fri Jan 5 16:26:24 EST 2018


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

scantor pushed a commit to branch master
in repository cpp-xmltooling.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-xmltooling.git;a=commit;h=41d6804b8a86291a9833d1a8c8af6b13042cc467

The following commit(s) were added to refs/heads/master by this push:
       new  41d6804   CPPXT-116 - Apache 2.4 / Shibboleth Deadlock
41d6804 is described below

commit 41d6804b8a86291a9833d1a8c8af6b13042cc467
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: 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");

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list