[cpp-sp] branch main updated: Further _DEBUG lock instrumentation.

Codeberg noreply at shibboleth.net
Thu Sep 3 16:07:14 UTC 2026


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

codeberg pushed a commit to branch main
in repository cpp-sp.

View the commit online:
https://codeberg.org/Shibboleth/cpp-sp/commit/d6e1bfb10978c3fc92e09c980f5be32ba2bc0295

The following commit(s) were added to refs/heads/main by this push:
     new d6e1bfb1 Further _DEBUG lock instrumentation.
d6e1bfb1 is described below

commit d6e1bfb10978c3fc92e09c980f5be32ba2bc0295
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Thu Sep 3 12:07:02 2026 -0400

    Further _DEBUG lock instrumentation.
---
 shibsp/session/impl/AbstractSessionCache.cpp | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/shibsp/session/impl/AbstractSessionCache.cpp b/shibsp/session/impl/AbstractSessionCache.cpp
index ce3e7559..59752e67 100644
--- a/shibsp/session/impl/AbstractSessionCache.cpp
+++ b/shibsp/session/impl/AbstractSessionCache.cpp
@@ -391,7 +391,6 @@ string AbstractSessionCache::create(SPRequest& request, DDF& data)
     m_cookieManager->setCookie(request, cookieval.c_str());
 
     // Lock the cache and insert the new session.
-
 #ifdef _DEBUG
     request.debug("create locking cache to add session (%s) (released at end of method)", key.c_str());
 #endif
@@ -476,19 +475,33 @@ unique_lock<Session> AbstractSessionCache::_find(
     )
 {
     log(DEBUG_MARK, "searching local cache for session (%s)", key);
+#ifdef _DEBUG
+    log(DEBUG_MARK, "_find locking cache to locate session (%s)", key);
+#endif
 #if defined(HAVE_CXX17)
     shared_lock<shared_mutex> readlocker(m_lock);
+# ifdef _DEBUG
+    log(DEBUG_MARK, "_find holding cache read lock");
+# endif
 #elif defined(HAVE_CXX14)
     shared_lock<shared_timed_mutex> readlocker(m_lock);
+# ifdef _DEBUG
+    log(DEBUG_MARK, "_find holding cache read lock");
+# endif
 #else
     unique_lock<mutex> readlocker(m_lock);
+# ifdef _DEBUG
+    log(DEBUG_MARK, "_find holding cache exclusive lock");
+# endif
 #endif
     const auto& i = m_hashtable.find(key);
     if (i != m_hashtable.end()) {
         // Save off and lock the session.
         unique_lock<Session> session(*(i->second));
         readlocker.unlock();
-
+#ifdef _DEBUG
+        log(DEBUG_MARK, "_find released cache lock");
+#endif
         log(DEBUG_MARK, "session (%s) found locally, validating for use", key);
 
         // Cross-check application and check version for currency.
@@ -544,6 +557,9 @@ unique_lock<Session> AbstractSessionCache::_find(
     else {
         // No copy locally at all, so just fall into cache_read step below.
         readlocker.unlock();
+#ifdef _DEBUG
+        log(DEBUG_MARK, "_find released cache lock");
+#endif
         log(DEBUG_MARK, "session (%s) not found locally, loading from persistent store", key);
     }
 
@@ -569,6 +585,9 @@ unique_lock<Session> AbstractSessionCache::_find(
     unique_ptr<BasicSession> newSession(new BasicSession(*this, obj));
 
     // Lock the cache and check for a race condition with another thread...
+#ifdef _DEBUG
+    log(DEBUG_MARK, "_find locking cache to insert session (%s)", key);
+#endif
 
     // Note, the C23 standard includes a typeof operator, but until then...
 #if defined(HAVE_CXX17)
@@ -578,6 +597,9 @@ unique_lock<Session> AbstractSessionCache::_find(
 #else
     lock_guard<mutex> locker(m_lock);
 #endif
+#ifdef _DEBUG
+    log(DEBUG_MARK, "_find holding exclusive cache lock, will release at end of method");
+#endif
 
     if (m_hashtable.count(key)) {
         // There was an existing entry, but we want to swap in the "newest" copy in it's place.

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


More information about the commits mailing list