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

Unreachable broker connection blocks 2nd working connection #11

Closed
jpwsutton opened this issue Feb 4, 2016 · 0 comments
Closed

Unreachable broker connection blocks 2nd working connection #11

jpwsutton opened this issue Feb 4, 2016 · 0 comments

Comments

@jpwsutton
Copy link
Contributor

migrated from Bugzilla #483296
status CLOSED severity normal in component MQTT-C for 1.2
Reported in version 1.2 on platform PC
Assigned to: Ian Craggs

On 2015-11-30 06:10:40 -0500, Juergen Kosel wrote:

Imagine the following situation:
A MQTT client should connect to more than 1 broker and publish some topics.
But unfortunately one of the brokers is (temporary) unreachable.

Since there is only one MQTTAsync_sendThread for all connections to MQTT brokers,
any publish transaction to a reachable broker is blocked, while the MQTTAsync_sendThread tries to connect to the unreachable one.

And to make things even more worse, the client may
try to connect again, by calling MQTTAsync_connect().
Internally the new connect request is placed into the first position of the command list. So any write request to a well reachable broker would be blocked
again.

On 2015-12-08 02:43:22 -0500, Juergen Kosel wrote:

While view at the code, I had seen that there is only one thread doing all the work.
But I have overseen, that the sockets are opened in none blocking mode.
So attempts to open a connection to a not reachable broker decrease performance, but do not block other connections at all.

Sorry for reporting this false bug.
Juergen

On 2015-12-08 09:04:24 -0500, Ian Craggs wrote:

Hi Jurgen,

thanks for the update. I had been thinking about this, and the only potentially blocking call is getaddrinfo(), to resolve hostnames. This could be improved by having DNS lookups in a separate thread or by using a non-blocking DNS lookup library.

Most of the time, DNS lookups are quick, so you wouldn't see an adverse effect, and I've not had it reported as a problem. But it is a possible improvement that could be made.

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

1 participant