Skip to content

Conversation

Aaronontheweb
Copy link
Member

No description provided.

Copy link
Member Author

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Annotated PR

// handle an edge case when the Clock rolls over
// see https://github.com/akkadotnet/akka.net/issues/2581
[Fact]
public void PhiAccrualHistory_can_roll_over()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reproduction spec


namespace Akka.Remote.Tests
{
public class PhiAccrualModelBasedSpecs
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added model-based test here just to make sure all of the math was being done correctly inside the PhiAccrualFailureDetector.

/// <returns>TBD</returns>
public static readonly Clock DefaultClock = () => Environment.TickCount & Int32.MaxValue;
/// <returns>A clock instance.</returns>
public static readonly Clock DefaultClock = () => MonotonicClock.GetTicks();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Key fix to the issue here. Switched to 64 bit timer instead of the previous 32bit implementation with Environment.TickCount.

@Aaronontheweb Aaronontheweb force-pushed the fix-2581-clusterheartbeatsender branch from 20c69b5 to 01566b9 Compare April 6, 2017 16:55
var mean = history.Mean;
var stdDeviation = EnsureValidStdDeviation(history.StdDeviation);
return Phi(timeDiff, mean + AcceptableHeartbeatPauseMillis, stdDeviation);
unchecked // in the extremely rare event of a clock roll-over
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made this unchecked in the extremely rare event of a clock rollover. Realistically, this will never happen.

@Aaronontheweb
Copy link
Member Author

Deadline failure detector was using MS when it should have been using ticks, hence the failure. Fixed in latest commit.

@alexvaluyskiy alexvaluyskiy merged commit 0c36780 into akkadotnet:dev Apr 9, 2017
@Aaronontheweb Aaronontheweb deleted the fix-2581-clusterheartbeatsender branch April 10, 2017 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants