Improper caching causing dupes for offline players #49

Closed
opened 2016-07-09 11:14:17 -04:00 by Jikoo · 2 comments
Jikoo commented 2016-07-09 11:14:17 -04:00 (Migrated from github.com)

Jikoo#10

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

The root cause is that the ISpecialEnderChest and ISpecialPlayerInventory implementations do not use the same Player object. That means that whichever saves last causes the other inventory to revert to its previous state, provided the actual Player does not log in before the server is restarted.

Jikoo#10 > 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 The root cause is that the ISpecialEnderChest and ISpecialPlayerInventory implementations do not use the same Player object. That means that whichever saves last causes the other inventory to revert to its previous state, provided the actual Player does not log in before the server is restarted.
Jikoo commented 2016-07-10 08:05:30 -04:00 (Migrated from github.com)

For fixes, Phoenix616 has an elegantly simple fix in 0665dec.
My fix (23bda96) also works, but uses a much more beefy system mainly aimed around not caching players who haven't logged in forever.

For fixes, Phoenix616 has an elegantly simple fix in 0665dec. My fix (23bda96) also works, but uses a much more beefy system mainly aimed around not caching players who haven't logged in forever.
Jikoo commented 2016-11-26 00:57:43 -05:00 (Migrated from github.com)

Fixed in 3.0.0

Fixed in 3.0.0
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: minster586/OpenInv#49
No description provided.