Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client crashes while reconnecting #419

Closed
d21d3q opened this issue May 7, 2020 · 4 comments
Closed

Client crashes while reconnecting #419

d21d3q opened this issue May 7, 2020 · 4 comments

Comments

@d21d3q
Copy link

d21d3q commented May 7, 2020

steps to reproduce

  • run broker (eg mosquitto)
  • run client with default opts (with only one broker specified)
  • subscribe to some topic
  • stop broker
  • observe crash
DEBUG    11:42:53 Connection lost: EOF
DEBUG    11:42:53 [client]   enter reconnect
DEBUG    11:42:53 [client]   about to write new connect msg
DEBUG    11:42:53 [client]   socket connected to broker
DEBUG    11:42:53 [client]   Using MQTT 3.1.1 protocol
DEBUG    11:42:53 [net]      connect started
ERROR    11:42:53 [net]      connect got error read tcp 127.0.0.1:36872->127.0.0.1:1883: read: connection reset by peer
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x723a40]

goroutine 33 [running]:
github.com/eclipse/paho%2emqtt%2egolang.(*client).attemptConnection(0xc000174a00, 0xc00003df58, 0x2, 0x2, 0x0, 0x0)
        /home/d21d3q/go/src/github.com/eclipse/paho.mqtt.golang/client.go:381 +0x4c0
github.com/eclipse/paho%2emqtt%2egolang.(*client).reconnect(0xc000174a00)
        /home/d21d3q/go/src/github.com/eclipse/paho.mqtt.golang/client.go:297 +0xc8
created by github.com/eclipse/paho%2emqtt%2egolang.(*client).internalConnLost
        /home/d21d3q/go/src/github.com/eclipse/paho.mqtt.golang/client.go:458 +0x1d7
exit status 2

origin

Crash comes from err.Error() where err is nil

@MattBrittan
Copy link
Contributor

Apologies - this was another issue introduced in the big refactor pulled recently (not quite sure how I managed this one!). I have submitted PR #420 which should resolve the issue. Thanks very much for the really clear error report!

@alsm
Copy link
Contributor

alsm commented May 11, 2020

The PR is merged, please confirm this has resolved the issue.

@d21d3q
Copy link
Author

d21d3q commented May 11, 2020

I placed comment here - it does resolve issue.

@YiuTerran
Copy link

I placed comment here - it does resolve issue.

so, please close this issue

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

No branches or pull requests

4 participants