Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvalidConfigurationException: Invalid JSON detected #302

Closed
TheIntelloBox opened this issue Dec 2, 2016 · 42 comments
Closed

InvalidConfigurationException: Invalid JSON detected #302

TheIntelloBox opened this issue Dec 2, 2016 · 42 comments
Labels
Bug: Confirmed Issue/problem with the software. Bug: Unconfirmed Unsure if the issue/bug is valid.
Milestone

Comments

@TheIntelloBox
Copy link

[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]

@dumptruckman
Copy link
Member

Can you please post the contents of plugins/Multiverse-Inventories/worlds/Survie/TheIntelloBox.json to https://ghostbin.com/ and share the link here?

@dumptruckman dumptruckman added Bug: Confirmed Issue/problem with the software. State: Not Enough Information Author does not provide enough info to justify the issue. Bug: Unconfirmed Unsure if the issue/bug is valid. labels Jun 7, 2017
@dumptruckman dumptruckman added this to the Resurrection milestone Jun 7, 2017
@dumptruckman dumptruckman changed the title Error in 1.11. InvalidConfigurationException: Invalid JSON detected Jun 7, 2017
@TheIntelloBox
Copy link
Author

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

@dumptruckman
Copy link
Member

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...

@TheIntelloBox
Copy link
Author

How to solve it ?

@dumptruckman
Copy link
Member

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.

@TheIntelloBox
Copy link
Author

Hey,

Mhh yes it's strange. How could you solve it ?

@dumptruckman
Copy link
Member

dumptruckman commented Jun 13, 2017

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.

@dumptruckman dumptruckman removed State: Not Enough Information Author does not provide enough info to justify the issue. Bug: Unconfirmed Unsure if the issue/bug is valid. labels Jun 13, 2017
@TheIntelloBox
Copy link
Author

Okay. :c My players lose sometimes their items too with this bug.

@dumptruckman
Copy link
Member

I figured out a workaround.

@TheIntelloBox
Copy link
Author

It's fixed ?

@dumptruckman
Copy link
Member

Yep. Just dl latest development build. Https://ci.onarandombox.com

Sent from my Samsung SM-G935T using FastHub

@TheIntelloBox
Copy link
Author

@dumptruckman
Copy link
Member

dumptruckman commented Jun 14, 2017

Please try this build https://ci.onarandombox.com/job/Multiverse-Inventories/421/.

If it still shows errors they will now be more helpful.

@dumptruckman dumptruckman reopened this Jun 14, 2017
@dumptruckman
Copy link
Member

dumptruckman commented Jun 14, 2017

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.

@TheIntelloBox
Copy link
Author

Is there a converter ?

@dumptruckman
Copy link
Member

dumptruckman commented Jun 14, 2017

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

@TheIntelloBox
Copy link
Author

Which items are causing this issue ? :D

@dumptruckman
Copy link
Member

@dumptruckman
Copy link
Member

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.

@sorifiend
Copy link

sorifiend commented Jun 15, 2017

Tested old inventory data with spigot b421.
Error log generated by teleporting from world "world" to "borderlands": https://pastebin.com/cUZnQ6mT

@dumptruckman
Copy link
Member

@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.

@sorifiend
Copy link

sorifiend commented Jun 15, 2017

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.

@dumptruckman
Copy link
Member

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.

@sorifiend
Copy link

sorifiend commented Jun 15, 2017

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).

@dumptruckman
Copy link
Member

Hmm... I'll have to look into this more carefully then.

Sent from my Samsung SM-G935T using FastHub

@TheIntelloBox
Copy link
Author

My players has their inventory cleared. Before, they haven't a strange inventory. and now they have a strange json error in the console...

@dumptruckman
Copy link
Member

So you're saying it is worse than before?

@sorifiend
Copy link

sorifiend commented Jun 15, 2017

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).

@dumptruckman dumptruckman reopened this Jun 15, 2017
@dumptruckman dumptruckman added the Bug: Unconfirmed Unsure if the issue/bug is valid. label Jun 15, 2017
@TheIntelloBox
Copy link
Author

Look this error : https://hastebin.com/jebimanito.sql

@sorifiend
Copy link

sorifiend commented Jun 16, 2017

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?

@dumptruckman
Copy link
Member

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.

@TheIntelloBox
Copy link
Author

It's very worse than before, please fix it quickly. :(

@dumptruckman
Copy link
Member

You should probably go back to build 418 for the time being.

@dumptruckman
Copy link
Member

@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.

@TheIntelloBox
Copy link
Author

Did you see my error ?
https://hastebin.com/jebimanito.sql

@dumptruckman
Copy link
Member

Same as before

@TheIntelloBox
Copy link
Author

So what's the problem you think ?

@dumptruckman
Copy link
Member

I'm really not sure. As I previously mentioned, I am stumped.

@dumptruckman
Copy link
Member

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.

@dumptruckman
Copy link
Member

Okay, please try out build 422 https://ci.onarandombox.com/job/Multiverse-Inventories/422/

@sorifiend
Copy link

sorifiend commented Jun 17, 2017

Everything seems to be working again perfectly using build 422 with both old and new data.

I will run build 422 on a test server and get some people to test it, and will report back if I am able to reproduce the original issue, but I think commit 781162f and 2f03186 have fixed that issue.

@dumptruckman
Copy link
Member

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Confirmed Issue/problem with the software. Bug: Unconfirmed Unsure if the issue/bug is valid.
Projects
None yet
Development

No branches or pull requests

3 participants