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

Set Rust callbacks to complete tasks asynchronously #279

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

cretz
Copy link
Member

@cretz cretz commented Jun 18, 2024

What was changed

We use TaskCompletionSource for callbacks from Rust threads, but resolving a task completion source in a non-.NET thread and await/continue-with in the same thread it was started in can have deadlock issues in certain situations. Setting TaskCreationOptions.RunContinuationsAsynchronously forces the task to schedule its continuation instead of running inline in same blocking thread. We now set this on every completion source callback used by Rust.

The test suite cannot easily replicate this because it is top level, but this was tested against the replication in #248.

Checklist

  1. Closes [Bug] Client hangs when waiting for calls on main thread #248

@cretz cretz requested a review from a team June 18, 2024 14:58
@cretz cretz merged commit a871164 into temporalio:main Jun 18, 2024
7 checks passed
@cretz cretz deleted the client-deadlock branch June 18, 2024 19:54
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.

[Bug] Client hangs when waiting for calls on main thread
2 participants