{"record":{"id":"930695c2bd5eb962","repo":"nats-io/nats-server","slug":"falling-behind-in-health-check-commit-d-appli","errorCode":null,"errorMessage":"Falling behind in health check, commit %d != applied %d","messagePattern":"Falling behind in health check, commit (.+?) != applied (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/raft.go","lineNumber":2196,"sourceCode":"\tif startDelta := n.commit - n.applied; startDelta > 0 {\n\t\tfor i := 0; i < 10; i++ { // 10ms, in 1ms increments\n\t\t\tn.Unlock()\n\t\t\ttime.Sleep(time.Millisecond)\n\t\t\tn.Lock()\n\t\t\tif n.State() == Closed {\n\t\t\t\tn.debug(\"Node closed during health check, returning not current\")\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif n.commit-n.applied < startDelta {\n\t\t\t\t// The gap is getting smaller, so we're making forward progress.\n\t\t\t\tclearBehindState()\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\n\tn.hcbehind = true\n\tn.warn(\"Falling behind in health check, commit %d != applied %d\", n.commit, n.applied)\n\treturn false\n}\n\n// Current returns if we are the leader for our group or an up to date follower.\nfunc (n *raft) Current() bool {\n\tif n == nil {\n\t\treturn false\n\t}\n\tn.Lock()\n\tdefer n.Unlock()\n\treturn n.isCurrent(false)\n}\n\n// Healthy returns if we are the leader for our group and nearly up-to-date.\nfunc (n *raft) Healthy() bool {\n\tif n == nil {\n\t\treturn false\n\t}","sourceCodeStart":2178,"sourceCodeEnd":2214,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/raft.go#L2178-L2214","documentation":"isCurrent detected commit > applied and the gap did not shrink after polling for up to 10x1ms — the state machine is not consuming committed entries. The node is flagged not-current (hcbehind set), which affects health reporting and can trigger leader replacement.","triggerScenarios":"Thrown at server/raft.go:2196 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Profile what is blocking the apply loop (slow consumers, blocked callbacks, CPU starvation)","Scale or tune the upper layer draining the apply queue","Check for paused apply queues that were never resumed"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}