Sugestion: Ability to remove plugins while the server is running

Great idea - and please also add a kind of /reload - would make things much more easy!

I don’t really support the idea.
The /reload command causes a lot of bug and memory problem.
I would prefer a configuration reload event or similar.

2 Likes

That would be impossible.
Once a class loader has loaded a class, it cannot be unloaded.
Plugins can affect things outside the scope of its own classes and would be impossible to revert any changes

There was a good discussion about why this won’t be happening over on this thread.

3 Likes

Thanks for linking that instead of just saying it had allready been talked about like most people do.

Good idea :smile:

Isn’t it possible to remove the old plugin instance with some kind of garbage collection to avoid memory leaks?

While a config reload command would be useful, I don’t think memory leaks are too much of an issue during development. Perhaps even block hotswapping off in production builds.

How about require devs to have plugin disable method?

There is no way to guarantee that it is implemented correctly.

Replace “reload” with “remove” or “disable”… it stays the same.

As well look at the original thread for more infos… Plugin reloading/enabling - #18 by teozkr

Classes can be unloaded and they are by the Java VM.

But plugins are often times not self-contained. They connect to other plugins. Other plugins connect to it. It may leave a reference to itself somewhere.

It only takes one hanging reference for it to become impossible to unload a plugin fully.

It is still possible to do a formal reload and tell a plugin to disable itself and then re-enable itself, but there’s no guarantee that there isn’t a memory leak happening going on that will last until the server or game is shutdown.

2 Likes

A feature like this @craftbot101, would be fantastic for mega servers.
One thing to note though, there could be possible bugs client side if such a feature was implemented.
Such a feature would require lots of thought and be carefully planned out and implemented.
Another note, plugins that require dependency’s will crash when the required dependency drops out.
It would be like the /reload all over again. Nasty corrupted files.

  • TangentSpy

yea i used /reload in bukkit many times that the command crashed

If this ever works with normal Sponge plugins…

I’m still sure it will break if using Forge methods from plugin. Not really useful, as I can just restart the server when needed.

One way to compensate this issue with mega servers is to have a an optional feature which allows players to be thrown into a hub server or lobby server on server restart or disconnection. When the server comes back online, the players simply reconnect to that server from the hub server or lobby server.

  • TangentSpy

This is a great idea! but its not possible…
when your server is being turned on it reads all the time all the info the plugins have to give to the server and thats why the server needs the plugin to be installed while its running. however, if it was possible, a plugin that allowed it could lie to the server and say that all the updates the deleted plugin is sending are “nothing” ,however, this action could cause really big performance issues. for example: if a picture will be stolen from a museum and be replaced by a fake one it can cause a lot of problems.

  1. Why would you gravedig this thread?
  2. This is not the way plugins work.
  3. I’m pretty sure there was a function to unload a plugin in Bukkit.

If I’m wrong, please correct me.

Well since plugins are server-side, there is no way you would get client-side bugs (unless, of course, client-side features will be supported in the future). Server-side bugs would be a huge problem though…

1 Like

Plugin developers could implement enable, disable, load, unload and reload features themselves.
Yes, it will take time to do so. But after doing it once, you can kinda copy-paste.

Or, someone can write the basic code for it, and make it available to others (API?).