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

MQTTClient_publishMessage() seems to get stucked on MQTTClient_yield() #875

Closed
svermigo opened this issue May 4, 2020 · 5 comments
Closed

Comments

@svermigo
Copy link

svermigo commented May 4, 2020

It seems we have an issue similar to #774

MQTTClient_publishMessage() seems to get stucked on MQTTClient_yield().

Tested on versions: 1.3.0 and 1.3.2

To Reproduce we just need to exchange a bunch of data between client/server in a short time. It seems we will get an SSLSocket error during sending and that causes the hang of the publish method.

Product name: Eclipse Paho Synchronous MQTT C Client Library
Version: 1.3.2
Build level: 2020-04-30T06:31:15Z
OpenSSL version: OpenSSL 1.0.2p 14 Aug 2018
OpenSSL flags: compiler: arm-poky-linux-gnueabi-gcc -march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a8 -DL_ENDIAN -DTERMIO -O2 -pipe -g -feliminate-unused-debug-types -Wall -Wa,--noexecstack
OpenSSL build timestamp: built on: reproducible build, date unspecified
OpenSSL platform: platform: linux-armv4
OpenSSL directory: OPENSSLDIR: "/usr/lib/ssl"
/proc/version: Linux version 4.9.218-noah (oe-user@oe-host) (gcc version 7.3.0 (GCC) ) #1 PREEMPT Thu Apr 9 14:50:52 UTC 2020

The full logs of connection attached down below:
084821.log
092735.log

@icraggs
Copy link
Contributor

icraggs commented May 4, 2020

It looks like from the first log that the last entry from the background thread is:

20200504 085023.511 Calling messageArrived for client hmir6-b12345-c123456, queue depth 1

and that the application doesn't return from the messageArrived callback. If this is the case, then it will cause the library to block.

Same for the second log at:

20200504 092830.664 Calling messageArrived for client hmir6-b12345-c123456, queue depth 1

The SSL error want_read/want_write is normal socket buffering.

@svermigo
Copy link
Author

svermigo commented May 4, 2020

I think I got that .. so that means, that a message, which arrives while publishing another message must be handled first and then the publishing will finish?

@icraggs
Copy link
Contributor

icraggs commented May 4, 2020

The application must return from any callback promptly, otherwise other background processing, like the sending of messages, may be blocked.

@svermigo
Copy link
Author

svermigo commented May 4, 2020

Great :) .. Thank you mr. Craggs. I believe it will solve my issue

@svermigo svermigo closed this as completed May 4, 2020
@ssuraci
Copy link

ssuraci commented Jun 12, 2020

I've the same issue (tested on v1.3.1): got error -22 (TCPSOCKET_INTERRUPTED) on MQTTClient_publishMessage and subsequent call to MQTTClient_publishMessage got stuck in MQTTClient_yield(). Application is send-only so no callback for incoming messages was called. Now trying to force a disconnect in case of MQTTClient_publishMessage error.

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

3 participants