1
0
mirror of https://github.com/aziascreations/BakaShrot.git synced 2026-11-23 20:58:46 +01:00

Fix the server on Linux, and test races it showed

Server:
- Storage: #BakaShrot_Storage_SqliteLibrary, the SQLite the server loads:
  sqlite3.dll on Windows, the system's libsqlite3.so.0 on Linux (PB 5.73's
  bundled 3.33 has no JSON functions). The query error check and the
  writer's prepared statements use it too, so a JSON function on a row
  that isn't JSON is refused on Linux as well, not answered with no rows.
- SendPacket: SendNetworkData() returns -1 once the send buffer is full
  (EAGAIN on Linux), which aborted clients reading big answers. Retried
  until nothing goes out for #BakaShrot_SendStallTimeout (10 s).

Tests, timing they relied on:
- Attachments, BigMessages: link failures before the first link are
  expected, Linux refuses at once where Windows retries for ~1 s.
- Restart: a pusher whose server is killed between two pushes sees 100
  (NotConnected), during one 104 (ConnectionLost): both accepted.
- Retention: deletions counted over every retention check, a batch can be
  split over two.
- AttachmentEdges: waits for B's corrupted attachment to be dropped, A
  sends it again at every check-in.

All tests pass on Linux with PB 6.41 (asm and C backends).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RwFeVQCBfcPDfAPqX8z2TF
This commit is contained in:
2026-11-10 15:32:22 +01:00
parent 488ffe4bc8
commit 5270f25ac1
9 changed files with 103 additions and 37 deletions
+4 -2
View File
@@ -212,7 +212,9 @@ try {
Start-Sleep -Seconds 3 # A goes on alone
Stop-Pusher $PK
$KSeen = Read-Pusher $PK
Check "the garage pusher noticed B was gone: ConnectionLostError, code 104" ($PG.P.HasExited -and (Read-Pusher $PG).End -like "ERR 104 ConnectionLostError*") (Read-Pusher $PG).End
# 104 (ConnectionLost) if killed during a push, 100 (NotConnected) if
# between two: the next push finds the connection already gone.
Check "the garage pusher noticed B was gone: ConnectionLostError, code 104 or 100" ($PG.P.HasExited -and (Read-Pusher $PG).End -match "^ERR 10[04] ConnectionLostError") (Read-Pusher $PG).End
Check "kitchen kept pushing on A meanwhile" ($KSeen.Count -gt 100 -and $KSeen.End -eq "STOPPED") ("{0} acknowledged" -f $KSeen.Count)
$SB = Start-Srv "b"; Wait-Port 12416 $SB
@@ -256,7 +258,7 @@ try {
Start-Sleep -Seconds 3 # B goes on alone
Stop-Pusher $PG
$GSeen = Read-Pusher $PG
Check "the kitchen pusher noticed A was gone: ConnectionLostError, code 104" ($PK.P.HasExited -and (Read-Pusher $PK).End -like "ERR 104 ConnectionLostError*") (Read-Pusher $PK).End
Check "the kitchen pusher noticed A was gone: ConnectionLostError, code 104 or 100" ($PK.P.HasExited -and (Read-Pusher $PK).End -match "^ERR 10[04] ConnectionLostError") (Read-Pusher $PK).End
$SA = Start-Srv "a"; Wait-Port 12415 $SA
Check-Survived "A" "kitchen" $PK $OnA