You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
Found this issue when i was writing code that recovers broken MQTT connection.
Think that both @last_ping_request and @last_ping_response variables should be reset in #connect method, just before starting @read_thread
Here the code to reproduce it:
mqtt = MQTT::Client.new('mqtt://test.mosquitto.org')
sleep 24
mqtt.connect
mqtt.subscribe('#')
mqtt.get do |topic, payload|
puts topic, payload
end # => No Ping Response received for 23 seconds (MQTT::ProtocolException)
# In first keep_alive!
The text was updated successfully, but these errors were encountered:
raiseProtocolException,'Failed to read byte from socket'ifbyte.nil?
Here's the full stacktrace:
mqtt-0.6.0/lib/mqtt/packet.rb:223:in 'MQTT::Packet.read_byte': Failed to read byte from socket (MQTT::ProtocolException)
from /usr/local/rvm/gems/ruby-3.4.1@global/gems/mqtt-0.6.0/lib/mqtt/packet.rb:30:in 'MQTT::Packet.read'
from /usr/local/rvm/gems/ruby-3.4.1@global/gems/mqtt-0.6.0/lib/mqtt/client.rb:471:in 'MQTT::Client#receive_packet'
from /usr/local/rvm/gems/ruby-3.4.1@global/gems/mqtt-0.6.0/lib/mqtt/client.rb:278:in 'block in MQTT::Client#connect'
UPDATE:
This appears to occur when an MQTT server is under a heavy load - I setup a local MQTT server and the problem is almost non-existent (i.e. it's observed much less frequently). Hoping there's additional resilience that can be implemented in the code to address this issue. Fwiw, this occurs quite a bit on meshdev:[email protected]:1883. More details to connect here: https://meshtastic.org/docs/configuration/module/mqtt/
Hi,
Found this issue when i was writing code that recovers broken MQTT connection.
Think that both @last_ping_request and @last_ping_response variables should be reset in #connect method, just before starting @read_thread
Here the code to reproduce it:
The text was updated successfully, but these errors were encountered: