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

Fix timeout of send thread in Async client for v5 #1457

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

TiejunMS
Copy link

@TiejunMS TiejunMS commented Mar 5, 2024

When the outgoing packets fails to be sent due to hitting the limitation of the inflight maximum, it will wait on send_cond/send_sem. Send thread should be woken up on PUBACK message received. So it does not need to wait until timeout (1 second).

When the outgoing packets fails to be sent due to hitting the limitation of the inflight maximum, it will wait on send_cond/send_sem. Send thread should be woken up on PUBACK message received. So it does not need to wait until timeout (1 second).

Signed-off-by: Tiejun Zhou <tizho@microsoft.com>
@icraggs
Copy link
Contributor

icraggs commented Mar 5, 2024

If this solution is correct (I want to check), then it will apply to PUBCOMP too, in case the QoS of the message being sent is 2.

@icraggs icraggs added this to the 1.3.14 milestone Mar 5, 2024
@TiejunMS
Copy link
Author

TiejunMS commented Mar 6, 2024

Thanks for your suggestion! I run the test, and the same issue exists in QoS2 too. The test is modified from sample MQTTAsync_publish.c and attached. To run it, simply start a mosquitto broker in localhost. Before fix, you will see random stuck for 1 second. It does not always reproducible since it is a race condition. Run multiple times and the issue will eventually be reproduced.
MQTTAsync_publish.zip

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

Successfully merging this pull request may close these issues.

2 participants