fix(watchdog): make HUB-3 goroutine alerts diagnosable and load-aware #103
No reviewers
Labels
No labels
blocked
bug
dependencies
documentation
duplicate
enhancement
github_actions
go
good first issue
help wanted
in-progress
invalid
question
ready-to-fix
source:discord
source:sentry
source:server-logs
triage-needed
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pokebedrock/pokebedrock-hub!103
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/hub-3-watchdog-dump"
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?
Fixes POKEBEDROCK-HUB-3
Root cause
HUB-3 (789 events, release
24378cf, ns1018631) is not a monotonic leak. Over Oct 11-13 the reported count swings both ways within minutes: 1498 -> 1126 -> 832 in 33 min on Oct 11, and 1514 at 11:34Z today after 832 at 10:16Z. It tracks the daily player curve. A leak only grows until restart. The audited spawn sites (infliction/rank/player-details workers, the per-join delayed loaders, NetherNet ConnContext 20s) are bounded or cancelled, and every HTTP client has a timeout. So the fixed 800 threshold fires on normal peak load, because each RakNet/NetherNet session (pion ICE/DTLS/SCTP) owns several goroutines.We could not confirm this from stacks because the goroutine dump never reached Sentry. Sentry's server-side scrubber replaces
contexts.watchdog.goroutine_dumpwith[Filtered]on every event. The Oct 11 heap blowup (14-33 GB) is a separate signal (heap_pressure) and is not explained by this PR.Change
goroutines.txtSentry attachment (not scrubbed), so the next breach carries real stacks.playersin the watchdog context and log line.[Watchdog] GoroutinesPerPlayerheadroom (limit = GoroutineThreshold + N*players). It defaults to 0, so alerting behaviour is unchanged until it's configured.Testing
go build ./...andgo test ./pokebedrock/watchdog/pass locally.Risks
Do not merge or deploy without Smell of Curry's OK.
Desk review @
adf515f7— COMMENT (hold for Curry)Scope is tight and matches the title. Attachment dump for HUB-3 is the right fix for the scrubbed
contexts.watchdog.goroutine_dump,playersin log/context is useful, andGoroutinesPerPlayerdefaulting to 0 keeps alerting behaviour unchanged until configured.poke.srv.PlayerCountis a real*Servermethod value; nil-safe hook is fine.Not a full HUB-3 fix on merge alone
With default config this only makes the next breach diagnosable. Peak-load noise at the fixed 800 threshold continues until
GoroutinesPerPlayeris set after the first attachment shows per-session cost. PR body already says not to merge/deploy without Smell of Curry's OK — desk will not merge.Same-repo Forgejo issues
Open hub issues (#93 quest UI, #86 parkour, #77 Discord roles, #55 restart status) do not match this diff.
Fixes POKEBEDROCK-HUB-3is Sentry, not a Forgejo issue — noFixes:/Could Fix:link comment.CI
No commit statuses on
adf515f7yet (Forgejo Actions API returned empty for this head). Local claim in the PR body is fine; do not treat as merge-ready from CI alone.Should fix (inline)
TestEvaluatehas noGoroutinesPerPlayercases — the new limit path is the point of the PR andevaluateis already the pure harness.Startdoes not logGoroutinesPerPlayer— operators will want that when it is non-zero.Nits
goroutines/playersbut not the computedgoroutine_limit; cheap and helps once GPP is live.GoroutinesPerPlayerin config would lower the threshold; clamp at 0 if you care.Not approving. Not merging.
Nit: log
goroutines_per_player(and maybe that the effective limit isthreshold + N*players) on start when non-zero. Right now startup only prints the fixed threshold, so a live GPP config is invisible in the boot line.@ -259,3 +282,4 @@ctx := sentry.Context{"goroutines": s.goroutines,"players": s.players,Nit: include
goroutine_limit: w.goroutineLimit(s)in this context (and maybe the log attrs above). Once GPP is set, Sentry events with only rawgoroutines/playersforce a mental multiply to see why it fired or did not.Should fix: add
GoroutinesPerPlayercases here. Example: confGoroutineThreshold=800, GoroutinesPerPlayer=5, snapshotgoroutines=900, players=100must not alert (limit 1300);goroutines=1300, players=100must alert;players=0keeps the fixed threshold. Also one nil/PlayerCountunused path if you exerciseplayerCount()viarunChecklater — at minimum coverevaluate+goroutineLimit.Desk review @
cccc9632— COMMENT (hold for Curry)Follow-up to review 3137 @
adf515f7. New commits24628fe3+cccc9632address every should-fix and nit from that pass:TestEvaluateGoroutinesPerPlayer/ negative clamp / nilPlayerCounthookStartlogsgoroutines_per_playergoroutine_limitGoroutinesPerPlayerclamped to 0 inwithDefaultsDiff still matches the title: attachment dump for HUB-3 scrubbing,
playersin log/context, optional scaled limit defaulting to 0.goroutineDumpremains capped at 1 MiB. No new findings.Still not a full HUB-3 fix on merge alone
Default config keeps the fixed 800 threshold; peak-load noise continues until Curry sets
GoroutinesPerPlayerafter a real attachment. HUB-3 stays watch-only. PR body: do not merge/deploy without Smell of Curry's OK — desk will not merge.Same-repo Forgejo issues
Open hub issues (#93 quest UI, #86 parkour, #77 Discord roles, #55 restart status) still do not match.
Fixes POKEBEDROCK-HUB-3is Sentry only — noFixes:/Could Fix:link comment.CI
No commit statuses on
cccc9632yet (Forgejo statuses API empty for this head). Localgo test ./pokebedrock/watchdog/claim stands; do not treat as merge-ready from CI alone.Not approving. Not merging.
Desk review @
cccc963— COMMENT (hold for Curry)Follow-up to review 3137 @
adf515f7(now stale). Commits24628fe+cccc963address the should-fix and nits:TestEvaluateGoroutinesPerPlayer/ negative clamp / nilPlayerCounthook coverage looks correct (scaled limit 800+3*200; GPP=0 keeps fixed threshold).Startlogsgoroutines_per_player.goroutine_limit.withDefaults.Local
go test ./pokebedrock/watchdog/passes on this head.Still hold
Default config is still diagnose-only (attachment dump). Peak-load noise at fixed 800 continues until
GoroutinesPerPlayeris set after the first real attachment. PR body already says not to merge/deploy without Smell of Curry's OK — desk will not merge.Same-repo Forgejo issues
Open hub issues (#93, #86, #77, #55) still do not match.
Fixes POKEBEDROCK-HUB-3remains Sentry-only — no newFixes:/Could Fix:comment.CI
Hub Actions is release-on-
mainonly; no commit statuses on this head (same as prior review). Do not treat as merge-ready from CI.Soft nit (optional)
config.example.toml[Watchdog]still omitsGoroutinesPerPlayer— operators copying the example will not see the new knob. Not blocking.Not approving. Not merging.
Desk review @
cccc9632— COMMENT (hold for Curry)Follow-up commits
24628fe/cccc963address review 3137:TestEvaluateGoroutinesPerPlayer+ nil-hook/negative-clamp tests,Startlogsgoroutines_per_player, Sentry context includesgoroutine_limit, and negative GPP is clamped inwithDefaults.go test ./pokebedrock/watchdog/passes on this head.Still not a full HUB-3 fix on merge alone
Default
GoroutinesPerPlayer=0keeps the fixed 800 threshold. Peak-load noise continues until GPP is set from a real attachment. PR body still requires Smell of Curry's OK — desk will not merge or deploy.Same-repo Forgejo issues
Open hub issues (#93 quest UI, #86 parkour, #77 Discord roles, #55 restart status) still do not match this diff.
Fixes POKEBEDROCK-HUB-3is Sentry-only — noFixes:/Could Fix:link comment.Remaining nit
config.example.toml[Watchdog]still omitsGoroutinesPerPlayer(struct field is documented). Worth a one-liner so operators discover the knob.Not approving. Not merging.
Nit:
config.example.toml[Watchdog]still has noGoroutinesPerPlayerline. A commentedGoroutinesPerPlayer = 0(or a short note that N adds headroom per online player) would match the struct docs so operators can find the knob after the first attachment dump.