You are here

Purge old MeshChat messages

9 posts / 0 new
Last post
N5MXI's picture
Purge old MeshChat messages

Could someone please explain how old messages get purged in MeshChat? Currently, on my node, there are multiple messages from the future (March 25, 2031), that will not go away. All new messages appear lower in the list after these messages from the future. http://n5mxi-pi.local.mesh/meshchat

David - N5MXI
HHUS #5456


File Attachment: 
Oh, no that is 1931... You

Oh, no that is 1931... You must have been runing a node for a very long time!! :-)

OK, seriously, your node should never have allowed those messages into the message database as the date is over 30 days in the future. What that really tells me since they are in the message DB is that the time on your node is not correct. I am willing to make a bet that the time on the node is around that time. I would highly recommend getting an NTP server on the mesh network so that the nodes will start to be coordinated and will not vary too much.

As for how the messges get purged from the database, this is a setting in the config file. There is the max_messages_db_size setting that is the maximum number of messages to maintain. Any messages beyond this amount (i.e. older messages as the messages are sorted by timestamp) will be dropped and not written to the message DB. Consequently when the time on the node gets corrected, those messages in the future should drop out of the message DB also as they are greater than 30 days in the future (again default value set by valid_future_message_time).

I just looked back at your message and realized that the URL that you provided indicates that it is a Raspberry Pi. It is unusual for the time to be off so much on a Pi, but it is possible. I would be interested to know what you find in this respect. Also it would be good to know what version of MeshChat you are running on the Pi.

N5MXI's picture
My Answers

Setting up a NTP server is on my to-do list however I did confirm D & T are correct on the Pi. The correct time zone is set in raspi-config. My MeshChat has only been online for 1 week.

Version info:

  • AREDN running on Mikrotik hAP ac lite
  • meshchat-api 2.9 - on mikrotik
  • meshchat_1.02_all.deb - on Rpi

max_message_db_size=500 (This seems rather large. Is this correct?)

Thanks for your help. Awaiting further instructions.

nc8q's picture
max_message_db_size=500 (This seems rather large. Is this correc

"max_message_db_size=500 (This seems rather large. Is this correct?)"
That is default.

I wonder what happens if you delete those lines in

Or edit the 2nd column to a lower date value?
Then restart.

73, Chuck

N5MXI's picture
No Joy

I tried deleting the messages per your instructions and all was well until the next sync with other nodes in Zone: MeshChat. All the deleted messages reappeared. I looked on some other nodes and it appears that I'm not the only one looking into the future. 

David, it sounds like you are

David, it sounds like you are having a similar problem to what we had in Oregon a while ago.  Your database of messages isn't exactly corrupted but the dates are off because of some issue.  OK.

The short answer to your initial question is that the old messages do NOT go away.  I think there might be a message number limit and eventually the oldest get dropped off but we have very old messages at the bottom of the list.  Your problem with dates might mean they are at the top of the list?  MeshChat syncs with every other similarly named instance, and each node re-sorts it's message database according to date/time stamp.  We proved this by disconnecting a node from our mesh and posting simultaneous messages with another node on mesh ... then put everything back on mesh and both nodes adjusted their message database sequence to show the messages sorted by the date/time stamp.  Pretty cool actually.

The only way to completely get rid of a corrupted message database (without being a programming guru) is to go to EVERY instance with the same linked name and REMOVE the package from the node.  If one installation remains, then when you re install the package and put back on mesh every node will still find and accept the old corrupted data.  At one point we gave up on the name of our meshchat statewide and just started a new version.  There was something else going on about package versions and firmware versions .... but I've only had one cup of joe this am.


nc8q's picture
I'm not the only one looking into the future.

Hi, David:
Perhaps I should have assumed that there are several MeshChat instances on your network using an identical Zone.
I found 58 instances of Zone=MeshChat on my SUPERNODE.
I found 85 instances of Zone=MeshChat+1 or more characters.
I suggest that you change your Zone-name to something unique, delete the offending messages, reboot.
Then invite your neighbors to change their Zone-name, delete the offending messages, then reboot.

I hope this helps,




I am now the maintainer of MeshChat and I would be interested to see a copy of the message DB. If you don't mind you can send it to me at I am really interested in what those message entries look like.

The only other thing that I can see that is going on is if the timestamp for those messages is '0', but that does not explain the year 2031. Unless for some reason a library is representing '0' to be that date instead of 1/1/1970. That just sounds wrong to me though. Unfortunately, I can not do much more without seeing what the message DB looks like.

What would also be helpful is if you created an issue for this up at GitHub. It would allow the problem to be tracked and tie the fixes to the issue. You will find the issues at If you wanted you could upload the messages DB there that would be fine, or when I receive the DB from you I will isolate the message entries that are in question and add them to the issue.

K7EOK is pretty much correct with the fact that the messages will continue to be replicated between all the MeshChat instances. What might need to be done is to kill off the meshchatsync processes on all the MeshChat instances so that the message entries can be removed from the message DB. Once all the message DBs have been updated then the meshchatsync processes can be restarted. This is due to the decentralized nature of MeshChat.

Actually there another way to

Actually there another way to handle removing the messages that is not as much labor intensive, but it is still a bunch of work.

Designate one MeshChat instance as the source for the message DB and kill the meshchatsync process. Once this process is dead the instance will nolonger sync messages (i.e. pull) with other instances. Update the message DB to remove the offending message entries. Then on all other nodes remove the directory where the message DB is located. Typically /tmp/meshchat on nodes and on Linux machines it could be anywhere and need to check the meshchatconfig.lua file for the location. One should also kill the meshchatsync process on each instance as the message DB directory is being removed (otherwise the messages may get reintroduced from a instance that has not been updated yet). Once all the instances have had their DB directory removed, all instances can have meshchatsync started again and all databases will be updated from the designated "master". Once this is done there is not master copy of the DB any more and all instances are equal. 

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer