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

PINGREQ still going out even when QoS 1 publishes are happening within keep alive period #813

Open
7 tasks
tsturzl opened this issue Feb 9, 2024 · 0 comments
Labels
Status: Available No one has claimed responsibility for resolving this issue.

Comments

@tsturzl
Copy link

tsturzl commented Feb 9, 2024

Prerequisites

Note: You may remove this section prior to submitting your report.

A small team of volunteers monitors issues. Please help us to help you by making it simple to understand and, if possible,
replicate your issue. Prior to reporting a bug please:

  • Test the latest release of the library.
  • Search existing issues.
  • Read the relevant documentation.
  • Review your server configuration and logs.
  • Consider testing against a different server (e.g. mqtt.eclipseprojects.io or test.mosquitto.org)
  • If possible, test using another tool (e.g. MQTTX / mosquitto_sub)
    to confirm the issue is specific to this client.
  • If you are unsure if you have found a bug, please consider asking on stackoverflow for a quicker response.

Bug Description

I have a client configured for a 4 second keep alive, and I'm publishing QoS 1 messages every 500ms. I still see PINGREQ going out in a packet sniffer. This means that keep alive is making unneeded ping requests. This doesn't track the behavior the documentation seems to suggest, nor does it seem to resemble the behavior of other clients such as the paho.mqtt.java client. Obviously this isn't a major behavior issue, but we noticed this behavioral difference while packet sniffing python and Java clients, and it seems python is the outlier in terms of behavior, especially since the documentation seems to suggest that keep alive should only ping in absence of other control messages.

Reproduction

I'll just provide a test script:

import paho.mqtt.client as mqtt
import time

client = mqtt.Client()

def on_disconnected(_client, _userdata, _rc):
    print("DISCONNECTED")

client.on_disconnect = on_disconnected

# enable logging, let it create it's own logger
client.enable_logger(logger=None)

print("connecting...")
client.connect("localhost", 1883, 5)
print("connected")
print("starting loop...")
client.loop_start()
print("loop started")
while True:
    print("publishing message...")
    client.publish("testtopic1", "hello world", qos=1)
    time.sleep(0.5)

Environment

  • Python version: 3.10.9
  • Library version: 1.6.1
  • Operating system (including version): Ubuntu 22.04.03
  • MQTT server (name, version, configuration, hosting details): Mosquito, but have validated against another server implementation as well

Logs

Logs are largely irrelevant. I observed this in a debugger, ping is still happening even though publish QoS 1 is happening many times in the keep alive period.

@github-actions github-actions bot added the Status: Available No one has claimed responsibility for resolving this issue. label Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Available No one has claimed responsibility for resolving this issue.
Projects
None yet
Development

No branches or pull requests

1 participant