[MDEV-11648] main.func_json fails in buildbot with crash or valgrind (Conditional jump or move depends on uninitialised value) Created: 2016-12-23  Updated: 2017-12-26  Resolved: 2017-12-26

Status: Closed
Project: MariaDB Server
Component/s: JSON, Tests
Affects Version/s: 10.2
Fix Version/s: 10.2.12

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Alexey Botchkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-7069 Fix buildbot failures in main server ... Stalled
Sprint: 10.2.12

 Description   

http://buildbot.askmonty.org/buildbot/builders/xenial-amd64-valgrind/builds/183/steps/test/logs/stdio
Also reproducible locally with cmake . -DCMAKE_BUILD_TYPE=Debug -DWITH_VALGRIND=YES

main.func_json                           w4 [ fail ]  Found warnings/errors in server log file!
        Test ended at 2016-12-22 11:38:27
line
==15330== Thread 8:
==15330== Conditional jump or move depends on uninitialised value(s)
==15330==    at 0x1120719: my_wildcmp_8bit_impl (ctype-simple.c:926)
==15330==    by 0x1120A05: my_wildcmp_8bit (ctype-simple.c:1010)
==15330==    by 0xAFB321: Item_func_json_search::compare_json_value_wild(st_json_engine_t*, String const*) (item_jsonfunc.cc:2283)
==15330==    by 0xAFBBDA: Item_func_json_search::val_str(String*) (item_jsonfunc.cc:2434)
==15330==    by 0x93CBCC: Item::send(Protocol*, String*) (item.cc:6789)
==15330==    by 0x5D9FC2: Protocol::send_result_set_row(List<Item>*) (protocol.cc:979)
==15330==    by 0x65AA07: select_send::send_data(List<Item>&) (sql_class.cc:2759)
==15330==    by 0x6EA9D8: JOIN::exec_inner() (sql_select.cc:3279)
==15330==    by 0x6EA463: JOIN::exec() (sql_select.cc:3199)
==15330==    by 0x6EB5C5: mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:3584)
==15330==    by 0x6E055F: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:373)
==15330==    by 0x6AC2D9: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:6399)



 Comments   
Comment by Alexey Botchkov [ 2017-02-09 ]

Was probably fixed in the meantime.

Comment by Elena Stepanova [ 2017-05-08 ]

Still (or again) fails, now with a different stack trace.
http://buildbot.askmonty.org/buildbot/builders/work-amd64-valgrind/builds/10030/steps/test/logs/stdio

main.func_json                           w3 [ fail ]  Found warnings/errors in server log file!
        Test ended at 2017-05-02 17:33:30
line
==13790== Thread 8:
==13790== Conditional jump or move depends on uninitialised value(s)
==13790==    at 0xB6AAAA: Item_func_json_array::val_str(String*) (item_jsonfunc.cc:1435)
==13790==    by 0x9A7F0E: Item::send(Protocol*, String*) (item.cc:6883)
==13790==    by 0x632B83: Protocol::send_result_set_row(List<Item>*) (protocol.cc:979)
==13790==    by 0x6B5B59: select_send::send_data(List<Item>&) (sql_class.cc:2762)
==13790==    by 0x747152: JOIN::exec_inner() (sql_select.cc:3347)
==13790==    by 0x746BDD: JOIN::exec() (sql_select.cc:3267)
==13790==    by 0x747DA4: mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:3659)
==13790==    by 0x73C68B: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:373)
==13790==    by 0x707601: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:6431)
==13790==    by 0x6FD572: mysql_execute_command(THD*) (sql_parse.cc:3448)
==13790==    by 0x70B00B: mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) (sql_parse.cc:7874)
==13790==    by 0x6F8FB3: dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) (sql_parse.cc:1812)
==13790== Conditional jump or move depends on uninitialised value(s)
==13790==    at 0xB6AAE4: Item_func_json_array::val_str(String*) (item_jsonfunc.cc:1438)
==13790==    by 0x9A7F0E: Item::send(Protocol*, String*) (item.cc:6883)
==13790==    by 0x632B83: Protocol::send_result_set_row(List<Item>*) (protocol.cc:979)
==13790==    by 0x6B5B59: select_send::send_data(List<Item>&) (sql_class.cc:2762)
==13790==    by 0x747152: JOIN::exec_inner() (sql_select.cc:3347)
==13790==    by 0x746BDD: JOIN::exec() (sql_select.cc:3267)
==13790==    by 0x747DA4: mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:3659)
==13790==    by 0x73C68B: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:373)
==13790==    by 0x707601: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:6431)
==13790==    by 0x6FD572: mysql_execute_command(THD*) (sql_parse.cc:3448)
==13790==    by 0x70B00B: mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) (sql_parse.cc:7874)
==13790==    by 0x6F8FB3: dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) (sql_parse.cc:1812)
==13790== Conditional jump or move depends on uninitialised value(s)
==13790==    at 0xB6C148: Item_func_json_object::val_str(String*) (item_jsonfunc.cc:1762)
==13790==    by 0x9A7F0E: Item::send(Protocol*, String*) (item.cc:6883)
==13790==    by 0x632B83: Protocol::send_result_set_row(List<Item>*) (protocol.cc:979)
==13790==    by 0x6B5B59: select_send::send_data(List<Item>&) (sql_class.cc:2762)
==13790==    by 0x747152: JOIN::exec_inner() (sql_select.cc:3347)
==13790==    by 0x746BDD: JOIN::exec() (sql_select.cc:3267)
==13790==    by 0x747DA4: mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:3659)
==13790==    by 0x73C68B: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:373)
==13790==    by 0x707601: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:6431)
==13790==    by 0x6FD572: mysql_execute_command(THD*) (sql_parse.cc:3448)
==13790==    by 0x70B00B: mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) (sql_parse.cc:7874)
==13790==    by 0x6F8FB3: dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) (sql_parse.cc:1812)
^ Found warnings in /mnt/data/buildot/maria-slave/work-opensuse-amd64/build/mysql-test/var/3/log/mysqld.1.err

Comment by Alice Sherepa [ 2017-08-14 ]

main.func_json failed in buildbot with 10.3.1 http://buildbot.askmonty.org/buildbot/builders/kvm-fulltest2/builds/9162/steps/test_3/logs/stdio

mysqltest: At line 314: query 'select JSON_EXTRACT('{"name":"value"}', '$.name') = 'value'' failed: 2013: Lost connection to MySQL server during query
 
The result from queries just before the failure was:
< snip >
SET @str = 'bar', @path = '$';
SELECT JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path);
JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path)
"$.foo"
SELECT JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]');
JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]')
bar
CREATE TABLE t1 (f INT NOT NULL);
INSERT INTO t1 VALUES (0);
SELECT JSON_KEYS(f) FROM t1 ORDER BY 1;
JSON_KEYS(f)
NULL
DROP TABLE t1;
SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*].*' );
JSON_EXTRACT( '{"foo":"bar"}', '$[*].*' )
NULL
SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*]' );
JSON_EXTRACT( '{"foo":"bar"}', '$[*]' )
NULL
select JSON_EXTRACT('{"name":"value"}', '$.name') = 'value';
 
More results from queries before failure can be found in /mnt/buildbot/build/mariadb-10.3.1/mysql-test/var/1/log/func_json.log
 
 
Server [mysqld.1 - pid: 20156, winpid: 20156, exit: 256] failed during test run
Server log from this test:
----------SERVER LOG START-----------
170811 17:32:27 [ERROR] mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
 
To report this bug, see https://mariadb.com/kb/en/reporting-bugs
 
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed, 
something is definitely wrong and this may fail.
 
Server version: 10.3.1-MariaDB-debug-log
key_buffer_size=1048576
read_buffer_size=131072
max_used_connections=4
max_threads=153
thread_count=5
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 61882 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
 
Thread pointer: 0xb09c4180
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 = 0xb0cff2a0 thread_stack 0x49000
/mnt/buildbot/build/mariadb-10.3.1/sql/mysqld(my_print_stacktrace+0x32)[0x8d7a47e]
/mnt/buildbot/build/mariadb-10.3.1/sql/mysqld(handle_fatal_signal+0x3c7)[0x8625eb3]
[0xb7783400]
/mnt/buildbot/build/mariadb-10.3.1/sql/mysqld(_ZN9Item_func10fix_fieldsEP3THDPP4Item+0x192)[0x8697396]
/mnt/buildbot/build/mariadb-10.3.1/sql/mysqld(_Z12setup_fieldsP3THD20Bounds_checked_arrayIP4ItemER4ListIS2_E17enum_mark_columnsPS6_b+0x292)[0x8311404]
/mnt/buildbot/build/mariadb-10.3.1/sql/mysqld(_ZN4JOIN7prepareEP10TABLE_LISTjP4ItemjP8st_orderbS5_S3_S5_P13st_select_lexP18st_select_lex_unit+0x5b2)[0x83be8aa]
/mnt/buildbot/build/mariadb-10.3.1/sql/mysqld(_Z12mysql_selectP3THDP10TABLE_LISTjR4ListI4ItemEPS4_jP8st_orderS9_S7_S9_yP13select_resultP18st_select_lex_unitP13st_select_lex+0x2be)[0x83c7a3b]
/mnt/buildbot/build/mariadb-10.3.1/sql/mysqld(_Z13handle_selectP3THDP3LEXP13select_resultm+0x1e4)[0x83bd71f]
/mnt/buildbot/build/mariadb-10.3.1/sql/mysqld[0x838b067]
/mnt/buildbot/build/mariadb-10.3.1/sql/mysqld(_Z21mysql_execute_commandP3THD+0x1890)[0x8380c80]
/mnt/buildbot/build/mariadb-10.3.1/sql/mysqld(_ZN18Prepared_statement7executeEP6Stringb+0x40b)[0x83aa333]
/mnt/buildbot/build/mariadb-10.3.1/sql/mysqld(_ZN18Prepared_statement12execute_loopEP6StringbPhS2_+0x20f)[0x83a8991]
/mnt/buildbot/build/mariadb-10.3.1/sql/mysqld[0x83a66d2]
mysys/stacktrace.c:267(my_print_stacktrace)[0x83a62d0]
/mnt/buildbot/build/mariadb-10.3.1/sql/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcjbb+0xc0c)[0x837ba0c]
sql/item_func.cc:302(Item_func::fix_fields(THD*, Item**))[0x837a776]
sql/sql_base.cc:7097(setup_fields(THD*, Bounds_checked_array<Item*>, List<Item>&, enum_mark_columns, List<Item>*, bool))[0x84bb690]
/mnt/buildbot/build/mariadb-10.3.1/sql/mysqld(handle_one_connection+0x38)[0x84bb41e]
sql/sql_select.cc:806(JOIN::prepare(TABLE_LIST*, unsigned int, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*))[0x883a52c]
sql/sql_parse.cc:6431(execute_sqlcom_select)[0xb750bd4c]
sql/sql_prepare.cc:4726(Prepared_statement::execute(String*, bool))[0xb731bace]
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0xb0991a58): select JSON_EXTRACT('{"name":"value"}', '$.name') = 'value'
Connection ID (thread ID): 277
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,engine_condition_pushdown=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=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on

Generated at Thu Feb 08 07:51:35 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.