Linux.Bluetooth icon indicating copy to clipboard operation
Linux.Bluetooth copied to clipboard

Dead lock issue with DisconnectAsync()

Open agardiol opened this issue 2 years ago • 6 comments

Hello,

While using this library we have sometimes a dead lock situation while calling Device.DisconnectAsync(). We tried to ignore this by avoiding to await on this function but in this case, the dead lock occurs later while trying to force the Adapter to remove the device from it's internal list (Adapter.RemoveDeviceAsync(Device)).

It seems to be an issue related to bluez since if we kill our software and try to manually remove or disconnect the device with bluetoothctl, we get a "org.bluez.Error.Busy" (in fact each commands return this error).

Did you already see such dead lock behavior ?

Thanks by advance and best regards. Antoine

agardiol avatar Apr 04 '24 08:04 agardiol

@agardiol, may I ask, if your application is doing anything else during this call to Disconnect?

I ask because the only time it happened to me was when we were performing a lot of advertisement calls in a fast-running loop and didn't stop other operations and BlueZ itself was overloaded.

DamianSuess avatar Apr 04 '24 23:04 DamianSuess

Thanks for your answer. As far as I know, we did not do anything asynchronously. I will check with my colleague asap (but he is out of the office for 4 days).

agardiol avatar Apr 05 '24 09:04 agardiol

Sounds good, thanks for checking with them. Have a wonderful weekend if I don't talk with you till then

DamianSuess avatar Apr 05 '24 13:04 DamianSuess

Thanks, you too

agardiol avatar Apr 05 '24 13:04 agardiol

Hello @DamianSuess, I am working with @agardiol and I can confirm that we make sure to avoid doing anything asynchronously during this DisconnectAsync() call.

For info, we are working on multiple Raspberry Pi 4, all with BlueZ 5.66. One thing we noticed is that it seems to happen more often on devices with the latest Linux 6.6.20 installed than on older devices with Linux 6.1.0. But we're not sure if it's really linked.

5CoVK avatar Apr 11 '24 09:04 5CoVK

@agardiol and @5CoVK I updated the package to use the latest Tmds.DBus (v0.20).

Give it a shot and let me know if you're still running into this issue.

DamianSuess avatar Sep 07 '24 17:09 DamianSuess