Mqttnet: Disconnect behavior throws exception on worker thread

Created on 30 Mar 2020  路  4Comments  路  Source: chkr1011/MQTTnet

we have a bug in our app where we aren't passing messages through to a broken and back properly, so we time out. We are the client, using MqttNet. On a timeout we attempt to close the client (via _client.DisconnectAsync()) and then we dispose it. Some time later the app crashes with an exception on a worker thread, related to the fact that when MqttNet closes a socket it might get an 'object disposed' exception from system worker threads related to when the socket was previously open. Here is what stack overflow says about having to explicitly deal with this issue:

https://stackoverflow.com/questions/37135733/after-disposing-async-socket-net-callbacks-still-get-called

bug

All 4 comments

This is a known issue. It is hard to fix (as you can see in the stackoverflow post). Please try the upcoming 3.0.9-rc2. We made some changes in order to catch those exceptions.

@LADSoft Would you consider this as fixed now?

will check it out tomorrow.

it seems to work ok.

Was this page helpful?
0 / 5 - 0 ratings