MQTT-Client-Framework icon indicating copy to clipboard operation
MQTT-Client-Framework copied to clipboard

a crash in here

Open RyanSprite opened this issue 6 years ago • 4 comments

Other information

image [](url)

RyanSprite avatar Sep 05 '18 02:09 RyanSprite

image and this

RyanSprite avatar Sep 05 '18 03:09 RyanSprite

Which DisptachQueue have you set for the MQTTSession? if it's global, change to something like:

DispatchQueue(label: "mqttqueue")

mvnrc avatar Sep 13 '18 07:09 mvnrc

Are you able to reproduce this issue consistently? Could you give us more details about it?

jcavar avatar Oct 15 '19 13:10 jcavar

I've also encountered similar crash in the old version. I use auth to connect the broker. When the connack is not authorized, in the delegate callback method, reconnect immediately. MQTTSession will create a new MQTTDecoder instance, and the old MQTTDecoder instance has been dealloc. at the line 131 in MQTTDecoder.m, self has been dealloc, so crash the EXC_BAD_ACCESS. NSStream.delegate is assign. In NSStreamDelegate method, MQTTDecoder retaincount is 1 (only retain by MQTTSession).

My solution: don't reconnect immediately in the same runloop cycle when connect failed

3

kwdx avatar Mar 31 '20 14:03 kwdx