Skip to content

Avoid a deadlock in DBusConnection.HandleMessage - #113

Merged
tmds merged 1 commit into
tmds:masterfrom
qmfrederik:fix/callmethod-deadlock
Dec 21, 2021
Merged

Avoid a deadlock in DBusConnection.HandleMessage#113
tmds merged 1 commit into
tmds:masterfrom
qmfrederik:fix/callmethod-deadlock

Conversation

@qmfrederik

Copy link
Copy Markdown
Contributor

DBusConnection.HandleMessage will invoke TaskCompletionSource<Message>.SetResult. This can cause the continuation of that task completion source to be invoked synchronously. This can cause the calling code (i.e. code which invoked a D-Bus method using Tmds.DBus) to delay or block the execution of the HandleMessage method and, as such, the entire D-Bus message loop.

Specify TaskCreationOptions.RunContinuationsAsynchronously when creating the TaskCompletionSource helps avoid this issue.

`DBusConnection.HandleMessage` will invoke `TaskCompletionSource<Message>.SetResult`. This can cause the continuation of that task completion source to be invoked synchronously. This can cause the calling code (i.e. code which invoked a D-Bus method using Tmds.DBus) to delay or block the execution of the `HandleMessage` method and, as such, the entire D-Bus message loop.

Specify `TaskCreationOptions.RunContinuationsAsynchronously` when creating the `TaskCompletionSource` helps avoid this issue.
@tmds

tmds commented Dec 21, 2021

Copy link
Copy Markdown
Owner

Thank you, @qmfrederik!

@tmds
tmds merged commit 26deb68 into tmds:master Dec 21, 2021
@tmds

tmds commented Jan 25, 2022

Copy link
Copy Markdown
Owner

This is part of 0.10.1 which was just published to nuget.org.

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