OpenInv

4M Downloads

Improper caching causing dupes for offline players

Jikoo opened this issue ยท 3 comments

commented

This is a rare case. The Player loaded by the PlayerDataManager is a new object for SpecialEnderChest and SpecialPlayerInventory.

To replicate dupe/overwrite issues:

  1. Open an offline player's inventory to cache it
  2. Open the offline player's ender chest to cache it
  3. Edit both inventories
  4. Restart server to clear cached inventories (cached inventories only clear when players go offline - some retention policy would be good, the current state is bad)
  5. Reopen inventories to see whichever was closed first reverted to previous state

To fix this, I'm probably going to implement a cache system similar to Guava's - while the inventory has viewers, players will be loaded. After that there will be a brief period, probably a couple minutes, where they (and the relevant inventories) remain cached in case of a re-open.
This will also allow us to further reduce redundant saves pretty simply - saving really only needs to happen when a player is removed from the cache.

commented

Cool thanks.
However the armor row disappeared, what happened there?

commented

Odd, it seemed to work fine in testing, I'll look into it. I bet I accidentally removed the override on inventory size when removing redundant methods
Edit: YEP I DID AM GUD CODE, will have a fix out shortly. Only 1.10 was affected, by the looks of things.

commented

Fixed now, thanks alot!