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
{{ message }}
Repository navigation
[BUG] The ServerPlugin.stop() function could be called multiple times when the server shuts down. #120
Describe the bug
Not sure how to explain this one. I'm working on a plugin for OIE and I was struggling with some errors appearing on the mirth.log file on server shutdown.
If you look at the initPlugins function, you can see that each plugin will be put in a specific map according to their plugin type (here, here, here, etc.), but they are also added to an ArrayList of server plugins.
Now if you look at the stopPlugins function that is called when the server shuts down, you'll see that the stop function is called for each plugin in the array list, thus, multiple times if you have a class that implements multiple ServerPlugin.
To Reproduce
Create a plugin that implements multiple "ServerPlugin" interface. Let's say I have a class that implements the ServicePlugin interface that also implements the ChannelPlugin (cuz the service needs to intercept channel creation, save, deletion, etc.). Then the "stop()" function will be called twice.
Expected behavior
The "stop" function should be called only once.
Actual behavior
The "stop" function is called according to the number of "ServerPlugin" interfaces the class implements.
Workaround(s)
Create a dedicated class for each type of ServerPlugin you want to implement. Then if you have something to do that can only be done once, do it in the proper class implementation.
Additional context
I would be happy to work on this one if the community thinks it would nice to solve this.
Not sure how to explain this one. I'm working on a plugin for OIE and I was struggling with some errors appearing on the mirth.log file on server shutdown.
What errors did you see on server shutdown?
Can you also show a snippet of what your plugins stop implementation looks like? a solution may be to make either your plugin, or OIE, tolerate calling stop() more than once.
But it feels odd and probably not the intended behavior. This isn't a big problem. But when you develop a plugin, you don't expect to have to manage your "stop" function to be called multiple time by the framework.
Could be resolved by documenting this behavior. DO NOT implement more than 1 server plugin interface in the same class.
changed the title [-][BUG] The ServerPlugin.close() function could be called multiple times when the server shuts down.[/-][+][BUG] The ServerPlugin.stop() function could be called multiple times when the server shuts down.[/+]on Jul 30, 2026
Activity
jonbartels commentedon Jul 30, 2026
What errors did you see on server shutdown?
Can you also show a snippet of what your plugins
stopimplementation looks like? a solution may be to make either your plugin, or OIE, tolerate callingstop()more than once.sbraconnier-op3c commentedon Jul 30, 2026
This is what I did.
And my case was about closing a connection pool.
But it feels odd and probably not the intended behavior. This isn't a big problem. But when you develop a plugin, you don't expect to have to manage your "stop" function to be called multiple time by the framework.
Could be resolved by documenting this behavior. DO NOT implement more than 1 server plugin interface in the same class.
Manageable, but not ideal...
[-][BUG] The ServerPlugin.close() function could be called multiple times when the server shuts down.[/-][+][BUG] The ServerPlugin.stop() function could be called multiple times when the server shuts down.[/+]Fix OpenIntegrationEngine#120: start and stop each server plugin only…