0

we are using mqtt broker version 2.0.11 from eclipse running on Ubuntu 22.04.1.

This is the configuration file (server)

persistence true
persistence_location xxxxxxxxxx
per_listener_settings true
log_timestamp_format [%Y-%m-%d %H:%M:%S]
max_inflight_messages 1000
#
#       Port 1883 (NO TLS)
#
listener 1883
allow_anonymous true
allow_zero_length_clientid false
#
#       Port 8883 (TLS)
#
listener 8883
allow_anonymous false
allow_zero_length_clientid false
cafile xxxxxxx
certfile xxxxxxx
keyfile xxxxxxx
dhparamfile xxxxxxx
password_file xxxxxxx
acl_file xxxxxxx

We have a client that has been disconnected from the broker for about 6 days.

When the client restarted we had this message ClientState: xxxxxxxxxxx: Timed out as no activity, keepAlive=20,000,000,000 lastOutboundActivity=5,084,923,567,979 ....

This is the client configuration parameters (relevants)

QoS=2
AutoReconnect=true
CleanSession=false
connectionTimeout=60
keepAliveInterval=20
maxInflight=1000

No old messages have been sent...

Is there any retention period of old messages?

Thanks in advance for your support.

Pentolone
  • 31
  • 2
  • 1
    Are you using a static client id for your client? – hardillb Mar 09 '23 at 12:09
  • As far as I know the client id did not change during the whole period. If this is what you intend as static lient id. – Pentolone Mar 10 '23 at 13:59
  • The client id is how the broker maps the new session to the existing old one (so knows to deliver any queued messages), you've not shared any code so it's not clear if you are setting one specifically or letting the client generate one (which may be regenerated on a reconnect) – hardillb Mar 10 '23 at 14:16
  • Not at all, the client id is always the same, There is not generation of client id. To be more clear: the client id is always "luke" – Pentolone Mar 10 '23 at 22:12

1 Answers1

0

The is no default retention period when using mosquitto as your broker. The is an option to set one, but as noted in the man page, if this value is not set then sessions (and the associated queued messages) will be kept for ever.

persistent_client_expiration duration

This option allows the session of persistent clients (those with clean session set to false) that are not currently connected to be removed if they do not reconnect within a certain time frame. This is a non-standard option in MQTT v3.1. MQTT v3.1.1 and v5.0 allow brokers to remove client sessions.

Badly designed clients may set clean session to false whilst using a randomly generated client id. This leads to persistent clients that connect once and never reconnect. This option allows these clients to be removed. This option allows persistent clients (those with clean session set to false) to be removed if they do not reconnect within a certain time frame.

The expiration period should be an integer followed by one of h d w m y for hour, day, week, month and year respectively. For example:

 - persistent_client_expiration 2m

 - persistent_client_expiration 14d

 - persistent_client_expiration 1y

As this is a non-standard option, the default if not set is to never expire persistent clients.

This strongly implies some other problem, hence the checking that client ids do truly match across reconnects.

hardillb
  • 54,545
  • 11
  • 67
  • 105