Repository navigation
feat(cubejs): refresh-worker liveness endpoint for a stalled scheduler - #94
Merged
Merged
Conversation
Cube's scheduler skips a tick while the previous interval is still running and has no timeout, so a hung interval (dev, 2026-10-08) stopped pre-aggregation refresh for every tenant for 4.5 days with no error and no restart. The only liveness check was pgrep. scheduledRefreshContexts is called at the start of every interval, so it now records a heartbeat. GET /scheduler-health returns 503 (and logs why) once no interval has started for 30 minutes; the worker's liveness probe can then restart it. Mounted only where the scheduler runs, so API pods (scheduled refresh off) don't expose it. Normal intervals on dev take 1-5 minutes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Cube's refresh scheduler skips a tick while the previous interval is still running, and intervals have no timeout. A hung interval on dev (2026-10-08, root cause fixed in #93) stopped pre-aggregation refresh for every tenant for 4.5 days with no error and no restart. The worker's only liveness check was
pgrep.What
scheduledRefreshContextsruns at the start of every interval, so it now records a heartbeat.GET /scheduler-healthreturns503and logsRefresh scheduler stalled: no interval started for Nmonce no interval has started for 30 min. Normal dev intervals take 1–5 min; the worst seen in 5 days was 5:18.CUBEJS_SCHEDULED_REFRESH=false, so they don't expose it. The path is outside/api, so nginx doesn't proxy it.Rollout order
Deploy this image first. Then the fraios infra PR switches the refresh-worker
livenessProbefrompgreptohttpGet /scheduler-healthand adds the Prometheus alerts. Switching the probe before this image is live would 404 and restart-loop the worker.Test
src/utils/__tests__/scheduledRefreshStall.test.jsmocks timers and makes the datasource lookup hang, as it did on dev. It checks that the endpoint stays healthy at 29 min, reports a stall at 31 min, resets when a new interval starts even though that interval then hangs, and stalls again 31 min later. Cubejs suite: 701/703; the 2 failures are the existingruntimeDependencyHardeninglocal-install checks.🤖 Generated with Claude Code