Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes race condition with AskTimeoutSpec #2450

Merged
merged 2 commits into from
Jan 13, 2017

Conversation

Aaronontheweb
Copy link
Member

close #2449

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.

Described my changes.

@@ -56,16 +56,24 @@ public AskTimeoutSpec()
var actor = Sys.ActorOf<SleepyActor>();

var actorCell = actor as ActorRefWithCell;
Assert.NotNull(actorCell);
Copy link
Member Author

Choose a reason for hiding this comment

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

Mostly to make ReSharper compiler warnings go away / throw the correct assertion error in the event that the underlying ActorCell is modified in a meaningful way in the future.

@@ -826,7 +826,8 @@ public override IActorRef GetChild(IEnumerable<string> name)
}

/// <summary>
/// TBD
/// Returns <c>true</c> if the <see cref="VirtualPathContainer"/> contains any children,
Copy link
Member Author

Choose a reason for hiding this comment

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

Filled in relevant comments.

@@ -160,7 +160,7 @@ internal static IActorRefProvider ResolveProvider(ICanTell self)
timeoutCancellation.Cancel();
timeoutCancellation.Dispose();
}
for (int i = 0; i < ctrList.Count; i++)
for (var i = 0; i < ctrList.Count; i++)
Copy link
Member Author

Choose a reason for hiding this comment

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

Style

container.ForEachChild(x => childCounter++);
Assert.True(childCounter==0,"Number of children in temp container should be 0.");
// Need to spin here, since the continuation function may not execute immediately
AwaitAssert(() =>
Copy link
Member Author

Choose a reason for hiding this comment

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

Actual fix: the FutureActorRef is not unregistered from the VirtualPathContainer until after a continuation function has a chance to run, hence we need an AwaitAssert here in case that continuation hasn't been scheduled by the time we perform the assertion the first time around.

@Horusiath Horusiath merged commit ed27e03 into akkadotnet:dev Jan 13, 2017
@Aaronontheweb Aaronontheweb deleted the fix-2449-asktimeoutspec branch January 13, 2017 21:06
@Aaronontheweb Aaronontheweb modified the milestone: 1.1.3 Jan 20, 2017
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.

Racy Spec: AskTimeoutSpec.TimedOut_ask_should_remove_temp_actor
2 participants