I have set the session expiry max interval to be 300 seconds (5 minutes). When monitoring event.log the actual session expiry log message happens anywhere from 3 to 21 minutes after the client disconnect log message. Is the session being cleared and the log message is delayed? I don’t understand this unpredictable range of time - especially when it is shorter than the 5 minute configured time.
There is a difference between the session expiry in an MQTT sense, which is when the broker will internally remove the session and no longer queue any messages for that session, and the time the sessions gets actually cleaned up from the persistence.
The time range between 3-21 minutes is normal.
You can be assured that the session will not be active between expiry and clean up.