← Back to team overview

maria-developers team mailing list archive

Re: Rev 4350: MDEV-6985: MariaDB crashes on stored procedure call

 

On 15.12.14 22:03, Sergei Golubchik wrote:
Hi, Sanja!

On Nov 17, sanja@xxxxxxxxxxxx wrote:
------------------------------------------------------------
revno: 4350
revision-id: sanja@xxxxxxxxxxxx-20141117132635-gf281ipiomifw1oc
parent: psergey@xxxxxxxxxxxx-20141113111559-cuhsyfhor141qo6a
committer: sanja@xxxxxxxxxxxx
branch nick: work-maria-5.5-MDEV-6985
timestamp: Mon 2014-11-17 14:26:35 +0100
message:
   MDEV-6985: MariaDB crashes on stored procedure call
Item_ident fixed to allow double cleanup().
=== modified file 'sql/item.cc'
--- a/sql/item.cc	2014-10-06 17:53:55 +0000
+++ b/sql/item.cc	2014-11-17 13:26:35 +0000
@@ -862,12 +862,20 @@ void Item_ident::cleanup()
  		       field_name ? field_name : "(null)",
                         orig_field_name ? orig_field_name : "(null)"));
  #endif
Before pushing, please remove the above #ifdef, in a separate commit.
thanks!

+  bool was_fixed= fixed;
    Item::cleanup();
    db_name= orig_db_name;
    table_name= orig_table_name;
    field_name= orig_field_name;
    /* Store if this Item was depended */
-  can_be_depended= test(depended_from);
+  if (was_fixed)
+  {
+    /*
+      We can trust that depended_from set correctly only if this item
+      was fixed
+    */
+    can_be_depended= test(depended_from);
+  }
Are double cleanups generally normal? Why this item is cleaned up twice?
Of course it is not so efficient, but we have it (SP works so that it can do cleanup for statement as it executed, than as part of procedure, if you need exact path I can find it again).

Also I can imagine how it can happens in "usual" execution for example we have PS and try to execute it with lack of a table (which cause an error) and so items will be cleanup second time without being used then return table in place and execute PS again and hit this bug.

    DBUG_VOID_RETURN;
  }

Regards,
Sergei




Follow ups

References