Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.3.2, 11.4.1, 11.1(EOL), 11.2(EOL), 11.3(EOL), 11.4
    • 11.4
    • JSON
    • None
    • Ubuntu 20.04 x86-64, docker image mariadb:11.4-rc

    Description

      PoC:

      SELECT JSON_SCHEMA_VALID('{"properties": "a_string": {"pattern": "^[5-9]$"}}}', '{"a_string": "8"}');
      

      docker log:

      Server version: 11.4.1-MariaDB-1:11.4.1+maria~ubu2204 source revision: fa69b085b10f19a3a8b6e7adab27c104924333ae
      key_buffer_size=134217728
      read_buffer_size=131072
      max_used_connections=1
      max_threads=153
      thread_count=1
      It is possible that mysqld could use up to 
      key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 468064 K  bytes of memory
      Hope that's ok; if not, decrease some variables in the equation.
       
      Thread pointer: 0x7f1e60000c68
      Attempting backtrace. You can use the following information to find out
      where mysqld died. If you see no messages after this, something went
      terribly wrong...
      stack_bottom = 0x7f1e800cdc38 thread_stack 0x49000
      Printing to addr2line failed
      mariadbd(my_print_stacktrace+0x32)[0x555797a274f2]
      mariadbd(handle_fatal_signal+0x478)[0x5557974f71e8]
      /lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7f1e97732520]
      mariadbd(my_hash_free+0x49)[0x555797a06d89]
      mariadbd(_ZN22Json_schema_propertiesD0Ev+0x2d)[0x55579741932d]
      mariadbd(_ZN27Item_func_json_schema_valid7cleanupEv+0x56)[0x5557973f9026]
      mariadbd(_ZN11Query_arena10free_itemsEv+0x31)[0x5557972133d1]
      mariadbd(_ZN3THD19cleanup_after_queryEv+0x111)[0x555797215481]
      mariadbd(_Z16dispatch_command19enum_server_commandP3THDPcjb+0x14cd)[0x55579727820d]
      mariadbd(_Z10do_commandP3THDb+0x138)[0x55579727a118]
      mariadbd(_Z24do_handle_one_connectionP7CONNECTb+0x3bf)[0x5557973a6f6f]
      mariadbd(handle_one_connection+0x5d)[0x5557973a72bd]
      mariadbd(+0xd10af6)[0x555797729af6]
      /lib/x86_64-linux-gnu/libc.so.6(+0x94ac3)[0x7f1e97784ac3]
      /lib/x86_64-linux-gnu/libc.so.6(clone+0x44)[0x7f1e97815a04]
       
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x7f1e60012fa0): SELECT JSON_SCHEMA_VALID('{"properties": "a_string": {"pattern": "^[5-9]$"}}}', '{"a_string": "8"}')
       
      Connection ID (thread ID): 3
      Status: NOT_KILLED
       
      Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=on,cset_narrowing=off,sargable_casefold=on
       
      The manual page at https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mariadbd/ contains
      information that should help you find out what is causing the crash.
      Writing a core file...
      Working directory at /var/lib/mysql
      Resource Limits:
      Limit                     Soft Limit           Hard Limit           Units     
      Max cpu time              unlimited            unlimited            seconds   
      Max file size             unlimited            unlimited            bytes     
      Max data size             unlimited            unlimited            bytes     
      Max stack size            8388608              unlimited            bytes     
      Max core file size        unlimited            unlimited            bytes     
      Max resident set          unlimited            unlimited            bytes     
      Max processes             4127172              4127172              processes 
      Max open files            524288               524288               files     
      Max locked memory         8388608              8388608              bytes     
      Max address space         unlimited            unlimited            bytes     
      Max file locks            unlimited            unlimited            locks     
      Max pending signals       4127172              4127172              signals   
      Max msgqueue size         819200               819200               bytes     
      Max nice priority         0                    0                    
      Max realtime priority     0                    0                    
      Max realtime timeout      unlimited            unlimited            us        
      Core pattern: /var/lib/coredumps/core-%e-sig%s-user%u-group%g-pid%p-time%t
       
      Kernel version: Linux version 6.2.16-6-pve (fgruenbichler@yuna) (gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC PMX 6.2.16-7 (2023-08-01T11:23Z)
      

      Attachments

        Issue Links

          Activity

            alice Alice Sherepa added a comment -

            Sorry, I could not repeat this one. I'm getting an error:

            MariaDB [test]> SELECT JSON_SCHEMA_VALID('{"properties": "a_string": {"pattern": "^[5-9]$"}}}', '{"a_string": "8"}');
            ERROR 4193 (HY000): Invalid value for keyword properties
             
            MariaDB [test]> SELECT JSON_SCHEMA_VALID('{ "properties": { "a_string":{"pattern": "^[5-9]$"}  }}', '{"a_string": "8"}');
            +---------------------------------------------------------------------------------------------------+
            | JSON_SCHEMA_VALID('{ "properties": { "a_string":{"pattern": "^[5-9]$"}  }}', '{"a_string": "8"}') |
            +---------------------------------------------------------------------------------------------------+
            |                                                                                                 1 |
            +---------------------------------------------------------------------------------------------------+
            1 row in set (0,001 sec)
             
            MariaDB [test]> select version();
            +----------------+
            | version()      |
            +----------------+
            | 11.4.1-MariaDB |
            +----------------+
            1 row in set (0,000 sec)
            

            alice Alice Sherepa added a comment - Sorry, I could not repeat this one. I'm getting an error: MariaDB [test]> SELECT JSON_SCHEMA_VALID('{"properties": "a_string": {"pattern": "^[5-9]$"}}}', '{"a_string": "8"}'); ERROR 4193 (HY000): Invalid value for keyword properties   MariaDB [test]> SELECT JSON_SCHEMA_VALID('{ "properties": { "a_string":{"pattern": "^[5-9]$"} }}', '{"a_string": "8"}'); +---------------------------------------------------------------------------------------------------+ | JSON_SCHEMA_VALID('{ "properties": { "a_string":{"pattern": "^[5-9]$"} }}', '{"a_string": "8"}') | +---------------------------------------------------------------------------------------------------+ | 1 | +---------------------------------------------------------------------------------------------------+ 1 row in set (0,001 sec)   MariaDB [test]> select version(); +----------------+ | version() | +----------------+ | 11.4.1-MariaDB | +----------------+ 1 row in set (0,000 sec)
            fuboat Jingzhou Fu added a comment - - edited

            @Alice Sherepa
            I found it interesting. I can reproduce it when I use the database named 'mysql'.
            But if I create a new one named 'test' and run it, MariaDB's output will be the same as yours.

            If I run the SQL statement as the following bash commands, it crashes:

            root@jingzhou-dbms ~/j> docker run --detach --name some-mariadb-11.4 --env MARIADB_USER=example-user --env MARIADB_PASSWORD=my_cool_secret --env MARIADB_ROOT_PASSWORD=my-secret-pw  mariadb:11.4.1-rc
                4b51fd3bb77fbaaf83e554be30b62168782fabaf3f2509554b27a1b863c8b36a
             
            root@jingzhou-dbms ~/j> docker exec -it some-mariadb-11.4 mariadb --password="my-secret-pw" mysql
                Reading table information for completion of table and column names
                You can turn off this feature to get a quicker startup with -A
                Welcome to the MariaDB monitor.  Commands end with ; or \g.
                Your MariaDB connection id is 3
                Server version: 11.4.1-MariaDB-1:11.4.1+maria~ubu2204 mariadb.org binary distribution
                Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
                Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
                MariaDB [mysql]> SELECT JSON_SCHEMA_VALID('{"properties": "a_string": {"pattern": "^[5-9]$"}}}', '{"a_string": "8"}');
                ERROR 2026 (HY000)
             
             
            root@jingzhou-dbms ~/j[SIGKILL]# docker exec -it some-mariadb-11.4 mariadb --password="my-secret-pw" MySQL
                Error response from daemon: Container 4b51fd3bb77fbaaf83e554be30b62168782fabaf3f2509554b27a1b863c8b36a is not running
            

            Or maybe you can try running these SQL statements via the mariadb client:

            USE mysql;
            SELECT JSON_SCHEMA_VALID('{"properties": "a_string": {"pattern": "^[5-9]$"}}}', '{"a_string": "8"}');
            

            fuboat Jingzhou Fu added a comment - - edited @Alice Sherepa I found it interesting. I can reproduce it when I use the database named 'mysql'. But if I create a new one named 'test' and run it, MariaDB's output will be the same as yours. If I run the SQL statement as the following bash commands, it crashes: root@jingzhou-dbms ~/j> docker run --detach --name some-mariadb-11.4 --env MARIADB_USER=example-user --env MARIADB_PASSWORD=my_cool_secret --env MARIADB_ROOT_PASSWORD=my-secret-pw mariadb:11.4.1-rc 4b51fd3bb77fbaaf83e554be30b62168782fabaf3f2509554b27a1b863c8b36a   root@jingzhou-dbms ~/j> docker exec -it some-mariadb-11.4 mariadb --password="my-secret-pw" mysql Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 11.4.1-MariaDB-1:11.4.1+maria~ubu2204 mariadb.org binary distribution Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [mysql]> SELECT JSON_SCHEMA_VALID('{"properties": "a_string": {"pattern": "^[5-9]$"}}}', '{"a_string": "8"}'); ERROR 2026 (HY000)     root@jingzhou-dbms ~/j[SIGKILL]# docker exec -it some-mariadb-11.4 mariadb --password="my-secret-pw" MySQL Error response from daemon: Container 4b51fd3bb77fbaaf83e554be30b62168782fabaf3f2509554b27a1b863c8b36a is not running Or maybe you can try running these SQL statements via the mariadb client: USE mysql; SELECT JSON_SCHEMA_VALID('{"properties": "a_string": {"pattern": "^[5-9]$"}}}', '{"a_string": "8"}');
            fuboat Jingzhou Fu added a comment - - edited

            I also reproduced it on the self-compiled MariaDB with the latest commit:

            root@b9b478bf13b5 ~# /root/bin_original/usr/local/mysql/bin/mariadb --port 8888
            WARNING: option --ssl-verify-server-cert is disabled, because of an insecure passwordless login.
            Welcome to the MariaDB monitor.  Commands end with ; or \g.
            Your MariaDB connection id is 4
            Server version: 11.5.0-MariaDB Source distribution
             
            Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
             
            Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
             
            MariaDB [(none)]> select version();
            +----------------+
            | version()      |
            +----------------+
            | 11.5.0-MariaDB |
            +----------------+
            1 row in set (0.000 sec)
             
            MariaDB [(none)]> USE mysql;
            Reading table information for completion of table and column names
            You can turn off this feature to get a quicker startup with -A
             
            Database changed
            MariaDB [mysql]> SELECT JSON_SCHEMA_VALID('{"properties": "a_string": {"pattern": "^[5-9]$"}}}', '{"a_string": "8"}');
            ERROR 2013 (HY000): Lost connection to server during query
            

            fuboat Jingzhou Fu added a comment - - edited I also reproduced it on the self-compiled MariaDB with the latest commit: root@b9b478bf13b5 ~# /root/bin_original/usr/local/mysql/bin/mariadb --port 8888 WARNING: option --ssl-verify-server-cert is disabled, because of an insecure passwordless login. Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 4 Server version: 11.5.0-MariaDB Source distribution   Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.   Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.   MariaDB [(none)]> select version(); +----------------+ | version() | +----------------+ | 11.5.0-MariaDB | +----------------+ 1 row in set (0.000 sec)   MariaDB [(none)]> USE mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A   Database changed MariaDB [mysql]> SELECT JSON_SCHEMA_VALID('{"properties": "a_string": {"pattern": "^[5-9]$"}}}', '{"a_string": "8"}'); ERROR 2013 (HY000): Lost connection to server during query
            alice Alice Sherepa added a comment -

            Thanks! Yes, somehow weird.
            I repeated on 11.1-11.4:

            240311 13:54:43 [ERROR] mysqld got signal 11 ;
             
            Server version: 11.1.5-MariaDB-debug source revision: d3e4de529bdc99414e7a79b0fdae4eb261433346
             
            mysys/stacktrace.c:215(my_print_stacktrace)[0x5613e78a8af8]
            sql/signal_handler.cc:238(handle_fatal_signal)[0x5613e64b8a8a]
            sigaction.c:0(__restore_rt)[0x7ff73c53e420]
            mysys/hash.c:135(my_hash_free_elements)[0x5613e783100b]
            mysys/hash.c:158(my_hash_free)[0x5613e783115e]
            sql/json_schema.h:486(Json_schema_properties::~Json_schema_properties())[0x5613e61f37a7]
            sql/json_schema.h:489(Json_schema_properties::~Json_schema_properties())[0x5613e61f37d2]
            sql/item_jsonfunc.cc:4893(Item_func_json_schema_valid::cleanup())[0x5613e61c643f]
            sql/item.h:2569(Item::delete_self())[0x5613e5a67384]
            sql/sql_class.cc:3933(Query_arena::free_items())[0x5613e5a47bd3]
            sql/sql_class.cc:2313(THD::cleanup_after_query())[0x5613e5a3824c]
            sql/sql_parse.cc:7873(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x5613e5ba27cf]
            sql/sql_parse.cc:1894(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x5613e5b7a303]
            sql/sql_parse.cc:1405(do_command(THD*, bool))[0x5613e5b7704d]
            sql/sql_connect.cc:1415(do_handle_one_connection(CONNECT*, bool))[0x5613e6050094]
            sql/sql_connect.cc:1319(handle_one_connection)[0x5613e604f9f1]
            perfschema/pfs.cc:2203(pfs_spawn_thread)[0x5613e6c8d20e]
            nptl/pthread_create.c:478(start_thread)[0x7ff73c532609]
             
            Query (0x6290000eb2a8): SELECT JSON_SCHEMA_VALID('{"properties": "a_string": {"pattern": "^[5-9]$"}}}', '{"a_string": "8"}')
             
            
            

            alice Alice Sherepa added a comment - Thanks! Yes, somehow weird. I repeated on 11.1-11.4: 240311 13:54:43 [ERROR] mysqld got signal 11 ;   Server version: 11.1.5-MariaDB-debug source revision: d3e4de529bdc99414e7a79b0fdae4eb261433346   mysys/stacktrace.c:215(my_print_stacktrace)[0x5613e78a8af8] sql/signal_handler.cc:238(handle_fatal_signal)[0x5613e64b8a8a] sigaction.c:0(__restore_rt)[0x7ff73c53e420] mysys/hash.c:135(my_hash_free_elements)[0x5613e783100b] mysys/hash.c:158(my_hash_free)[0x5613e783115e] sql/json_schema.h:486(Json_schema_properties::~Json_schema_properties())[0x5613e61f37a7] sql/json_schema.h:489(Json_schema_properties::~Json_schema_properties())[0x5613e61f37d2] sql/item_jsonfunc.cc:4893(Item_func_json_schema_valid::cleanup())[0x5613e61c643f] sql/item.h:2569(Item::delete_self())[0x5613e5a67384] sql/sql_class.cc:3933(Query_arena::free_items())[0x5613e5a47bd3] sql/sql_class.cc:2313(THD::cleanup_after_query())[0x5613e5a3824c] sql/sql_parse.cc:7873(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x5613e5ba27cf] sql/sql_parse.cc:1894(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x5613e5b7a303] sql/sql_parse.cc:1405(do_command(THD*, bool))[0x5613e5b7704d] sql/sql_connect.cc:1415(do_handle_one_connection(CONNECT*, bool))[0x5613e6050094] sql/sql_connect.cc:1319(handle_one_connection)[0x5613e604f9f1] perfschema/pfs.cc:2203(pfs_spawn_thread)[0x5613e6c8d20e] nptl/pthread_create.c:478(start_thread)[0x7ff73c532609]   Query (0x6290000eb2a8): SELECT JSON_SCHEMA_VALID('{"properties": "a_string": {"pattern": "^[5-9]$"}}}', '{"a_string": "8"}')  

            People

              rucha174 Rucha Deodhar
              fuboat Jingzhou Fu
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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