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

TLS bridge reconnecting very slowly on Windows #691

Closed
jsirpoma opened this issue Feb 7, 2018 · 1 comment
Closed

TLS bridge reconnecting very slowly on Windows #691

jsirpoma opened this issue Feb 7, 2018 · 1 comment

Comments

@jsirpoma
Copy link

jsirpoma commented Feb 7, 2018

This is very similar to issue #154 but still happens on 1.4.14. The bridge makes TLS connection.

This log is from starting mosquitto, stopping wifi and putting it back on immediately.

1517575981: mosquitto version 1.4.14 (build date 11/07/2017  0:03:18.53) starting
1517575981: Config loaded from ./mosquitto-cmd.conf.
1517575981: Opening ipv6 listen socket on port 1883.
1517575981: Opening ipv4 listen socket on port 1883.
1517575981: Bridge XXX doing local SUBSCRIBE on topic y/#
1517575981: Connecting bridge XXX (XXX:YYY)
1517575981: Bridge XXX sending CONNECT
1517575982: Received CONNACK on connection XXX.
1517575982: Bridge XXX sending UNSUBSCRIBE (Mid: 12339, Topic: x/y/#)
1517575982: Received PUBACK from XXX (Mid: 12338)
1517575982: Received UNSUBACK from XXX
1517575991: Socket error on client XXX, disconnecting.
1517576021: Bridge XXX doing local SUBSCRIBE on topic y/#
1517576021: Connecting bridge XXX (XXX:YYY)
1517576021: Bridge XXX sending CONNECT
1517576021: Error creating bridge: Unknown error.
...
Repeats the last four lines for 10 minutes
...
1517576641: Bridge XXX sending CONNECT
1517576641: Received CONNACK on connection XXX.

I am not really familiar with mosquitto networking code, but it looked like this to me:

  • mosquitto_net_write returns -1 and sets errno to EAGAIN
  • mosquitto_packet_write sets errno to WSAGetLastError and does not understand it
  • mosquitto_packet_write returns MOSQ_ERR_ERRNO and errno is set to the unknown value
  • The same MOSQ_ERR_ERRNO is returned to mosquitto_packet_queue and to mqtt3_bridge_connect
  • Error is reported and socket closed

So maybe the EAGAIN from mosquitto_net_write should be interpretted like that as the connection is not yet ready?

@jsirpoma
Copy link
Author

jsirpoma commented Feb 7, 2018

This is the same as #478 and the fix in #478 (comment) solves this.

@jsirpoma jsirpoma closed this as completed Feb 7, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant