[MDEV-13171]  crash after call of json_get_item function (CONNECT engine) Created: 2017-06-26  Updated: 2017-06-27  Resolved: 2017-06-27

Status: Closed
Project: MariaDB Server
Component/s: Documentation, Storage Engine - Connect
Affects Version/s: 10.1.25, 10.2.7
Fix Version/s: 10.1.25, 10.0.32

Type: Bug Priority: Major
Reporter: Alice Sherepa Assignee: Olivier Bertrand
Resolution: Fixed Votes: 0
Labels: None
Environment:

Ubuntu 16.04



 Description   

server crashes after call of json_get_item function(CONNECT engine)

From documentation: json_get_item should return string value (Access and returns a json item by a JPATH key), but then it is declared as real. https://mariadb.com/kb/en/mariadb/connect-json-table-type/#json-user-defined-functions

create function json_get_item returns real soname 'ha_connect.so';

select json_get_item('{"id": 1}', 'id:*');

170626 11:03:15 [ERROR] mysqld got signal 11 ;
 
Server version: 10.2.7-MariaDB-debug
key_buffer_size=134217728
read_buffer_size=131072
max_used_connections=1
max_threads=153
thread_count=7
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 467291 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
 
Thread pointer: 0x7f1070000b00
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 = 0x7f10e00e2ec0 thread_stack 0x49000
/data/bld/10.2/bin/mysqld(my_print_stacktrace+0x38)[0x5632c375887e]
/data/bld/10.2/bin/mysqld(handle_fatal_signal+0x3a3)[0x5632c2fe992c]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7f10e20f3390]
/data/bld/10.2/lib/plugin/ha_connect.so(json_get_item+0x315)[0x7f10e098f4e3]
/data/bld/10.2/bin/mysqld(_ZN11udf_handler3valEPc+0x73)[0x5632c3077d17]
/data/bld/10.2/bin/mysqld(_ZN19Item_func_udf_float8val_realEv+0xd5)[0x5632c306df53]
/data/bld/10.2/bin/mysqld(_ZN4Item4sendEP8ProtocolP6String+0x3c6)[0x5632c30115c6]
/data/bld/10.2/bin/mysqld(_ZN8Protocol19send_result_set_rowEP4ListI4ItemE+0xe1)[0x5632c2cb729f]
/data/bld/10.2/bin/mysqld(_ZN11select_send9send_dataER4ListI4ItemE+0xe2)[0x5632c2d385bc]
/data/bld/10.2/bin/mysqld(_ZN4JOIN10exec_innerEv+0x4ef)[0x5632c2dc7119]
/data/bld/10.2/bin/mysqld(_ZN4JOIN4execEv+0xc8)[0x5632c2dc6b8e]
/data/bld/10.2/bin/mysqld(_Z12mysql_selectP3THDP10TABLE_LISTjR4ListI4ItemEPS4_jP8st_orderS9_S7_S9_yP13select_resultP18st_select_lex_unitP13st_select_lex+0x2f3)[0x5632c2dc7d2e]
/data/bld/10.2/bin/mysqld(_Z13handle_selectP3THDP3LEXP13select_resultm+0x15f)[0x5632c2dbc725]
/data/bld/10.2/bin/mysqld(+0x5b3640)[0x5632c2d88640]
/data/bld/10.2/bin/mysqld(_Z21mysql_execute_commandP3THD+0x1849)[0x5632c2d7e390]
/data/bld/10.2/bin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_statebb+0x29d)[0x5632c2d8bfc9]
/data/bld/10.2/bin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcjbb+0xfe6)[0x5632c2d79dc9]
/data/bld/10.2/bin/mysqld(_Z10do_commandP3THD+0x712)[0x5632c2d78703]
/data/bld/10.2/bin/mysqld(_Z24do_handle_one_connectionP7CONNECT+0x1ca)[0x5632c2ec39ba]
/data/bld/10.2/bin/mysqld(handle_one_connection+0x30)[0x5632c2ec373a]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7f10e20e96ba]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f10e157e3dd]
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7f1070010e98): select json_get_item('{"id": 1}', 'id:*')
Connection ID (thread ID): 8
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



 Comments   
Comment by Elena Stepanova [ 2017-06-26 ]

Apparently bad copy-paste in documentation. I think UDF functions usually crash when the return type is wrong, but documentation definitely needs to be corrected.

Comment by Ian Gilfillan [ 2017-06-27 ]

The documentation has been updated:
https://mariadb.com/kb/en/mariadb/connect-json-table-type/+revision/55931/55662/?diff_type=unified

Generated at Thu Feb 08 08:03:28 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.