moquette
moquette copied to clipboard
Broker restart and clear connections,but aslo can response client PINGEQ message
Broker restart (less than 5 s ) and clear connections,but aslo can response client PINGEQ message,but getConnectedList is empty ,
the client set ping interval = 20s,
Hi @kscorpio , please could you expand more on your problem? Do you want that the broker respond to the PING while restarting?
moquette stopped and after 5 seconds restart, the client send ping ,the moquette can also response , but broker.listConnectedClients() is empty .
when i restart broker , and call api getConnectionList , return empty
but in the debug log ,has many line like below
C->B PINGREQ < null >
if the client is connected , the ping log should be C->B PINGREQ <'clientID'>
@andsel
MQTTConnection.class line 105
case PINGREQ:
String cid = NettyUtils.clientID(channel);
if (!StringUtil.isNullOrEmpty(cid)) {
MqttFixedHeader pingHeader = new MqttFixedHeader(MqttMessageType.PINGRESP, false, AT_MOST_ONCE,
false, 0);
MqttMessage pingResp = new MqttMessage(pingHeader);
channel.writeAndFlush(pingResp).addListener(CLOSE_ON_FAILURE);
}
maybe can resovle the problem ?
Thank's @kscorpio for all this tests and investigations, I'll try to wrap up next weekend. Just for confirmation, does this happen on main
branch?
yes , 0.17-snopshot
can is use maven package
get a temp jar to use. ?
Hi @kscorpio I tried to reproduce the issue without any success.
I improved the EmbeddedLauncher
to exit
or list_clients
, please checkout PR #746 and start with:
./mvnw clean package exec:java -pl embedding_moquette
Using the HiveMQ CLI tool on broker restart, the client reconnects and the ping messages has all the clientid.
Press Ctl-C to exit.
Using default values from properties file /home/andrea/.mqtt-cli/config.properties:
Host: localhost, Port: 1883, Mqtt-Version MQTT_5_0, Logfile-Debug-Level: DEBUG
No Logfile used - Activate logging with the 'mqtt sh -l' option
mqtt> con -V 3 -h 127.0.0.1 -i andsel_pub -k 10
[email protected]> pub -t /temperature/milan -m 18
[email protected]> pub -t /command -m list_clients
[email protected]> Server closed connection without DISCONNECT.
Press ENTER to resume:
mqtt> con -V 3 -h 127.0.0.1 -i andsel_pub -k 10
Do you have a reproducer, or could you use the EmbeddedLauncher
to verify your client?
Maybe it depends on the way the embedded broker instance is managed, could describe more or provide a local reproducer, please?