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

Broker restart and clear connections,but aslo can response client PINGEQ message #731

Open
kscorpio opened this issue Mar 2, 2023 · 7 comments

Comments

@kscorpio
Copy link

kscorpio commented Mar 2, 2023

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,

@andsel
Copy link
Collaborator

andsel commented Mar 3, 2023

Hi @kscorpio , please could you expand more on your problem?
Do you want that the broker respond to the PING while restarting?

@kscorpio
Copy link
Author

moquette stopped and after 5 seconds restart, the client send ping ,the moquette can also response , but broker.listConnectedClients() is empty .

@kscorpio
Copy link
Author

kscorpio commented Apr 19, 2023

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

@kscorpio
Copy link
Author

kscorpio commented Apr 20, 2023

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 ?

@andsel
Copy link
Collaborator

andsel commented Apr 20, 2023

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?

@kscorpio
Copy link
Author

kscorpio commented Apr 21, 2023

yes , 0.17-snopshot

can is use maven package get a temp jar to use. ?

@andsel
Copy link
Collaborator

andsel commented May 1, 2023

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
andsel_pub@127.0.0.1> pub -t /temperature/milan -m 18
andsel_pub@127.0.0.1> pub -t /command -m list_clients
andsel_pub@127.0.0.1> 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?

@andsel andsel closed this as completed May 1, 2023
@andsel andsel reopened this May 1, 2023
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

No branches or pull requests

2 participants