You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: replace lock() with SemaphoreSlim in ChatSession, SessionManager bundle lock, and GroupSession
- ChatSession: introduce _historyLock (SemaphoreSlim) to replace lock(_messageHistory) in GetMessageHistory, GetMessageCount, and ClearMessageHistoryInternal; remove incorrect lock(_sessionLock) in SetMetadata since Metadata is already ConcurrentDictionary; dispose _historyLock in Dispose()
- SessionManager: change _localBundleLock from object to SemaphoreSlim(1,1); replace all four lock(_localBundleLock) blocks with Wait()/WaitAsync()+Release() patterns; use await WaitAsync in ReplenishOPKsAsync (async method); dispose _localBundleLock in Dispose()
- GroupSession: change _seenMessageIds value type from HashSet<string> to ConcurrentDictionary<string, byte> (concurrent set); remove lock(senderMessageIds) blocks in ValidateGroupMessage and RecordMessageSeen; use TryAdd/ContainsKey for thread-safe check-and-add
- Add ChatSession_ConcurrentHistoryAccess_DoesNotDeadlock test
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
0 commit comments