A Project for Chronicle 4 based on L2JServer.


    [SOLVED] Loosing registered recipes

    Share
    avatar
    Karakan

    Posts : 437
    Join date : 2013-10-04

    [SOLVED] Loosing registered recipes

    Post  Karakan on 24th June 2017, 13:35

    A strange bug appeared few days ago.

    Randomly people (Dwarves) are loosing registered recipes.
    No errors in the log.

    Seems the "character_recipes" data table is not updated probably ?

    Regards Cool
    avatar
    DnR
    Admin
    Admin

    Posts : 1027
    Join date : 2012-12-03

    Re: [SOLVED] Loosing registered recipes

    Post  DnR on 25th June 2017, 13:08

    I'm looking at the code and i would like to confirm something.
    Has any of the reporters performed subclass change?

    Regards,
    DnR
    avatar
    Karakan

    Posts : 437
    Join date : 2013-10-04

    Re: [SOLVED] Loosing registered recipes

    Post  Karakan on 25th June 2017, 14:20

    No,the highest level a player has is 63.  Cool

    I thought it maybe bad MySql settings (my.cnf) but everything looks fine.

    One thing I noted is...
    If you relog the character just after registering the recipe, it seems to stay and save correctly.
    My legit character (artisan) at least didn't loose any recipes since i am doing a relog...so far.

    But another player lost 6 recipes yesterday.


    Site note : All mentioned characters are using offline craft mode frequently.


    Thanks for your time king
    avatar
    Karakan

    Posts : 437
    Join date : 2013-10-04

    Re: [SOLVED] Loosing registered recipes

    Post  Karakan on 25th June 2017, 23:33

    Our source...

    Code:

             L2RecipeList[] recipes = getDwarvenRecipeBook();
             for (L2RecipeList recipe : recipes)
             {
                try (PreparedStatement statement = con.prepareStatement("INSERT INTO character_recipebook (char_id, id, type) values(?,?,1)"))
                {
                   statement.setInt(1, getObjectId());
                   statement.setInt(2, recipe.getId());
                   statement.execute();
                }
             }



    And this is from l2jserver-interlude...

    Code:

             recipes = getDwarvenRecipeBook();
             for (L2RecipeList recipe : recipes)
             {
                statement = con.prepareStatement("INSERT INTO character_recipebook (char_id, id, type) values(?,?,1)");
                statement.setInt(1, getObjectId());
                statement.setInt(2, recipe.getId());
                statement.execute();
                statement.close();
             }




    That "statement.close();" has any importance ?
    Because it is missing in our code.

    Just guessing because I cant think of any other place where it stores recipes into the db in the code.
    avatar
    DnR
    Admin
    Admin

    Posts : 1027
    Join date : 2012-12-03

    Re: [SOLVED] Loosing registered recipes

    Post  DnR on 26th June 2017, 23:04

    Our code uses Java 7 features and try with resources closes statement automatically.
    I'm going to revise the current recipe store method and might update it to a better one.
    avatar
    DnR
    Admin
    Admin

    Posts : 1027
    Join date : 2012-12-03

    Re: [SOLVED] Loosing registered recipes

    Post  DnR on 27th June 2017, 15:33

    Revision 588 solves this problem. Thanks for reporting.

    Sponsored content

    Re: [SOLVED] Loosing registered recipes

    Post  Sponsored content


      Current date/time is 18th December 2017, 18:23