Concurrent Modification Exception is thrown by the Plugin Manager during startup

While testing Openfire 4.5.1 with a rather large set of Openfire plugins, we hit the situation that an ConcurrentModificationException occurred in the loading process of the plugins. The direct result is some corruption in the server state, which blocks the loading of other plugins and the server not responding. Restarting does not help either.

The exception is thrown when in line org.jivesoftware.openfire.container.PluginManager:379 the pluginsLoaded map is looped in order to get a an entry.

It is easy to imagine this should happen: the plugins are loaded simultaneously, using a unsynchronised map to add and retrieve data from it. The question is why nobody has reported this problem before.

Hi Anno. Thanks for reporting this. I’m guessing this is a game of chance. I did notice something occasionally (eg https://issues.igniterealtime.org/browse/OF-1051) but not something to an extend that made me give this any priority (I’m running setups with 40+ plugins, which don’t seem to be affected noticeably).

I’ve raised this in the issue tracker as https://issues.igniterealtime.org/browse/OF-1972

It would be very helpful if you could post the stack trace of the exception here - as it’s seemingly difficult for others to reproduce.

That would also be my first reaction, but in the real world things people tends to make simple things, not so simple anymore.

I have seen the stacktrace myself, and looking at the code, the issue looked me obvious. A classic situation a list is looped, while other threads are still adding entries to the list.

Why not copy the tracktrace? Because it would be a lot of handwriting. Openfire in this case is running on closed, disconnected environment on a Solaris OS. This might also be the cause of the issue. Closed network, so no Time server, no synchronized clocks etc. An OS which handles files differently. Opening and closing a file takes much more resources then under windows.

As an example; we had a additional issue when installing plugins, with timestamps in the future. Openfire will then enter in a loop reinstalling the plugins until the timestamp of the plugin jar is not in the future anymore.

1 Like

fwiw: https://issues.igniterealtime.org/browse/OF-1973