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

Mosquitto 1.5.7: Socket error on client 'xxx', disconnecting. #1177

Closed
fmvin opened this Issue Feb 22, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@fmvin
Copy link

fmvin commented Feb 22, 2019

It looks like the same symptoms as described in #875, #872.

Reconnections repeat forever. This happens only if mosquitto and client are started from rc.local. If after system started up and the client is killed and started again manually from root session this problem is not repeated.
I get this issue on mosquitto 1.5.4 and 1.5.7 under linux 2.6.32

New client connected from 127.0.0.1 as mosq/ciKalXMsU4u=dlC_wb (c1, k3).
1550586971: No will message specified.
1550586971: Sending CONNACK to mosq/ciKalXMsU4u=dlC_wb (0, 0)
1550586971: Client mosq/ciKalXMsU4u=dlC_wb already connected, closing old connection.
1550586971: Socket error on client mosq/ciKalXMsU4u=dlC_wb, disconnecting.
1550586971: New client connected from 127.0.0.1 as mosq/ciKalXMsU4u=dlC_wb (c1, k3).
1550586971: No will message specified.
1550586971: Sending CONNACK to mosq/ciKalXMsU4u=dlC_wb (0, 0)
1550586971: New connection from 127.0.0.1 on port 1883.
1550586971: No will message specified.
1550586971: Received SUBSCRIBE from mosq/ciKalXMsU4u=dlC_wb
1550586971: Sending SUBACK to mosq/ciKalXMsU4u=dlC_wb
1550586971: Received SUBSCRIBE from mosq/ciKalXMsU4u=dlC_wb
1550586971: Sending SUBACK to mosq/ciKalXMsU4u=dlC_wb
1550586971: Received SUBSCRIBE from mosq/ciKalXMsU4u=dlC_wb
1550586971: Sending SUBACK to mosq/ciKalXMsU4u=dlC_wb
1550586971: Received SUBSCRIBE from mosq/ciKalXMsU4u=dlC_wb
1550586971: Sending SUBACK to mosq/ciKalXMsU4u=dlC_wb
1550586972: Client mosq/ciKalXMsU4u=dlC_wb already connected, closing old connection.
1550586972: Socket error on client mosq/ciKalXMsU4u=dlC_wb, disconnecting.
1550586972: New client connected from 127.0.0.1 as mosq/ciKalXMsU4u=dlC_wb (c1, k3).
1550586972: No will message specified.
1550586972: Sending CONNACK to mosq/ciKalXMsU4u=dlC_wb (0, 0)
1550586972: Received SUBSCRIBE from mosq/ciKalXMsU4u=dlC_wb
1550586972: Sending SUBACK to mosq/ciKalXMsU4u=dlC_wb
1550586972: Received SUBSCRIBE from mosq/ciKalXMsU4u=dlC_wb
1550586972: Sending SUBACK to mosq/ciKalXMsU4u=dlC_wb
1550586972: Received SUBSCRIBE from mosq/ciKalXMsU4u=dlC_wb
1550586972: Sending SUBACK to mosq/ciKalXMsU4u=dlC_wb
1550586972: Received SUBSCRIBE from mosq/ciKalXMsU4u=dlC_wb
1550586972: Sending SUBACK to mosq/ciKalXMsU4u=dlC_wb
1550586973: New connection from 127.0.0.1 on port 1883.
1550586973: Client mosq/ciKalXMsU4u=dlC_wb already connected, closing old connection.
1550586973: Socket error on client mosq/ciKalXMsU4u=dlC_wb, disconnecting.
1550586973: New client connected from 127.0.0.1 as mosq/ciKalXMsU4u=dlC_wb (c1, k3).
1550586973: No will message specified.
1550586973: Sending CONNACK to mosq/ciKalXMsU4u=dlC_wb (0, 0)
1550586973: No will message specified.
1550586973: Received SUBSCRIBE from mosq/ciKalXMsU4u=dlC_wb
1550586973: Sending SUBACK to mosq/ciKalXMsU4u=dlC_wb
1550586973: Received SUBSCRIBE from mosq/ciKalXMsU4u=dlC_wb
1550586973: Sending SUBACK to mosq/ciKalXMsU4u=dlC_wb
1550586973: Received SUBSCRIBE from mosq/ciKalXMsU4u=dlC_wb
1550586973: Sending SUBACK to mosq/ciKalXMsU4u=dlC_wb
1550586973: Received SUBSCRIBE from mosq/ciKalXMsU4u=dlC_wb
1550586973: Sending SUBACK to mosq/ciKalXMsU4u=dlC_wb
1550586974: New connection from 127.0.0.1 on port 1883.
1550586974: Client mosq/ciKalXMsU4u=dlC_wb already connected, closing old connection.
1550586974: Socket error on client mosq/ciKalXMsU4u=dlC_wb, disconnecting.
1550586974: New client connected from 127.0.0.1 as mosq/ciKalXMsU4u=dlC_wb (c1, k3).
1550586974: No will message specified.
1550586974: Sending CONNACK to mosq/ciKalXMsU4u=dlC_wb (0, 0)
1550586974: New connection from 127.0.0.1 on port 1883.
@fmvin

This comment has been minimized.

Copy link
Author

fmvin commented Feb 25, 2019

Please close this issue.

We found the root cause of the problem. We have 2 identical processes which are started from rc.local without any delay. It seems mosquitto generates a connection ID based on system time. So sometimes it's possible to get 2 identical "unique ID" for connection for different processes. We just add 1sec delay between these processes starting and problem goes away.

Hope it helps to someone else.

@ralight

This comment has been minimized.

Copy link
Contributor

ralight commented Feb 26, 2019

Thanks for reporting this, I'm sure it's a niggling problem for some.

This is actually in the client library, I've now used a finer resolution timer for the random client id generation there so this should be less likely to come up. Future versions of the library won't be generating the client ids themselves.

@ralight ralight closed this Feb 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.