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

Fix not sending will on clean start during re-connect #369

Merged
merged 5 commits into from
Nov 23, 2022

Conversation

hlohse
Copy link
Contributor

@hlohse hlohse commented Nov 9, 2022

https://hivemq.kanbanize.com/ctrl_board/42/cards/9739/details/

If a client re-connects with a clean start, the specification defines that this "ends" and existing sessions.

Whenever a session ends, the specification defines that the ending session's will must be sent, if available and still pending due to a session expiry interval or a will delay interval that has not been reached yet.

This is achieved by sending any still pending will between disconnecting and (re-)connecting.

Also improved method names of PendingWillMessages.

@cla-bot cla-bot bot added the cla-signed label Nov 9, 2022
@hlohse hlohse requested review from A-Imal and LBrandl November 9, 2022 11:06
@hlohse hlohse force-pushed the bugfix/9739-will-message-on-clean-session-start branch from 29b8274 to 61ae8ce Compare November 17, 2022 13:52
If a client re-connects with a clean start, the specification
defines that this "ends" and existing sessions.

Whenever a session ends, the specification defines that
the ending session's will must be sent, if available and
still pending due to a session expiry interval or a will
delay interval that has not been reached yet.

This is achieved by sending any still pending will between
disconnecting and (re-)connecting.

Also improved method names of PendingWillMessages.
Don't rely on the CheckWillsTask and ClientSessionCleanUpTask
to be scheduled well enough that there can never be a situation
where there is still a will send pending while the session,
which contains the will data, has already been cleaned up.
For testing purposes, assert that this never happens
because it is unexpected: We must guarantee that a
will is sent before the session is gone/cleaned up.

To detect unknown race conditions in production,
log a warning and don't throw a NullPointerException,
as this might block client connections and the
sending of other wills.
@hlohse hlohse force-pushed the bugfix/9739-will-message-on-clean-session-start branch from 61ae8ce to f9973f2 Compare November 21, 2022 10:41
Added commit hooks to update will message references whenever
a client session is removed or overwritten.
@hlohse hlohse force-pushed the bugfix/9739-will-message-on-clean-session-start branch from 928957d to c3a0457 Compare November 22, 2022 07:49
@hlohse hlohse merged commit da8451f into master Nov 23, 2022
@hlohse hlohse deleted the bugfix/9739-will-message-on-clean-session-start branch November 23, 2022 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants