brunyman / CustomEnderChest

8 stars 14 forks source link

Dupe bug #9

Open CryLegende opened 4 years ago

CryLegende commented 4 years ago

Hello, I have a very important dupe bug Remove an item from your enderchest, disconnect then reconnect and congratulation, you are now a h@cker. The item is still in your inventory but also back in your enderchest

Server: PaperSpigot 1.12.2 (latest build) CustomEC: Version 1.12.2 PlayedData: Only 770 yet typeOfDatabase: FlatFile modded-NBT-data-support: true

Thank you for your help

MaximeMichaud commented 4 years ago

Hi ! Do you have ProtocolLib for modded NBT support ? And you should try with MYSQL !

CryLegende commented 4 years ago

I have ProtocolLib yes ^^ Why should I switch to MySQL and waste bandwidth? :/

CryLegende commented 4 years ago

I think CustomEC should offer SQLite to have the advantages of MySQL while staying local.

MaximeMichaud commented 4 years ago

I have ProtocolLib yes ^^ Why should I switch to MySQL and waste bandwidth? :/

You can use MYSQL in local :P Without "wasting" bandwidth. I agree SQLite would be nice, but I don't think that is planned. So, use MYSQL... That will fix a lot of problem(s) ;)

CryLegende commented 4 years ago

I just tested MySQL, in the migration I had no error but half of my players have nothing left in their enderchest

MaximeMichaud commented 4 years ago

Yeah, I see. I don't know where it comes from. I had the same but I fixed it. You should do the migration without online players and maybe use "ec importFromFlatFile overwrite"

CryLegende commented 4 years ago

I have done the migration without online players and with "ec importFromFlatFile overwrite"

MaximeMichaud commented 4 years ago

OK Try to reset the Table that CustomEnderChest use. And retry. It working in this way for me. I don't remember what precisely was the solution. But can you try to turn off : modded-NBT-data-support If you don't use it.

CryLegende commented 4 years ago

I use it

MaximeMichaud commented 4 years ago

You use it in what way ? Try to see if this can trigger the migration. Mine is off and I don't have any problems. I think that was the solution when I was trying to transfer to MYSQL

CryLegende commented 4 years ago

I have items that use nbt to save data "Try to reset the Table that CustomEnderChest use. And retry. It working in this way for me." Done but now, I restarted my server and it freezes up to 3 minutes when fully started Is the connection to the database not thread safe?

MaximeMichaud commented 4 years ago

Freezes ? Any log? Or anything. Thread safe ?

CryLegende commented 4 years ago

Thread safe = async No log, just a 3 minutes freeze as if time had stopped and then started again 3 minutes later.

CryLegende commented 4 years ago

[05:52:51] [Netty Epoll Server IO #1/INFO]: [ViaVersion] Using FastUtil Long2ObjectOpenHashMap for block connections [05:55:23] [User Authenticator #1/INFO]: [LuckPerms] Processing pre-login for eca495b2-be26-3fb4-949c-f32d3d31b077 - TonyCrafting02 (Look at the time between these two actions)

I just tested without the plugin and there is no freeze

MaximeMichaud commented 4 years ago

Async or not, I don't think that change something in the lag problem. Strange

Try without NBT Support. I have non-vanilla enchantments, items and no issue occurred.

CryLegende commented 4 years ago

If the plugin checks the 789 players in the database on the main thread then it will cause a freeze But the best is to wait for the developer to give us the answer I think

Custom enchants ≠ NBT

CryLegende commented 4 years ago

If I try and it breaks all the items with NBT or transforms them into normal items, there will be no turning back then I will not try without the advice of the developer, sorry :/

MaximeMichaud commented 4 years ago

I try to understand what type of NBT items you are using.

And migration is not taking "3 minutes of freeze". If you use the command that I give you, you should have seen migration of every enderchest one per one in console.

You can try to mention the author. That your only chance. If I was you, backup and try what I told you.

CryLegende commented 4 years ago

The freeze is not during the migration but when starting my server since I switched to MySQL

MaximeMichaud commented 4 years ago

I don't remember mine. But it was when the server was open. And I didn't connect my main account because that was causing blank enderchest every time.

brunyman commented 4 years ago

I will first do some tests for dupe, changes to enderchest are saved when you close the inventory. Also post your server log so I can see when it freezes.

CryLegende commented 4 years ago

[05:52:44] [Server thread/INFO]: Using epoll channel type [05:52:44] [Server thread/INFO]: Timings Reset [05:55:27] [User Authenticator #1/INFO]: UUID of player TonyCrafting02 is eca495b2-be26-3fb4-949c-f32d3d31b077 [05:55:27] [Server thread/INFO]: [LuckPerms] Processing login for eca495b2-be26-3fb4-949c-f32d3d31b077 - TonyCrafting02

As I said, once the server is fully started it freezes ^^' (Look at the time between these actions)

brunyman commented 4 years ago

[05:52:44] [Server thread/INFO]: Using epoll channel type [05:52:44] [Server thread/INFO]: Timings Reset [05:55:27] [User Authenticator #1/INFO]: UUID of player TonyCrafting02 is eca495b2-be26-3fb4-949c-f32d3d31b077 [05:55:27] [Server thread/INFO]: [LuckPerms] Processing login for eca495b2-be26-3fb4-949c-f32d3d31b077 - TonyCrafting02

As I said, once the server is fully started it freezes ^^' (Look at the time between these actions)

I will need a full log, to see the plugin loading messages, this does not tell me anything about what can cause it.

I also did tests on my server, flatfile with NBT support on or off, does not matter as NBT support is for mysql only, I have no issues what so ever, data is saved successfully way before I reconnect, so I can't reproduce this dupe

CryLegende commented 4 years ago

Several players can easily duplicate and others absolutely cannot I tried on the account of a person who could duplicate and It's worked but on my account, I can't

My server accepts crack, maybe it has something to do with uuid? (I use bungeecord too)

brunyman commented 4 years ago

Is the player you tested on cracked? Even so it should not happen, this plugin just get's the UUID the server provides it should not matter if it is premium or not. There is also a delay upon join saying plase wait until enderchest loads, do you get that message?

CryLegende commented 4 years ago

The player I tested with is cracked Yes, i have the message

brunyman commented 4 years ago

Ok, please check the player enderchest data file and see if after he disconnects his data file still has the item that was removed in it, before he joins back

CryLegende commented 4 years ago

Sorry for the delay

please check the player enderchest data file

I can't, the uuid of the player and the uuid of the data file is not the same

A player sent this to me: https://www.youtube.com/watch?v=b5F4AjeFq-4

MaximeMichaud commented 4 years ago

Interesting. I never had.

CryLegende commented 4 years ago

I would sincerely like to go to mysql but most players lose their enderchest so I can't :/

garrettsummerfi3ld commented 4 years ago

@CryLegende You can import the file using /customenderchest importFromFlatFile I am having a similar issue: Before and after migrating from FlatFile to a MySQL server (and vice versa), items disappear on join, or outright be replaced by other items already placed when the plugin bugged out.

This log is after the migrate from FlatFile to MySQL. I think this is what is causing other issues.

Player joins, and clicks on a chest. I can grab more output as needed.

[+] unlucky_dem0n
WARN 21:33:55
java.lang.IllegalArgumentException: Item cannot be null
at org.apache.commons.lang.Validate.noNullElements(Validate.java:364)
at org.bukkit.craftbukkit.v1_15_R1.inventory.CraftInventory.addItem(CraftInventory.java:287)
at net.craftersland.customenderchest.storage.MysqlStorage.decodeInventory(MysqlStorage.java:303)
at net.craftersland.customenderchest.storage.MysqlStorage.loadEnderChest(MysqlStorage.java:264)
at net.craftersland.customenderchest.DataHandler.loadPlayerFromStorage(DataHandler.java:65)
at net.craftersland.customenderchest.PlayerHandler$1.run(PlayerHandler.java:54)
at org.bukkit.craftbukkit.v1_15_R1.scheduler.CraftTask.run(CraftTask.java:84)
at org.bukkit.craftbukkit.v1_15_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54)
at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:821)
ERROR 21:33:55
[CustomEnderChest]: Failed to decode inventory for unlucky_dem0n! Error: Illegal character in Base64 encoded data.
WARN 21:33:55
java.lang.IllegalArgumentException: Illegal character in Base64 encoded data.
at org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder.decode(Base64Coder.java:288)
at org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder.decodeLines(Base64Coder.java:218)
at net.craftersland.customenderchest.utils.EncodingUtil.fromBase64(EncodingUtil.java:37)
at net.craftersland.customenderchest.storage.MysqlStorage.decodeInventory(MysqlStorage.java:311)
at net.craftersland.customenderchest.storage.MysqlStorage.loadEnderChest(MysqlStorage.java:264)
at net.craftersland.customenderchest.DataHandler.loadPlayerFromStorage(DataHandler.java:65)
at net.craftersland.customenderchest.PlayerHandler$1.run(PlayerHandler.java:54)
at org.bukkit.craftbukkit.v1_15_R1.scheduler.CraftTask.run(CraftTask.java:84)
at org.bukkit.craftbukkit.v1_15_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54)
at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:821)
CryLegende commented 4 years ago

I know for the command but when I do that, around 50% of players have nothing left in their enderchest after migration And 50% of 21500 that's a lot of people

CryLegende commented 4 years ago

Hello, any news ?

evrest commented 4 years ago

Hello how did you put your mysql , i have all the stuff except the table, and how to create one for custom enderchest ?