Repository navigation
streaming: wait 125% of the child reboot time before reporting it offline - #24343
Conversation
…line MAX_CHILD_DISC_TOLERANCE was (125 / 100), which is 1 in integer arithmetic, so the parent waited 100% of the child's reboot time instead of the intended 125% before telling Cloud the child is offline. Compute the delay as reboot time * 125 / 100, capped at 30s, and floor every schedule_node_state_update() delay at 10ms so a child with no reboot time does not arm a 0ms libuv timer.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
No issues found across 2 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant CHILD as Child Node
participant PARENT as Parent Stream Receiver
participant SCHED as schedule_node_state_update()
participant QUEUE as ACLK Sync Queue
participant CLOUD as Netdata Cloud
Note over CHILD,CLOUD: Child Disconnect Detection and State Update Flow
CHILD-->>PARENT: CHANGED: Disconnect detected
PARENT->>PARENT: rrdhost_clear_receiver()
PARENT->>PARENT: Clear online flag
PARENT->>PARENT: Read total reboot time from stream path
alt CHANGED: Reboot time present
PARENT->>PARENT: CHANGED: Cap reboot time at 30s (MAX_CHILD_DISC_DELAY)
PARENT->>PARENT: CHANGED: Calculate delay = reboot × 125 / 100, cap at 30s
else No reboot time (0ms)
PARENT->>PARENT: CHANGED: Delay = 0
end
PARENT->>SCHED: schedule_node_state_update(host, delay)
SCHED->>SCHED: CHANGED: Floor delay at 10 ms (NODE_STATE_UPDATE_MIN_DELAY_MS)
SCHED->>QUEUE: queue_aclk_sync_cmd(ACLK_DATABASE_NODE_STATE, host, delay)
alt Delay elapsed (happy path)
QUEUE-->>CLOUD: Report child offline
else CHANGED: Child reconnects within 25% tolerance window
CHILD-->>PARENT: Reconnect
PARENT->>QUEUE: Cancel pending offline update
QUEUE-->>CLOUD: Keep child online
end
|
thiagoftsm
left a comment
There was a problem hiding this comment.
Streaming is working with notification of offline appearing as expected. LGTM!
…line (netdata#24343) MAX_CHILD_DISC_TOLERANCE was (125 / 100), which is 1 in integer arithmetic, so the parent waited 100% of the child's reboot time instead of the intended 125% before telling Cloud the child is offline. Compute the delay as reboot time * 125 / 100, capped at 30s, and floor every schedule_node_state_update() delay at 10ms so a child with no reboot time does not arm a 0ms libuv timer. (cherry picked from commit 9fbc835)
…line (#24343) MAX_CHILD_DISC_TOLERANCE was (125 / 100), which is 1 in integer arithmetic, so the parent waited 100% of the child's reboot time instead of the intended 125% before telling Cloud the child is offline. Compute the delay as reboot time * 125 / 100, capped at 30s, and floor every schedule_node_state_update() delay at 10ms so a child with no reboot time does not arm a 0ms libuv timer. (cherry picked from commit 9fbc835)



Summary
When a child disconnects, the parent waits before telling Cloud the child is offline. The intended wait is 125% of the child's reboot time, capped at 30 s (#18712). However,
MAX_CHILD_DISC_TOLERANCEwas(125 / 100), which is integer1, so the parent waited only 100%. A child that reconnects in the remaining 25% window caused an avoidable offline/online pair in Cloud.The change:
schedule_node_state_update()delay at 10 ms. A child with no reboot time otherwise armed a 0 ms libuv timer, which Avoid zero timeout in libuv timers #19810 avoided for the other callers.Test Plan
Summary by CodeRabbit