You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
with 1.4.9, the following sequence results in a duplicating $SYS messages in the persistent store.
at least one subscriber to $SYS/# must have existed/exist at db persistence time? (I just used mosquitto_sub and left it running, without this, you don't get the problem)
subscriber must have been susbcribed long enough to get an updated message, not just the initial messages.
stop mosquitto and restart, wait for update on topic again.
The following patch, suggested by @ralight fixes the issue. (though you still end up with a single copy of them even if the subscriber is gone by the time you save the db on exit, and even if the subscriber was clean session=true)
diff --git a/src/persist.c b/src/persist.c
index d71fc04..f416aea 100644
--- a/src/persist.c+++ b/src/persist.c@@ -140,7 +140,7 @@ static int mqtt3_db_message_store_write(struct mosquitto_db *db, FILE *db_fptr)
stored = db->msg_store;
while(stored){
if(stored->topic && !strncmp(stored->topic, "$SYS", 4)){
- if(stored->ref_count == 1 && stored->dest_id_count == 0){+ if(stored->ref_count <= 1 && stored->dest_id_count == 0){
/* $SYS messages that are only retained shouldn't be persisted. */
stored = stored->next;
continue;
The text was updated successfully, but these errors were encountered:
with 1.4.9, the following sequence results in a duplicating $SYS messages in the persistent store.
stop mosquitto and restart, wait for update on topic again.
The following patch, suggested by @ralight fixes the issue. (though you still end up with a single copy of them even if the subscriber is gone by the time you save the db on exit, and even if the subscriber was clean session=true)
The text was updated successfully, but these errors were encountered: