Message Lost on Openfire Restart [version 4.3.2]

Hello There,

I am using Openfire server version 4.3.2, in a two node cluster having “Monitoring Plugin” enabled.
Problem - When I post a message to Openfire, it gets persisted in database after 300 seconds, configuration of which comes from group chat settings as shown below:


Reference : How does the cache behave on server shutdown?

If after posting a message to a group chat, I restart all the Openfire nodes in cluster one-by-one (using “service openfire restart” command on linux), the message gets lost, message is persisted in “ofmessagearchive”, but message is not present in “ofconversationlog” table.

Reason I had to restart Openfire is, every time a new service is created, I had to do some configuration changes via application code which will require a restart as shown below:

Queries/Asks -

  1. Can I set “Conversation Logging Flush Interval” to 5-10 seconds or minimum recommended value, so that message is persisted ASAP & probability of losing it is reduced? In that case, will there be any performance hit in case of large number of users doing chat?
  2. Any recommendations on restarting Openfire, it seems that it is not terminating normally and the message from the cache (not persisted in database) are being lost.

Please suggest a way out of it or how to deal such scenarios where Openfire gets abnormally terminated.

Answer 1 : we need to check how many messages you are getting every seconds and based on that we can deside what time interval is best to deal with this situation. As you mentioned 5-6 sec is not acceptable time interval such kind of service as far as i am aware about. As per my opinion it should not be less then 30 sec(we should make it higher if we are getting high number of message ) and it also depends on the database and server IOPS.

Answer 2 : I don’t think you need to restart openfire server for this reason. Also restarting the server again and again is not a good idea… Let me know which kind of solution you are looking may be i can help.

Thanks for your reply @Hiren1.

  1. [IMPORTANT] We can set the conversation logging time to a higher number (say for an instance 200 seconds), but issue I am facing is that, the messages posted to Openfire (to test this I am posting only one message) are being lost when Openfire is restarted during the conversation logging time. Can you suggest a way out of it?
    I am using “service openfire restart” command on linux, but according to the thread How does the cache behave on server shutdown?, the messages in the queue should have been persisted in the DB, but somehow they are not being persisted, also no significant error logs I can see.

  2. We are creating MUC Service & Chat Rooms from Spring Boot application, for every new service, we need to set default history setting to show entire chat history (we can’t afford to do it manually for every service, that is the reason we need make the configuration changes into Openfire DB directly & restart Openfire since the change do not reflects while its running) as shown below:

Answer 1 : You are running on windows or ubuntu ? if windows and you have installed openfire with limited access to write log it will never show you in panel or that fill will always be empty. There is only case when some exceptions are appering while flusing the thread data to database and it is breaking somewhere there. Enable debug logs and check if you can see something or customise your plugin and on terminating the service you can write your own way to make it happen. As far as i know it is writing in database i don’t see any error in this version 4.3.2 of openfire since i am using this last one year i guess.

Answer 2 : How frequently you are creating new service? If you create new room in same service i see there are some default setting you can apply.

How you are creating new service with rest API or Xmpp way ?

And why you need that ? I mean what is your user pattern and why you creating so many service any clue ?

  1. We are using Openfire on linux machine. Also, enabled debug logs but no such error are being reported. Messages are being lost. The same thing when tested on windows machine, works fine, messages are persisted in the database when we stop Openfire or until Openfire is abnormally terminated.
    Attaching the debug logs here for your reference:
    Openfire Debug Log-1.txt (893.3 KB) Openfire Debug Log-2.txt (402.0 KB)

  2. We are creating services from REST API plugin, we need to segregate chat rooms logically, i.e. why we need to have multiple services.

Might be related https://issues.igniterealtime.org/browse/OF-1788

@wroot any workaround or any resolution on this issue so far?

Since loosing messages is not affordable.

As I also tested this on windows, it is persisting the messages when I shut down Openfire normally, but not working on linux (using ‘service openfire restart’ command).

I’m not aware of any

Any comments/recommendations if you could make?

I have added this information as a comment to the ticket above. Have no ideas or solutions. I’m not even a developer myself.

The problem seems to be in clustering mode.
Messages are being persisted when Openfire runs in non-clustered environment (both on Windows & Linux).

Can some one please suggest a way out of it?

I know there are a few fixes related to clustering in the works for 4.4.1. Maybe @gdt can comment on this.

Well, try the currently nightly build to see if your problem goes away. 4.4.0 did fix some potential clustering issues, but an unrelated issue also broke clustering completely - fixed, pending a 4.4.1 release.

https://igniterealtime.org/downloads/nightly_openfire.jsp

Greg

1 Like