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 premature completion of async operations (#66) #67

Merged
merged 1 commit into from
Feb 10, 2016

Conversation

nayato
Copy link
Member

@nayato nayato commented Feb 10, 2016

Motivation:
Due to misuse of IEventExecutor.SubmitAsync in
DefaultChannelHandlerInvoker and Bootstrap, async operations return future
that is completed after first sync part of operation is through.

Modifications:
DefaultChannelHandlerInvoker and Bootstrap are modified to complete
returned future only after the whole async operation is completed.

Result:
chaining async operations does not result in intermittent failures due to
premature access to channel, errors potentially appearing in later stages
of async operations are also properly reported through failure of the
future.

Motivation:
Due to misuse of IEventExecutor.SubmitAsync in
DefaultChannelHandlerInvoker and Bootstrap, async operations return future
that is completed after first sync part of operation is through.

Modifications:
DefaultChannelHandlerInvoker and Bootstrap are modified to complete
returned future only after the whole async operation is completed.

Result:
chaining async operations does not result in intermittent failures due to
premature access to channel, errors potentially appearing in later stages
of async operations are also properly reported through failure of the
future.
@@ -34,6 +34,11 @@ public bool setUncancellable()
return true;
}

public override string ToString()
{
return "TaskCompletionSource[status: " + this.Task.Status.ToString() + "]";
Copy link

Choose a reason for hiding this comment

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

  • .ToString() is redundant, right? It should auto-convert based on inferring the '+' op

Copy link
Member Author

Choose a reason for hiding this comment

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

it's Concat(string..) vs Concat(object..). I prefer to explicitly call ToString to avoid hidden boxing. In this case though, it'll get boxed anyway (Enum.ToString() issue) but this is for debugging / unhappy path logging only anyway.

@manusr
Copy link

manusr commented Feb 10, 2016

lgtm

nayato added a commit that referenced this pull request Feb 10, 2016
Fixes premature completion of async operations (#66)
@nayato nayato merged commit 21a8dc1 into Azure:dev Feb 10, 2016
@nayato nayato deleted the fixfuture branch May 6, 2016 02:13
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.

3 participants