InvalidConfigurationException: Invalid JSON detected
TheIntelloBox opened this issue ยท 42 comments
[15:32:14] [Server thread/ERROR]: Cannot load plugins/Multiverse-Inventories/worlds/Survie/TheIntelloBox.json
org.bukkit.configuration.InvalidConfigurationException: Invalid JSON detected.
at com.onarandombox.multiverseinventories.util.JsonConfiguration.loadFromString(JsonConfiguration.java:104) ~[?:?]
at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:184) ~[spigot-1.11.jar:git-Spigot-f950f8e-4d99fed]
at org.bukkit.configuration.file.FileConfiguration.load(FileConfiguration.java:130) ~[spigot-1.11.jar:git-Spigot-f950f8e-4d99fed]
at com.onarandombox.multiverseinventories.util.JsonConfiguration.(JsonConfiguration.java:184) [Multiverse-Inventories-2.5.jar:?]
at com.onarandombox.multiverseinventories.util.EncodedJsonConfiguration.(EncodedJsonConfiguration.java:20) [Multiverse-Inventories-2.5.jar:?]
at com.onarandombox.multiverseinventories.util.data.FlatFilePlayerData.getConfigHandle(FlatFilePlayerData.java:77) [Multiverse-Inventories-2.5.jar:?]
at com.onarandombox.multiverseinventories.util.data.FlatFilePlayerData.getPlayerData(FlatFilePlayerData.java:269) [Multiverse-Inventories-2.5.jar:?]
at com.onarandombox.multiverseinventories.WeakProfileContainer.getPlayerData(WeakProfileContainer.java:98) [Multiverse-Inventories-2.5.jar:?]
at com.onarandombox.multiverseinventories.WeakProfileContainer.getPlayerData(WeakProfileContainer.java:87) [Multiverse-Inventories-2.5.jar:?]
at com.onarandombox.multiverseinventories.WorldChangeShareHandler.handle(WorldChangeShareHandler.java:33) [Multiverse-Inventories-2.5.jar:?]
at com.onarandombox.multiverseinventories.ShareHandler.handleSharing(ShareHandler.java:56) [Multiverse-Inventories-2.5.jar:?]
at com.onarandombox.multiverseinventories.InventoriesListener.playerChangedWorld(InventoriesListener.java:183) [Multiverse-Inventories-2.5.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_72]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_72]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_72]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_72]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) [spigot-1.11.jar:git-Spigot-f950f8e-4d99fed]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) [spigot-1.11.jar:git-Spigot-f950f8e-4d99fed]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot-1.11.jar:git-Spigot-f950f8e-4d99fed]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot-1.11.jar:git-Spigot-f950f8e-4d99fed]
at net.minecraft.server.v1_11_R1.PlayerList.moveToWorld(PlayerList.java:689) [spigot-1.11.jar:git-Spigot-f950f8e-4d99fed]
at org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer.teleport(CraftPlayer.java:506) [spigot-1.11.jar:git-Spigot-f950f8e-4d99fed]
at com.earth2me.essentials.Teleport.now(Teleport.java:113) [Essentials-2.x-SNAPSHOT%20(2).jar:?]
at com.earth2me.essentials.Teleport.teleport(Teleport.java:194) [Essentials-2.x-SNAPSHOT%20(2).jar:?]
at com.earth2me.essentials.Teleport.teleport(Teleport.java:151) [Essentials-2.x-SNAPSHOT%20(2).jar:?]
at com.earth2me.essentials.commands.Commandtp.run(Commandtp.java:41) [Essentials-2.x-SNAPSHOT%20(2).jar:?]
at com.earth2me.essentials.commands.EssentialsCommand.run(EssentialsCommand.java:180) [Essentials-2.x-SNAPSHOT%20(2).jar:?]
at com.earth2me.essentials.Essentials.onCommandEssentials(Essentials.java:526) [Essentials-2.x-SNAPSHOT%20(2).jar:?]
at com.earth2me.essentials.Essentials.onCommand(Essentials.java:401) [Essentials-2.x-SNAPSHOT%20(2).jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) [spigot-1.11.jar:git-Spigot-f950f8e-4d99fed]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [spigot-1.11.jar:git-Spigot-f950f8e-4d99fed]
at org.bukkit.craftbukkit.v1_11_R1.CraftServer.dispatchCommand(CraftServer.java:649) [spigot-1.11.jar:git-Spigot-f950f8e-4d99fed]
at net.minecraft.server.v1_11_R1.PlayerConnection.handleCommand(PlayerConnection.java:1335) [spigot-1.11.jar:git-Spigot-f950f8e-4d99fed]
at net.minecraft.server.v1_11_R1.PlayerConnection.a(PlayerConnection.java:1170) [spigot-1.11.jar:git-Spigot-f950f8e-4d99fed]
at net.minecraft.server.v1_11_R1.PacketPlayInChat.a(PacketPlayInChat.java:45) [spigot-1.11.jar:git-Spigot-f950f8e-4d99fed]
at net.minecraft.server.v1_11_R1.PacketPlayInChat.a(PacketPlayInChat.java:1) [spigot-1.11.jar:git-Spigot-f950f8e-4d99fed]
at net.minecraft.server.v1_11_R1.PlayerConnectionUtils$1.run(SourceFile:13) [spigot-1.11.jar:git-Spigot-f950f8e-4d99fed]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_72]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_72]
at net.minecraft.server.v1_11_R1.SystemUtils.a(SourceFile:46) [spigot-1.11.jar:git-Spigot-f950f8e-4d99fed]
at net.minecraft.server.v1_11_R1.MinecraftServer.D(MinecraftServer.java:739) [spigot-1.11.jar:git-Spigot-f950f8e-4d99fed]
at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:399) [spigot-1.11.jar:git-Spigot-f950f8e-4d99fed]
at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:675) [spigot-1.11.jar:git-Spigot-f950f8e-4d99fed]
at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:574) [spigot-1.11.jar:git-Spigot-f950f8e-4d99fed]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_72]
My player CreeperGameur has the same bug. His inventory : https://ghostbin.com/paste/uzkvz
Since 1.9, there is the second hand so maybe the bug is this. And I have this bug too : #296
Can you please post the contents of plugins/Multiverse-Inventories/worlds/Survie/TheIntelloBox.json to https://ghostbin.com/ and share the link here?
So, it turns out that HIDE_ENCHANTS ItemFlag is not being serialized properly, perhaps by Bukkit? I'm kinda confused as to why this would happen...
Well... Switching back to yaml would solve it. However, If I do that I'm not going to provide a conversion. Turns out the reason this is happening is because of how CraftMetaItem serializes ItemFlags. They're using a Set for some unknown reason. I really cannot comprehend why they're doing it this way as there seems to be no benefit to it. Because they are doing it that way, it's making it difficult for my JsonConfiguration to serialize it properly. I'm trying to think of a solution but it'll take some time.
So, this is technically a "bug" in CraftBukkit that is causing this. See more here https://hub.spigotmc.org/jira/browse/SPIGOT-3336. If they don't accept my PR then this is going to be much more difficult to fix.
Please try this build https://ci.onarandombox.com/job/Multiverse-Inventories/421/.
If it still shows errors they will now be more helpful.
Oh, actually, the changes only fix it for NEW data that is created. Unfortunately any data that was corrupted with invalid JSON is always going to give this error. Only way you're going to fix it is by manually scrubbing all the invalid JSON data... you'd probably need some kind of script to do this without losing your mind.
Just note that when new data is saved for the world/group that the corrupted data was in, it should fix it for that case. So in other words, if you don't fix it manually, it will slowly fix itself over time.
Yep. Just dl latest development build. Https://ci.onarandombox.com
Sent from my Samsung SM-G935T using FastHub
Any items with these attributes: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/ItemFlag.html
Please update me with new errors on that version I posted. I need to see if there is more detail in the errors now which could help determine a way to single out those items.
No. I don't believe there is any way to convert the data. The reason is because it cannot be loaded as Json data. Since it can't be loaded as Json data it can't be converted to something else. Best case scenario is you could have something that deletes all of the files that have invalid data. That would stop you from seeing the error but people would still lose their inventories, obviously.
Sent from my Samsung SM-G935T using FastHub
Tested old inventory data with spigot b421.
Error log generated by teleporting from world "world" to "borderlands": https://pastebin.com/cUZnQ6mT
Well, unfortunately the extra error data doesn't seem to be helpful in figuring out a better way to handle this. Also, all of your example data is valid JSON. I think maybe the invalid stuff has already been overwritten by valid stuff.
Cheers for the feedback. The links to the json data where from a backup, and I have been restoring that backup to test the issue each time (because it deletes the inventory).
Hmm... I'll have to look into this more carefully then.
Sent from my Samsung SM-G935T using FastHub
@sorifiend As I explained, that is to be expected with old data. What I really need is for someone to test that same old data with the newest build and show me the errors using that.
Sorry I had re-uploaded b420 to my server by mistake.
Stack trace for b421 here: https://pastebin.com/Y88sU1YA
Edit: Just in case you wanted to test the old data yourself, here are the links
Contents of plugins/Multiverse-Inventories/worlds/Fiordland/sorifiend.json: https://pastebin.com/pUmScnJi
Contents of plugins/Multiverse-Inventories/groups/Fiordland/sorifiend.json: https://pastebin.com/Mtzzxig3
Contents of plugins/Multiverse-Inventories/groups/Borderlands/sorifiend.json: https://pastebin.com/V3Qd7KzK
Else ask away, I will do whatever testing is needed.
My players has their inventory cleared. Before, they haven't a strange inventory. and now they have a strange json error in the console...
Yeah, form memory the 2016 builds just spat out console errors, but retained the inventory. But after one of the recent 2017 builds (not sure which build I first tested) it seems to be erasing all players inventory when they change worlds (If they stay in the world they log into then its fine).
Look this error : https://hastebin.com/jebimanito.sql
We may be chasing two issues here.
I did some testing with build 418 vs 419 vs 421:
On a fresh server with build 418 everything seems to work perfectly with new data (Besides the fixes we need from commit 781162f and 2f03186), but old data is still an issue like reported in the very first post.
On a fresh server with build 419 or above it breaks both new data as well as old data (teleport out of a world twice to experience this on a fresh server so that it has time to generate inventory files).
For build 419 to 421 the following lines in the error log indicate that the most recent issue was from the new JSON external lib code, rather than with internal multiverse inventories code?
at com.onarandombox.multiverseinventories.util.configuration.json.JsonConfiguration.loadConfiguration(JsonConfiguration.java:108) [Multiverse-Inventories-2.5.0-SNAPSHOT(2).jar:?]
at com.onarandombox.multiverseinventories.util.configuration.json.JsonConfiguration.loadConfiguration(JsonConfiguration.java:157) [Multiverse-Inventories-2.5.0-SNAPSHOT(2).jar:?]
at com.onarandombox.multiverseinventories.util.data.FlatFilePlayerData.getConfigHandle(FlatFilePlayerData.java:76) [Multiverse-Inventories-2.5.0-SNAPSHOT(2).jar:?]
at com.onarandombox.multiverseinventories.util.data.FlatFilePlayerData.processProfileWrite(FlatFilePlayerData.java:240) [Multiverse-Inventories-2.5.0-SNAPSHOT(2).jar:?]
In all of the recent error logs from myself or TheIntelloBox since b419 those same 4 lines show up.
Should we open this as a new issue for the external JSON lib before tackling the old data issue?
@sorifiend I ran some tests on the JsonConfiguration library by itself using only the data you provided and it is able to load them with no issues. I'm really stumped now.
Did you see my error ?
https://hastebin.com/jebimanito.sql
Okay, nevermind, I just got something new in the testing. When the data is loaded as a string it works fine. When it is loaded from a file it does not. Now I know where to look.
Well, thing is, the external lib is my own. The JsonConfiguration lib started from what I created in MV-Inv. I just figured any updates should probably go there. I was attempting to update the lib to support sets (since that was where this problem originally came from) but it seems something I've done in the process broke something else. The main issue actually seems to be in the json-smart lib since that is actually where the error comes from. I did update the version of json-smart I was using so perhaps the change is version broke something. I am going to investigate this further today.
Okay, please try out build 422 https://ci.onarandombox.com/job/Multiverse-Inventories/422/
@sorifiend @TheIntelloBox If either of you are interested in helping with this revival of MV-Inv I'd love to create a conversation on discord: https://discord.gg/NZtfKky