Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-41817

Crash on cyclic package specifications (parameter defaults call each other)

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 13.1, 13.2, 13.3
    • 13.1
    • Stored routines
    • None

    Description

      Crash on cyclic package specifications (parameter defaults call each other)

      -- Two package specifications whose parameter defaults call routines of each
      -- other: both CREATE PACKAGE succeed, because the other package is not stored
      -- yet. CREATE PACKAGE BODY px (line 17) loads PX, which loads PY, which loads
      -- PX again (it is not cached yet), until a stack overrun.
      SET sql_mode=ORACLE;
      DELIMITER $$
      CREATE OR REPLACE PACKAGE px AS
        FUNCTION g RETURN INT;
        FUNCTION f(a INT := py.h()) RETURN INT;
      END;
      $$
      CREATE OR REPLACE PACKAGE py AS
        FUNCTION h RETURN INT;
        FUNCTION k(a INT := px.g()) RETURN INT;
      END;
      $$
      CREATE PACKAGE BODY px AS
        FUNCTION g RETURN INT AS BEGIN RETURN 1; END;
        FUNCTION f(a INT := py.h()) RETURN INT AS BEGIN RETURN a; END;
      END;
      $$
      CREATE PACKAGE BODY py AS
        FUNCTION h RETURN INT AS BEGIN RETURN 2; END;
        FUNCTION k(a INT := px.g()) RETURN INT AS BEGIN RETURN a; END;
      END;
      $$
      DELIMITER ;
      SELECT px.g();
      

      #0  0x00007ffff7082e7c in __pthread_kill_implementation ()
         from /lib64/libc.so.6
      #1  0x00007ffff7028f0e in raise () from /lib64/libc.so.6
      #2  0x00007ffff70106d0 in abort () from /lib64/libc.so.6
      #3  0x00007ffff7010639 in __assert_fail_base.cold () from /lib64/libc.so.6
      #4  0x000055555561c413 in Sp_handler::find_package_spec (thd=0x77ffa8000dd0, 
          db=..., package=...) at /home/bar/maria-git/13.2/sql/sp.cc:2569
      #5  0x000055555561c4ca in is_package_public_routine (thd=0x77ffa8000dd0, 
          db=..., package=..., routine=..., type=SP_TYPE_FUNCTION)
          at /home/bar/maria-git/13.2/sql/sp.cc:2612
      #6  0x00005555555eb61e in Sql_path::try_resolve_in_schema (
          this=0x77ffa8001cb8, thd=0x77ffa8000dd0, schema=..., name=0x77ffa80d5690, 
          sph=0x7ffff406b518, pkgname=0x7ffff406b540, resolved=0x7ffff406b477)
          at /home/bar/maria-git/13.2/sql/sql_path.cc:68
      #7  0x00005555555ebb99 in Sql_path::resolve (this=0x77ffa8001cb8, 
          thd=0x77ffa8000dd0, caller=0x77ffa80d4630, name=0x77ffa80d5690, 
          sph=0x7ffff406b518, pkgname=0x7ffff406b540)
          at /home/bar/maria-git/13.2/sql/sql_path.cc:164
      #8  0x0000555555d2cbd0 in Create_sp_func::create_with_db (
          this=0x5555581f7af8 <Create_sp_func::s_singleton>, thd=0x77ffa8000dd0, 
          db=..., name=..., use_explicit_name=true, item_list=0x0)
          at /home/bar/maria-git/13.2/sql/item_create.cc:3037
      #9  0x00005555557406a1 in LEX::make_item_func_call_generic (
          this=0x77ffa80d71a0, thd=0x77ffa8000dd0, db=..., name=..., args=0x0)
          at /home/bar/maria-git/13.2/sql/sql_lex.cc:11227
      #10 0x0000555555740327 in LEX::make_item_func_call_generic (
          this=0x77ffa80d71a0, thd=0x77ffa8000dd0, db=..., name=..., args=0x0)
          at /home/bar/maria-git/13.2/sql/sql_lex.cc:11175
      #11 0x0000555555740287 in LEX::make_item_func_call_generic (
          this=0x77ffa80d71a0, thd=0x77ffa8000dd0, cdb=0x7ffff406cbf8, 
          cname=0x7ffff406cc28, args=0x0)
          at /home/bar/maria-git/13.2/sql/sql_lex.cc:11163
      #12 0x000055555574054c in LEX::make_item_func_or_method_call (
          this=0x77ffa80d71a0, thd=0x77ffa8000dd0, ca=..., cb=..., args=0x0, 
          query_fragment=...) at /home/bar/maria-git/13.2/sql/sql_lex.cc:11207
      #13 0x0000555555c2476a in ORAparse (thd=0x77ffa8000dd0)
          at /home/bar/maria-git/13.2/sql/sql_yacc.yy:11352
      #14 0x000055555578b15c in parse_sql (thd=0x77ffa8000dd0, 
          parser_state=0x7ffff406d4e0, creation_ctx=0x77ffa80c6510, 
          do_pfs_digest=false) at /home/bar/maria-git/13.2/sql/sql_parse.cc:10401
      #15 0x00005555556169b1 in sp_compile (thd=0x77ffa8000dd0, 
          defstr=0x7ffff406d720, sql_mode=8858427918, parent=0x0, 
          creation_ctx=0x77ffa80c6510) at /home/bar/maria-git/13.2/sql/sp.cc:920
      #16 0x0000555555616eb2 in Sp_handler::db_load_routine (
          this=0x5555581d2330 <sp_handler_package_spec>, thd=0x77ffa8000dd0, 
          name=0x7ffff40714b0, sphp=0x7ffff40714a0, sql_mode=8858427918, 
          sql_path=..., params=..., returns=..., body=..., chistics=..., 
          definer=..., created=20261026115100, modified=20261026115100, parent=0x0, 
          creation_ctx=0x77ffa80c6510) at /home/bar/maria-git/13.2/sql/sp.cc:1048
      #17 0x0000555555616419 in Sp_handler::db_find_routine (
          this=0x5555581d2330 <sp_handler_package_spec>, thd=0x77ffa8000dd0, 
          name=0x7ffff40714b0, sphp=0x7ffff40714a0)
          at /home/bar/maria-git/13.2/sql/sp.cc:784
      #18 0x00005555556165a5 in Sp_handler::db_find_and_cache_routine (
          this=0x5555581d2330 <sp_handler_package_spec>, thd=0x77ffa8000dd0, 
          name=0x7ffff40714b0, sp=0x7ffff40714a0)
          at /home/bar/maria-git/13.2/sql/sp.cc:808
      #19 0x000055555561d661 in Sp_handler::sp_cache_routine (
          this=0x5555581d2330 <sp_handler_package_spec>, thd=0x77ffa8000dd0, 
          name=0x7ffff40714b0, sp=0x7ffff40714a0)
          at /home/bar/maria-git/13.2/sql/sp.cc:3028
      #20 0x000055555561c2dc in Sp_handler::sp_cache_routine_reentrant (
          this=0x5555581d2330 <sp_handler_package_spec>, thd=0x77ffa8000dd0, 
          name=0x7ffff40714b0, sp=0x7ffff40714a0)
          at /home/bar/maria-git/13.2/sql/sp.cc:2536
      #21 0x000055555561c344 in Sp_handler::sp_cache_routine_reentrant_suppress_errors (this=0x5555581d2330 <sp_handler_package_spec>, thd=0x77ffa8000dd0, 
          name=0x7ffff40714b0, sp=0x7ffff40714a0)
          at /home/bar/maria-git/13.2/sql/sp.cc:2552
      #22 0x000055555561c450 in Sp_handler::find_package_spec (thd=0x77ffa8000dd0, 
          db=..., package=...) at /home/bar/maria-git/13.2/sql/sp.cc:2573
      #23 0x000055555561c4ca in is_package_public_routine (thd=0x77ffa8000dd0, 
          db=..., package=..., routine=..., type=SP_TYPE_FUNCTION)
          at /home/bar/maria-git/13.2/sql/sp.cc:2612
      #24 0x000055555561c732 in Sp_handler::sp_resolve_package_routine_explicit (
          this=0x5555581d2328 <sp_handler_function>, thd=0x77ffa8000dd0, 
          caller=0x77ffa80c5320, name=0x77ffa80c6380, 
          pkg_routine_handler=0x7ffff40715f0, pkgname=0x7ffff40716a0)
          at /home/bar/maria-git/13.2/sql/sp.cc:2689
      #25 0x00005555555eb9e8 in Sql_path::resolve (this=0x77ffa8001cb8, 
          thd=0x77ffa8000dd0, caller=0x77ffa80c5320, name=0x77ffa80c6380, 
          sph=0x7ffff4071678, pkgname=0x7ffff40716a0)
          at /home/bar/maria-git/13.2/sql/sql_path.cc:120
      #26 0x0000555555d2cbd0 in Create_sp_func::create_with_db (
          this=0x5555581f7af8 <Create_sp_func::s_singleton>, thd=0x77ffa8000dd0, 
          db=..., name=..., use_explicit_name=true, item_list=0x0)
          at /home/bar/maria-git/13.2/sql/item_create.cc:3037
      #27 0x00005555557406a1 in LEX::make_item_func_call_generic (
          this=0x77ffa80c7e90, thd=0x77ffa8000dd0, db=..., name=..., args=0x0)
          at /home/bar/maria-git/13.2/sql/sql_lex.cc:11227
      #28 0x0000555555740327 in LEX::make_item_func_call_generic (
          this=0x77ffa80c7e90, thd=0x77ffa8000dd0, db=..., name=..., args=0x0)
          at /home/bar/maria-git/13.2/sql/sql_lex.cc:11175
      #29 0x0000555555740287 in LEX::make_item_func_call_generic (
          this=0x77ffa80c7e90, thd=0x77ffa8000dd0, cdb=0x7ffff4072d58, 
          cname=0x7ffff4072d88, args=0x0)
          at /home/bar/maria-git/13.2/sql/sql_lex.cc:11163
      #30 0x000055555574054c in LEX::make_item_func_or_method_call (
          this=0x77ffa80c7e90, thd=0x77ffa8000dd0, ca=..., cb=..., args=0x0, 
          query_fragment=...) at /home/bar/maria-git/13.2/sql/sql_lex.cc:11207
      #31 0x0000555555c2476a in ORAparse (thd=0x77ffa8000dd0)
          at /home/bar/maria-git/13.2/sql/sql_yacc.yy:11352
      #32 0x000055555578b15c in parse_sql (thd=0x77ffa8000dd0, 
          parser_state=0x7ffff4073640, creation_ctx=0x77ffa80b7200, 
          do_pfs_digest=false) at /home/bar/maria-git/13.2/sql/sql_parse.cc:10401
      #33 0x00005555556169b1 in sp_compile (thd=0x77ffa8000dd0, 
          defstr=0x7ffff4073880, sql_mode=8858427918, parent=0x0, 
          creation_ctx=0x77ffa80b7200) at /home/bar/maria-git/13.2/sql/sp.cc:920
      #34 0x0000555555616eb2 in Sp_handler::db_load_routine (
          this=0x5555581d2330 <sp_handler_package_spec>, thd=0x77ffa8000dd0, 
          name=0x7ffff4077610, sphp=0x7ffff4077600, sql_mode=8858427918, 
          sql_path=..., params=..., returns=..., body=..., chistics=..., 
          definer=..., created=20261026115100, modified=20261026115100, parent=0x0, 
          creation_ctx=0x77ffa80b7200) at /home/bar/maria-git/13.2/sql/sp.cc:1048
      #35 0x0000555555616419 in Sp_handler::db_find_routine (
          this=0x5555581d2330 <sp_handler_package_spec>, thd=0x77ffa8000dd0, 
          name=0x7ffff4077610, sphp=0x7ffff4077600)
      

      Attachments

        Issue Links

          Activity

            People

              Khaled.amr Khaled Amr
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  Remaining:
                  Remaining Estimate - 1d
                  1d
                  Logged:
                  Time Spent - Not Specified
                  Not Specified

                  Git Integration

                    Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.