mirror of
https://github.com/lukaszraczylo/traefikoidc.git
synced 2026-10-12 04:04:26 +00:00
fix: prevent deadlock in SessionData.Clear method (#114)
Move mutex unlock before calling Save() to prevent potential deadlock when Save() method needs to acquire the same mutex. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <[email protected]>
This commit is contained in:
+3
-2
@@ -1548,9 +1548,10 @@ func (sd *SessionData) Clear(r *http.Request, w http.ResponseWriter) error {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
sd.sessionMutex.Lock()
|
sd.sessionMutex.Lock()
|
||||||
defer sd.sessionMutex.Unlock()
|
|
||||||
|
|
||||||
sd.clearAllSessionData(r, true)
|
sd.clearAllSessionData(r, true)
|
||||||
|
|
||||||
|
// Release the lock before calling Save to prevent deadlock
|
||||||
|
sd.sessionMutex.Unlock()
|
||||||
|
|
||||||
// This is primarily for testing - in production w will often be nil
|
// This is primarily for testing - in production w will often be nil
|
||||||
var err error
|
var err error
|
||||||
|
|||||||
Reference in New Issue
Block a user