-
Notifications
You must be signed in to change notification settings - Fork 90
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
Auto keep alive not working #123
Comments
@ctron so this is mainly an mqtt-client concern right ? |
Yes, this is an issue in the MQTT client. |
so basically we should set a timer on the client to periodically send PING commands to the server and that's it right ? |
Well you don't need a timer, a simple "reader idle" condition should work, swapping that with the current "writer idle". |
what do you mean ? |
Swapping the current reader idle condition with writer idle … |
ahhh... that makes sense lol :-) sorry |
how can we best make a reproducer test for this ? |
I am not that familiar with testing in vertx. However the test should be: Common start
Variant A:
Variant B:
|
that's what I actually asked for :-) thanks.
… On 21 Mar 2019, at 08:54, Jens Reimann ***@***.***> wrote:
how can we best make a reproducer test for this ?
I am not that familiar with testing in vertx. However the test should be:
Common start
Create a connection, with an auto-handshake period of X seconds
Start sending QoS 0 messages to the server, every 1 second
After X seconds, the client should automatically send a PINGREQ
Variant A:
The server does not respond
The connection must be closed after X mutliplied by 1.5 seconds (MQTT spec)
Variant B:
The server responds with a PINGRESP
After X more seconds, the connection must still be open
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#123 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AANxiiw5_Y9vvZaqDetqeOEduoTG4RJZks5vYzqYgaJpZM4b-wD5>.
|
Cool 😄 … thanks for looking into this! |
I'm working on it @ctron , I can't see where the |
MQTT Spec:
|
@ctron it seems this statement applies to the server and not the client |
@konradmichael yes I remember now, I tried also to use the READER idle state but it did not work in all cases. Basically writing to the channel a message defeats the idle state and the client does not get properly timeout, so I had to use Vertx timers instead. |
also the 1.5 factor does not apply to the client but to the server instead. That's why there is a |
you can help to review the PR @konradmichael |
Maybe you should have a look at the whole section, that might explain it:
|
it says a reasonable time.
the server has the 1.5 factor requirement
as far as I can read
… On 25 Mar 2019, at 15:38, Jens Reimann ***@***.***> wrote:
@ctron <https://github.com/ctron> it seems this statement applies to the server and not the client
Maybe you should have a look at the whole section, that might explain it:
If a Client does not receive a PINGRESP Packet within a reasonable amount of time after it has sent a PINGREQ, it SHOULD close the Network Connection to the Server.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub <#123 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AANxisiGLxpooH4mNHE_d7peMY2PxoHcks5vaN91gaJpZM4b-wD5>.
|
So what would be the definition of "reasonable"? |
there is a new property in the |
With the meaning of "10 seconds after the PINGREQ was sent, a response is overdue"? … I guess that would work. |
I just had a look at the PR, and I think this really overcomplicates things. When you send out a PINGREQ, you expected a PINGRESP to come back. In most cases you don't really care about getting back and PINGRESP or "something else" from the server. The PINGREQ is just a trigger to make the server send you something. This way you can reset the "idle reader" condition. My proposal would be to:
Option A:
Option B:
|
Finally I had the time to take a quick look at the PR. |
As I said, I believe it is not possible to implement this with @konradmichael solution for the reason I explained. Of course I might be wrong and I would be glad, so I believe that @konradmichael can provide a new PR. His original PR did not have any tests, mine has and I believe they are correct. @konradmichael is welcome to reuse the tests I wrote. In addition @konradmichael was wrong on the The timer only starts when the I believe that my current PR could also be improved to clear the timeout when a message is written to the channel. I named it
So for now I believe we are going to leave this out for 3.7.0 (that shall be released this week), until we figure out the issues mentioned above. |
Did you test what I mention about having PINGREQ sent even when the channel is busy writing? |
On 26 Mar 2019, at 20:45, Paolo Patierno ***@***.***> wrote:
Did you test what I mention about having PINGREQ sent even when the channel is busy writing?
can you explicit what a test case would be ? that leaves any ambiguity
It seems to me that even when the MQTT client is sending data (i.e. PUBLISH messages, or PUBACK as ack for received packets, ...) the timer always sends PINGREQ which is not necessary.
I would agree on the KeepAliveTimeSeconds name but I would use keepAliveInterval as mentioned in the spec and heavily used in the Eclipse Paho library which is the reference for MQTT implementations. Btw even in this case I would leave it for a different PR.
Interval is actually equivalent to Period and better if the spec use this word so I believe we should go for deprecating keepAliveTimeSeconds in favour of keepAliveInterval, can you open an issue for this ?
… —
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub <#123 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AANxivwDEriAckz1qMagHCDhUEFgedaWks5vanjVgaJpZM4b-wD5>.
|
I have just created issue #126 |
New Pull request: #129 |
@vietj @konradmichael Hello, any chance that this fix will be applied to 4.0.0? In our project we are actually using 4.0.0.CR1 and we have this problem. Thank you and have a nice day! |
it is supposedly applied #173 do you have a reproducer ? |
@vietj thank you for the fast answer :)
|
can you open a new issue with the reproducer ? if you can provide a project it is better. |
thanks @AlmostRuio |
The auto keep alive seems not to be working. Checking the source I assume this is due to the following way it is implemented:
This will register an idle detector which only listens for write events. However, opening a connection and only pushing QoS messages will not trigger a response from the server,
so the client does never receive anything from the server.
The client should send a PINGREQ when the reader gets idle. Which shouldn't happen
when you send QoS 1 or 2 messages and the server sends responses. However if it does,
then sending a PINGREQ would be the appropriate action.
If the server doesn't response then, it should be considered dead.
The text was updated successfully, but these errors were encountered: