SignShop throws IllegalStateException when enabling plugin
DejaVuMan opened this issue ยท 5 comments
Hello everyone,
This is an issue that I have spent a while searching for, but can't find the cause and doesn't seem to have been reported before here, so I'm hoping submitting this report helps.
During server startup and loading plugins, all other plugins I use (Vault, LuckPerms, The New Economy) manage to initialize and complete loadup properly, but SignShop v3.6.2 throws java.lang.IllegalStateException: Current state = RESET, new state = FLUSHED
and subsequently also throws java.lang.NullPointerException: null
when disabling again.
Full Pastebin lastest.log is available here, and a debug.log here.
Not really sure what the issue possibly could be, it seems to be sqlite DB related - this error tends to occur in multi-threaded environments per IBM's IJ15284 documentation, but I'm not using any mods which would enable multi-threading, could this possibly be Netty IO-related?
This issue occurs both on Mohist (Forge server which implements native support for Paper/Bukkit/Spigot API), as well as the Vanilla Bukkit server I tried (Craftbukkit)
- Server Type and Version: Minecraft Version 1.16.5 | Mohist v961 and CraftBukkit
- SignShop Version: v3.6.2
- Vault Version: v1.7.3-b131
- Economy Plugin: TheNewEconomy v0.1.1.16
- Server Setup: MineOS (FreeBSD 12.2-RELEASE-p12, running inside of jail on TrueNAS Core 12.0-U8
- Java Version: OpenJDK11, v11.0.14
- Additional Details: sqlite 3.37.2 is installed, along with sqlitejdbc 056_2, but the local sqlitejdbc version shouldn't be relevant since you already use sqlitejdbc from Xerial if I'm not mistaken
Off the top of my head, since the issue occurs during what appears to be database initialization, could a pre-generated "template" sqlite db solve the issue?
If additional clarification or details are needed, don't hesitate to ask, I will more than willingly provide it!
Thanks for responding @weaves7
In response to your suggestions, I created a stock Spigot server for the same Minecraft version (1.16.5), running CraftBukkit version 3096a-Spigot-9fb885e-af1a232. The only things enabled are the plugins I was using earlier (so SignShop along with Vault, LuckPerms, TheNewEconomy).
Initially, when the server reached the stage for enabling SignShop, I think it completely crashed - I have a core dump linked here.
Relaunching, the issue changes a bit this time - with only 2GB of RAM allocated, SignShop throws a java.lang.OutOfMemoryError: Java heap space
exception which seems to stem from HeapCharBuffer, but the stacktrace for the exceptions looks largely the same as it did previously. Oddly enough, I can still call on the "/signshop" command.
Calling "/signshop reload" causes the java.lang.NullPointerException: null
exception when disabling the plugin again, and the java.lang.IllegalStateException: Current state = RESET, new state = FLUSHED
exception when attempting to enable again.
That error log, with debug enabled for the minecraft server and spigot, can be found here.
Re-launching the server with 4GB of allocated memory, only the java.lang.IllegalStateException: Current state = RESET, new state = FLUSHED
exception occurs. Again, I can still call on the "/signshop" command, and the "/signshop list" command also works, but "/signshop version" causes a org.bukkit.command.CommandException: Unhandled exception executing command 'signshop' in plugin SignShop v3.6.2
exception warning. That log can be found here
Initially, when the server reached the stage for enabling SignShop, I think it completely crashed - I have a core dump linked here.
I am a self taught java developer so it is possible I could miss something here but SignShop is not even mentioned in that entire dump when searching with ctrl-f. I also looked through it but could not find anything that would help me.
Relaunching, the issue changes a bit this time - with only 2GB of RAM allocated, SignShop throws a
java.lang.OutOfMemoryError: Java heap space
exception which seems to stem from HeapCharBuffer, but the stacktrace for the exceptions looks largely the same as it did previously. Oddly enough, I can still call on the "/signshop" command.
Ok that is weird. SignShop does not directly use HeapCharBuffer and without a stacktrace it is hard to say what called that. It is possible that something that SignShop uses does eventually use a HeapCharBuffer but I don't know what would be passed to it that would have so many characters to cause and OOM error. It is also possible that something on another thread threw that exception and just happened during SignShop's log. Contrary to popular belief Minecraft is multithreaded it just doesn't split any world/player altering tasks between threads but there are seperate threads for I/O and networking and plugins can create new threads for calculations and such. SignShop does utilize some other threads for I/O but unless you have old data with thousands of shops on an old server map that needs to upgrade chunks this has not been an issue. And if it was the fix is to --forceupgrade your chunks or use Chunky.
Just found the stacktrace regarding this and it does appear to be originating from SignShop. I assume this is a fresh install for you and you don't have huge files that it is loading?
Calling "/signshop reload" causes the
java.lang.NullPointerException: null
exception when disabling the plugin again, and thejava.lang.IllegalStateException: Current state = RESET, new state = FLUSHED
exception when attempting to enable again.
It is best to avoid any sort of reload until you can get the server to start properly in the first place. The NPE is likely due to it failing during load. I am still unsure why we get ISE when reloading but that is an issue for another day.
Re-launching the server with 4GB of allocated memory, only the
java.lang.IllegalStateException: Current state = RESET, new state = FLUSHED
exception occurs. Again, I can still call on the "/signshop" command, and the "/signshop list" command also works, but "/signshop version" causes aorg.bukkit.command.CommandException: Unhandled exception executing command 'signshop' in plugin SignShop v3.6.2
exception warning. That log can be found here
I tried setting up a test server that would mimic your setup but I do not have access to:
- Server Setup: MineOS (FreeBSD 12.2-RELEASE-p12, running inside of jail on TrueNAS Core 12.0-U8
The best I could do was same plugins on windows with java 11.0.14.1, hardly the same but as close as I could get, and I did not have any issues. I did some googling and found another plugin with almost the exact same issue which you can read about here: https://githubhot.com/repo/pop4959/LWCX/issues/157
It seems like there is maybe something in the server environment that causes a bug with SQLite and SignShop is just the only plugin currently in your setup that uses it? Perhaps you could try a newer java version or some of the steps outlined in the linked thread?
Regarding the HeapCharBuffer issue, yes, it was a fresh install I tested on
Thank you for trying to replicate the issue on your end and trying to solve it! It does appear to be some issue with the FreeBSD environment I'm running on - I've tried some other plugins which use sqlite (for example, ChestShop) and they exhibit the same issue as well. I've tried Java 12 and Java 16, which exhibit the same behavior with IllegalStateExceptions.
Unfortunately, there isn't very much else I can do on my end, since both TrueNAS and MineOS are FreeBSD-based and it is likely some issue somewhere lower-level in the server environment. However, if you'd like to try and recreate an environment very similar to mine for your own testing in the future, this link about MineOS-On-FreeBSD might prove useful.
I think outside of "switching" from sqlite to H2 or MySQL, there isn't very much that can be really done, but since I do some software development on the side, I might just join the Discord server sometime and try my hand at that
Sorry we couldn't easily solve this, but I think we are headed in the right direction. It does seem like changing storage options could resolve this and I may look into it in the future but since it is not an issue inherintantly wrong with SignShop I am going to close this issue. Feel free to join the Discord so we can discuss future PRs.
Thanks for the detailed report. Unfortunately I am unsure what is causing this. I have seen some IllegalStateExceptions when performing /reload or when a plugin such as Plugman reloads SignShop but I am not sure what causes it and it doesn't happen to everyone every time. Another thing is that SignShop is compiled against Spigot and not CraftBukkit. There has been no testing with Mohist so there is no official support but I will help if I can. With that being said if Mohist runs CraftBukkit and it's forks natively I would guess that it should work. You will likely need to run Mohist with/as Spigot or however that works. You should also test again with the vanilla server as Spigot. Moving forward it would also be nice if you resolved those other issues first that I see in your log particularly with ImmersiveRailroading since it just adds more clutter to our debugging.