eclipse / paho.mqtt.golang

Other
2.73k stars 533 forks source link

hangs on internalConnLost func #621

Closed Gypsying closed 1 year ago

Gypsying commented 1 year ago

https://github.com/eclipse/paho.mqtt.golang/blob/2d3b04d5b874851cf7e76f51987492393c88e258/client.go#L520

I used 2d3b04d5b874851cf7e76f51987492393c88e258 version which commit on Dec 28, 2021.

Sometimes the client will hangs after pingresp not received, disconnecting, i use pprof inspect:

image

image

any ideas? @MattBrittan

MattBrittan commented 1 year ago

Can you please try the latest release? That release fundamentally changes the way the connection status is handled replacing some very old code. Further work needed to tidy things up (there is some code to try to work around the previous deficiencies that should not longer be needed) but the change made removes a few potential deadlocks (so I'm reluctant to spend much time on older releases).

However, in this case, my guess is that the issue is within your message handler. The library will not complete the shutdown until handlers return and your dump shows that the library is waiting on a handler (here) so I believe that is most likely to be the issue (see the third point in common issues).

Gypsying commented 1 year ago

Can you please try the latest release? That release fundamentally changes the way the connection status is handled replacing some very old code. Further work needed to tidy things up (there is some code to try to work around the previous deficiencies that should not longer be needed) but the change made removes a few potential deadlocks (so I'm reluctant to spend much time on older releases).

However, in this case, my guess is that the issue is within your message handler. The library will not complete the shutdown until handlers return and your dump shows that the library is waiting on a handler (here) so I believe that is most likely to be the issue (see the third point in common issues).

Thanks your reply, i used the latest release(v1.4.2). And the trouble does not appear again, the client is running very well for 5days up to now.

Maybe the old releases has a few potential deadlocks like you said.

Thanks again!