Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.0.4-alpha
-
None
-
None
-
Reviewed
Description
The DN hearbeat loop looks roughly like this:
if (now - timeOfLastHeartbeat > configuredHeartbeatInterval) { // do heartbeat } timeToWait = configuredHeartbeatInterval - (now - timeOfLastHeartbeat) sleep(timeToWait)
The trouble is that since we sleep for exactly the heartbeat interval, and then check to see if we have waited more than that heartbeat interval, we will very often have waited exactly the heartbeat interval (in millis), and not more than it. In this case we will skip actually performing the heartbeat and will calculcate timeToWait as being 0ms. The DN heartbeat loop will then loop tightly for 1ms. The solution is just to change the ">" in the code above to ">=".