fix(data): close concurrency and cleanup gaps found in review
- SQLite restore holds every pool slot instead of the write lock first, removing a lock-order deadlock with sessions that begin to write. - PostgreSQL sessions always return their connection on dispose, a rollback while disposing never masks the original exception, and a busy session keeps its transaction until it is discarded. - The pool disposes a connection whose health check the caller cancels. - Listener commands keep their lock until the server answers and never tear a write with the caller's token; closing and pending no longer race. - Tag replacement locks the sequence and the tag row; unused-tag cleanup locks candidates and re-checks them with a fresh snapshot; render counts and stats refreshes lock the sequence row on PostgreSQL. - Sequence upserts keep rendered_count, which renders maintain. - AuthenticationOk after an unfinished SCRAM exchange is rejected. - Oversized read buffers are released; failed backups leave no .tmp; a zero idle lifetime is rejected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
17 files changed
+240
-61
No files matched your search
@@ -26,6 +26,9 @@ internal sealed class ScramSha256
|
||||
|
||||
public const string Mechanism = "SCRAM-SHA-256";
|
||||
|
||||
/// <summary>The server proved knowledge of the password with a valid final signature.</summary>
|
||||
public bool IsServerVerified { get; private set; }
|
||||
|
||||
public byte[] ClientFirstMessage()
|
||||
{
|
||||
_clientFirstBare = $"n={_username},r={_clientNonce}";
|
||||
@@ -71,6 +74,7 @@ internal sealed class ScramSha256
|
||||
if (_expectedServerSignature is null || value is null
|
||||
|| !CryptographicOperations.FixedTimeEquals(Convert.FromBase64String(value), _expectedServerSignature))
|
||||
throw new AuthenticationException("The server's SCRAM signature is invalid.");
|
||||
IsServerVerified = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user