Why does Openfire keep reloading my plugin

I creating a plugin for Openfire, and there are some initialization steps in the method “initializePlugin”.

The initialization steps of my plugin are supposed to run only once.

But I find that Openfire keeps repeating the call to “initializePlugin” of my plugin after

each ~20 seconds. This is strange!

Is it Jetty or Openfire problem?

How to tell Openfire to call “initializePlugin” just 1 time?

1 Like

I have never seen this situation before. I think something is wrong in your configuration or setup. Take a good look at your log files. The answer is usually in there somewhere

2 Likes

The exact same thing happens to me. It is exactly every 20 seconds. Are you creating threads in your plugin? Every 20 seconds…

oh hi Matt, yes, so much the same, i create a thread in my plugin too

I don’t know if that has anything to do with it. What is happening is Openfire is reloading the plugin every 20 seconds. If you have logging in your destroy method you will see that it is called first. So the plugin is unloaded and re-loaded – there must be some sort of re-deploy thread that Openfire has running that does it. I notice it start happening when I hot re-deploy the plugin, but not every time I hot re-deploy it.

I have determined that deleting the embedded database and re-configuring Openfire for sure makes it go away. Sometimes stopping and restarting makes it go away and/or rebooting the server. But re-configuration always makes it go way. And it doesn’t re-occur unless I re-deploy the plugin. So my current theory is something gets FUBAR in the embedded database (could occur with external database too but I never use one).

1 Like

I think it should be possible to make an debug openfire build, attach an debugger and set a breakpoint in the initialize method (or in the method that is repsonsible for reloading/initalizing plugins). That should also show the stack trace and thereforce the cause for the reload.

I found the problem. I was able to replicate it on a Linux Centos box.

It happens when the timestamp on the plugin file is higher than the timestamp on the folder created when the plugin is unzipped. It can happen if the you are developing on a PC which is in a different time-zone.

Check the date/timestamp. If higher than the current date/time, then touch the file to reset timestamp to current date/time.

2 Likes

That’s AWESOME. Glad to know and it does make sense in my case as we were building the artifact on a central build server and I was deploying it to other servers which do not have synchronized clocks.

Thanks so much for keeping this alive. Now there is something on the web for others who might experience this.

1 Like