L2JMobius

C6 Shutdown and strange items loss

ver · 9 · 6994

Offline ver

  • Knight
  • ***
    • Posts: 70
Hello,

I've performed simple shutdown procedure. Gave ppl like 60 secs.
Unfortunatelly during that time the items that were created/spoiled in last 30..40 mins were gone. Looks like items were not stored in DB during the shutdown.

Is it normal? Guess not?

Best regards


Online G-hamsteR

  • Viscount
  • *****
    • Posts: 332
Did you receive any error logs? I have never had the same problem. 500 players online without item loss.



Online G-hamsteR

  • Viscount
  • *****
    • Posts: 332
I think the problem is with your mysql server and not with the gameserver. All changes are sent to mysql. Maybe mysql crashed and lost some data.


Offline ver

  • Knight
  • ***
    • Posts: 70
This is exactly what I suspected at the first.
Checked database, all logs on my box, even tables structure (maybe they are corrupted or something). But not... All was pretty much normal.

Today I made simple shutdown with 120 sec. All went fine. Server got closed etc. No errors whatsoever.

After the start it appeared that some dropped items in line 15..20 min before, was not inserted in items table. It looks like it was just in memory/some java threads and simply just not inserted when it suppose to be.

Maybe there is something there?  Like items are stored in db to rarely? (Dunno, just made up shot in a dark).


Offline ver

  • Knight
  • ***
    • Posts: 70
After all - its not so strange. The players inventory was not stored at all on shutdown procedure because store() method is not saveing that...

File: java/org/l2jmobius/gameserver/Shutdown.java  (manually created patch)
Code: [Select]
      private void saveAllPlayers()
        {
                LOGGER.info("Saving all players data...");

                for (PlayerInstance player : World.getInstance().getAllPlayers())
                {
                        if (player == null)
                        {
                                continue;
                        }

                        // Logout Character
                        try
                        {
                                // Save player status
                                player.store();
                                player.getInventory().updateDatabase();
                                player.getWarehouse().updateDatabase();

                        }
                        catch (Throwable t)
                        {
                        }
                }
        }


I don't know if its proper fix, but at least it does save players stuff.



Online Mobius

  • Distinguished King
  • *****
    • Posts: 16035
Can you try this instead?
Code: [Select]
Index: java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
===================================================================
--- java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java (revision 8154)
+++ java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java (working copy)
@@ -8583,6 +8583,10 @@
  aVars.storeMe();
  }
 
+ getInventory().updateDatabase();
+ getWarehouse().updateDatabase();
+ getFreight().updateDatabase();
+
  // If char is in Offline trade, setStored must be true
  setStored(isInOfflineMode());
  }