So the lastPingSent is a fraction of a second after the lastPingResponse
Believe the issue is that the ping response is received pretty much instantly. Moving the lastPingSent = time.Now() above the packets.NewControlPacket(packets.PINGREQ).WriteTo(conn) should solve this (have this running). However this fix would also increase the possibility of timeouts occurring when the connection is highly utilised; so will have a think about better options.
Expected behaviour
Don't really expect timeouts with this setup (could happen very occasionality)
Describe the bug
Connecting to a local (client and broker in docker containers; host is EC2 VM) broker and seeing occasional disconnections due to
PINGRESP timed out
.To reproduce
Don't have a reproducer; however added info to the error (
return fmt.Errorf("PINGRESP timed out (%v, %v)", lastPingSent, lastPingResponse)
) and got:So the
lastPingSent
is a fraction of a second after thelastPingResponse
Believe the issue is that the ping response is received pretty much instantly. Moving the
lastPingSent = time.Now()
above thepackets.NewControlPacket(packets.PINGREQ).WriteTo(conn)
should solve this (have this running). However this fix would also increase the possibility of timeouts occurring when the connection is highly utilised; so will have a think about better options.Expected behaviour
Don't really expect timeouts with this setup (could happen very occasionality)
Software used: