Client reconnects about once per second while pending approval (backoff reset on Pending) #285
Labels
No labels
Area/Backend
Area/Database
Area/Docs
Area/Frontend
Area/Infra
Area/Security
Area/Tests
Area/Tooling
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Lang/Python
Lang/Rust
Lang/Shell
Lang/SQL
Lang/TypeScript
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Routing
Auto
Routing
Hold
Routing
Human
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grimoirix/grimoire-of-digital-signage#285
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found while setting up a campus client (board GRI-2146), on
devata61eed0.What happens
A device that waits for admin approval reconnects about once per second, for as long as it is pending. It never slows down. With one PC that does not matter. With a campus full of new PCs waiting for approval at the same time, it is a steady load on the server.
Cause (from reading the code)
Sync::runincrates/client/src/sync.rsresets the backoff when a connection endsClosed { admitted: true }.admittedis set as soon as the server answers the hello, and a Pending answer counts (HelloOutcome::Pending => AfterHello::Continueinsession.rs). So every pending connection that the server closes resets the backoff toBACKOFF_BASE(1 s), and the next delay is about 0.5 to 1 s, every time.Fix
Ended::WaitLong, with a fixed, jittered wait.EnrolmentUpdateon an open connection, so a long-lived pending connection could be better than reconnecting at all.Fix pushed: PR #286 (fix/GRI-2149-backoff-reset-on-pending), commit
89e66a6.Sessionnow tracksadmitteditself — true onHelloOutcome::Acceptedor on a mid-connectionEnrolmentUpdate::Approved, false on a barePendinghello.Sync::connect_oncereadssession.is_admitted()instead of hard-codingtrue, so a still-pending device's backoff keeps growing between reconnects instead of resetting to ~1s every time.Added unit tests in
session.rscovering pending/accepted/mid-connection-approval.cargo test -p client(98 unit + 3 integration tests) andscripts/local-gates.sh --rust-onlyboth pass locally. Waiting on forge CI now.CI is green on PR #286 (commit
89e66a67): CI/clippy/deny/fmt/test/frontend/boundary/pre-push all passed. PR is open and mergeable onto dev, no conflicts. Ready for review and merge.