[MDEV-26732] Assertion `0' failed in Item::val_native Created: 2021-09-30  Updated: 2022-01-25  Resolved: 2021-10-26

Status: Closed
Project: MariaDB Server
Component/s: Data types
Affects Version/s: 10.7.0, 10.6
Fix Version/s: 10.5.13, 10.6.5, 10.7.1

Type: Bug Priority: Critical
Reporter: Alice Sherepa Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by MDEV-24619 Wrong result or Assertion `0' in Item... Closed
Problem/Incident
is caused by MDEV-4958 Adding datatype UUID Closed
Relates
relates to MDEV-22885 Wrong result or Assertion `0' failed ... Confirmed
relates to MDEV-24619 Wrong result or Assertion `0' in Item... Closed

 Description   

SELECT uuid() AS f, var_pop('x')
FROM dual 
HAVING f > '';

preview-10.7-MDEV-4958-uuid 92e52a0c582e435e2b8fe4c4d

#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#5  0x00007f533dae8859 in __GI_abort () at abort.c:79
#6  0x00007f533dae8729 in __assert_fail_base (fmt=0x7f533dc7e588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55f4e916f45f "0", file=0x55f4e916f3a0 "/m7-preview-10.7-MDEV-4958-uuid/src/sql/item.h", line=1569, function=<optimized out>) at assert.c:92
#7  0x00007f533daf9f36 in __GI___assert_fail (assertion=0x55f4e916f45f "0", file=0x55f4e916f3a0 "/m7-preview-10.7-MDEV-4958-uuid/src/sql/item.h", line=1569, function=0x55f4e916f520 "virtual bool Item::val_native(THD*, Native*)") at assert.c:101
#8  0x000055f4e82885b6 in Item::val_native (this=0x7f52e8015df0, thd=0x7f52e8000db8, to=0x7f52e8014aa0) at /m7-preview-10.7-MDEV-4958-uuid/src/sql/item.h:1569
#9  0x000055f4e84c378d in Item::val_native_from_item (this=0x7f52e8014818, thd=0x7f52e8000db8, item=0x7f52e8015df0, to=0x7f52e8014aa0) at /m7-preview-10.7-MDEV-4958-uuid/src/sql/item.h:974
#10 0x000055f4e87f490e in Item_ref::val_native (this=0x7f52e8014818, thd=0x7f52e8000db8, to=0x7f52e8014aa0) at /m7-preview-10.7-MDEV-4958-uuid/src/sql/item.cc:8384
#11 0x000055f4e9130446 in FixedBinTypeBundle<16ul, 36ul>::Type_handler_fbt::Item_val_native_with_conversion (this=0x55f4ea68fe40 <FixedBinTypeBundle<16ul, 36ul>::type_handler_fbt()::th>, thd=0x7f52e8000db8, item=0x7f52e8014818, to=0x7f52e8014aa0) at /m7-preview-10.7-MDEV-4958-uuid/src/sql/sql_type_fixedbin.h:781
#12 0x000055f4e872695c in Item::val_native_with_conversion (this=0x7f52e8014818, thd=0x7f52e8000db8, to=0x7f52e8014aa0, th=0x55f4ea68fe40 <FixedBinTypeBundle<16ul, 36ul>::type_handler_fbt()::th>) at /m7-preview-10.7-MDEV-4958-uuid/src/sql/item.h:1528
#13 0x000055f4e8808a1c in Arg_comparator::compare_native (this=0x7f52e8014a40) at /m7-preview-10.7-MDEV-4958-uuid/src/sql/item_cmpfunc.cc:793
#14 0x000055f4e88213f2 in Arg_comparator::compare (this=0x7f52e8014a40) at /m7-preview-10.7-MDEV-4958-uuid/src/sql/item_cmpfunc.h:103
#15 0x000055f4e880c128 in Item_func_gt::val_int (this=0x7f52e8014990) at /m7-preview-10.7-MDEV-4958-uuid/src/sql/item_cmpfunc.cc:1802
#16 0x000055f4e84ac883 in end_send_group (join=0x7f52e8015468, join_tab=0x0, end_of_records=true) at /m7-preview-10.7-MDEV-4958-uuid/src/sql/sql_select.cc:22433
#17 0x000055f4e84a8004 in do_select (join=0x7f52e8015468, procedure=0x0) at /m7-preview-10.7-MDEV-4958-uuid/src/sql/sql_select.cc:20542
#18 0x000055f4e847b839 in JOIN::exec_inner (this=0x7f52e8015468) at /m7-preview-10.7-MDEV-4958-uuid/src/sql/sql_select.cc:4735
#19 0x000055f4e847a8af in JOIN::exec (this=0x7f52e8015468) at /m7-preview-10.7-MDEV-4958-uuid/src/sql/sql_select.cc:4513
#20 0x000055f4e847c1e9 in mysql_select (thd=0x7f52e8000db8, tables=0x0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x7f52e8014990, proc_param=0x0, select_options=2147748608, result=0x7f52e8015440, unit=0x7f52e8005120, select_lex=0x7f52e80140e0) at /m7-preview-10.7-MDEV-4958-uuid/src/sql/sql_select.cc:4991
#21 0x000055f4e846b455 in handle_select (thd=0x7f52e8000db8, lex=0x7f52e8005058, result=0x7f52e8015440, setup_tables_done_option=0) at /m7-preview-10.7-MDEV-4958-uuid/src/sql/sql_select.cc:545
#22 0x000055f4e8416453 in execute_sqlcom_select (thd=0x7f52e8000db8, all_tables=0x0) at /m7-preview-10.7-MDEV-4958-uuid/src/sql/sql_parse.cc:6261
#23 0x000055f4e840d65f in mysql_execute_command (thd=0x7f52e8000db8, is_called_from_prepared_stmt=false) at /m7-preview-10.7-MDEV-4958-uuid/src/sql/sql_parse.cc:3946
#24 0x000055f4e841b2a3 in mysql_parse (thd=0x7f52e8000db8, rawbuf=0x7f52e8014010 "SELECT uuid() AS f,\nvar_pop('x')\nFROM dual \nHAVING f > ''", length=57, parser_state=0x7f5330793480) at /m7-preview-10.7-MDEV-4958-uuid/src/sql/sql_parse.cc:8036
#25 0x000055f4e8407677 in dispatch_command (command=COM_QUERY, thd=0x7f52e8000db8, packet=0x7f52e800b979 "", packet_length=57, blocking=true) at /m7-preview-10.7-MDEV-4958-uuid/src/sql/sql_parse.cc:1896
#26 0x000055f4e8406013 in do_command (thd=0x7f52e8000db8, blocking=true) at /m7-preview-10.7-MDEV-4958-uuid/src/sql/sql_parse.cc:1404
#27 0x000055f4e85d7429 in do_handle_one_connection (connect=0x55f4ec15f728, put_in_cache=true) at /m7-preview-10.7-MDEV-4958-uuid/src/sql/sql_connect.cc:1418
#28 0x000055f4e85d70b9 in handle_one_connection (arg=0x55f4ec15f728) at /m7-preview-10.7-MDEV-4958-uuid/src/sql/sql_connect.cc:1312
#29 0x000055f4e8af8a5f in pfs_spawn_thread (arg=0x55f4ec15f808) at /m7-preview-10.7-MDEV-4958-uuid/src/storage/perfschema/pfs.cc:2201
#30 0x00007f533e012609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#31 0x00007f533dbe5293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95



 Comments   
Comment by Alexander Barkov [ 2021-10-01 ]

Could not reproduce the same problem with INET6.

This statement does not crash:

SELECT CAST('::' AS inet6) AS f, var_pop('x') FROM dual HAVING f > '';

Comment by Alexander Barkov [ 2021-10-04 ]

This statement reproduces the crash for INET6 in all versions starting from 10.5:

SELECT CAST(CONCAT('::', REPEAT('',RAND())) AS INET6) AS f, var_pop('x') FROM dual HAVING f > '';

Comment by Elena Stepanova [ 2021-10-04 ]

For INET6, there is also MDEV-24619, Alice linked it to this report.

Comment by Alexander Barkov [ 2021-10-26 ]

Pushed to 10.5 and preview-10.7-MDEV-4958-uuid.

Generated at Thu Feb 08 09:47:31 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.