Skip to content

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
@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