Details
- 
    
Bug
 - 
    Status: Confirmed (View Workflow)
 - 
    
Major
 - 
    Resolution: Unresolved
 - 
    10.6, 10.11, 11.8, 10.4(EOL), 10.5(EOL), 10.9(EOL), 10.10(EOL), 11.0(EOL), 11.1(EOL)
 - 
    None
 
Description
We have numerous open bug reports about this generic assertion failure, but I couldn't find one which would fit. They are difficult to search for though, so if somebody finds it to be a duplicate, please feel free to close.
					CREATE TABLE t (a INT, b VARCHAR(1024)) ENGINE=MyISAM;  | 
		
					INSERT INTO t (a, b) VALUES (1,'foo'),(2,'bar');  | 
		
| 
					 | 
		
					SELECT GROUP_CONCAT(b), (SELECT COUNT(*) FROM t WHERE outer_t.a IN (SELECT a FROM t HAVING a > 6)) AS f FROM t AS outer_t GROUP BY f;  | 
		
| 
					 | 
		
					# Cleanup
			 | 
		
					DROP TABLE t;  | 
		
| 
				 10.4 f5dceafd  | 
		
					mysqld: /data/src/10.4/sql/field.cc:4315: virtual longlong Field_long::val_int(): Assertion `marked_for_read()' failed.
			 | 
		
					230629 18:30:05 [ERROR] mysqld got signal 6 ;
			 | 
		
| 
					 | 
		
					#9  0x00007f1b6b653df2 in __GI___assert_fail (assertion=0x55e8510bcdc0 "marked_for_read()", file=0x55e8510bbfe0 "/data/src/10.10/sql/field.cc", line=4487, function=0x55e8510bf4c0 "virtual longlong Field_long::val_int()") at ./assert/assert.c:101
			 | 
		
					#10 0x000055e84f3ad4db in Field_long::val_int (this=0x619000099300) at /data/src/10.10/sql/field.cc:4487
			 | 
		
					#11 0x000055e84f3ffe50 in Field::do_field_int (copy=0x6290002796b0) at /data/src/10.10/sql/field_conv.cc:402
			 | 
		
					#12 0x000055e84f3fe515 in do_copy_null (copy=0x6290002796b0) at /data/src/10.10/sql/field_conv.cc:246
			 | 
		
					#13 0x000055e84ed31a84 in store_key_field::copy_inner (this=0x629000279688) at /data/src/10.10/sql/sql_select.h:1999
			 | 
		
					#14 0x000055e84ed3154b in store_key::copy (this=0x629000279688, thd=0x62b00007e218) at /data/src/10.10/sql/sql_select.h:1943
			 | 
		
					#15 0x000055e84ecf9276 in cp_buffer_from_ref (thd=0x62b00007e218, table=0x61f0000356b8, ref=0x629000280478) at /data/src/10.10/sql/sql_select.cc:26015
			 | 
		
					#16 0x000055e84ecf9043 in cmp_buffer_with_ref (thd=0x62b00007e218, table=0x61f0000356b8, tab_ref=0x629000280478) at /data/src/10.10/sql/sql_select.cc:25997
			 | 
		
					#17 0x000055e84ece1372 in join_read_key2 (thd=0x62b00007e218, tab=0x629000280238, table=0x61f0000356b8, table_ref=0x629000280478) at /data/src/10.10/sql/sql_select.cc:22802
			 | 
		
					#18 0x000055e84ece10bd in join_read_key (tab=0x629000280238) at /data/src/10.10/sql/sql_select.cc:22769
			 | 
		
					#19 0x000055e84ecdc725 in sub_select (join=0x62900026e2c8, join_tab=0x629000280238, end_of_records=false) at /data/src/10.10/sql/sql_select.cc:22135
			 | 
		
					#20 0x000055e84ecda74f in do_select (join=0x62900026e2c8, procedure=0x0) at /data/src/10.10/sql/sql_select.cc:21668
			 | 
		
					#21 0x000055e84ec61ac8 in JOIN::exec_inner (this=0x62900026e2c8) at /data/src/10.10/sql/sql_select.cc:4854
			 | 
		
					#22 0x000055e84ec5efac in JOIN::exec (this=0x62900026e2c8) at /data/src/10.10/sql/sql_select.cc:4632
			 | 
		
					#23 0x000055e84f6d0eb0 in subselect_single_select_engine::exec (this=0x6290000e9c30) at /data/src/10.10/sql/item_subselect.cc:4103
			 | 
		
					#24 0x000055e84f6ac912 in Item_subselect::exec (this=0x6290000e9a98) at /data/src/10.10/sql/item_subselect.cc:811
			 | 
		
					#25 0x000055e84f6b2680 in Item_singlerow_subselect::val_int (this=0x6290000e9a98) at /data/src/10.10/sql/item_subselect.cc:1461
			 | 
		
					#26 0x000055e84e7a5a44 in Item::val_int_result (this=0x6290000e9a98) at /data/src/10.10/sql/item.h:1793
			 | 
		
					#27 0x000055e84f4ced7e in Item_cache_int::cache_value (this=0x6290002819e8) at /data/src/10.10/sql/item.cc:10153
			 | 
		
					#28 0x000055e84f4e5601 in Item_cache_wrapper::cache (this=0x629000281940) at /data/src/10.10/sql/item.cc:8907
			 | 
		
					#29 0x000055e84f4c43be in Item_cache_wrapper::val_int (this=0x629000281940) at /data/src/10.10/sql/item.cc:8961
			 | 
		
					#30 0x000055e84e7a5a44 in Item::val_int_result (this=0x629000281940) at /data/src/10.10/sql/item.h:1793
			 | 
		
					#31 0x000055e84f411ef7 in Type_handler_int_result::make_sort_key_part (this=0x55e85302b7c0 <type_handler_slonglong>, to=0x613000051118 '\276' <repeats 200 times>..., item=0x629000281940, sort_field=0x6290002829e8, tmp_buffer=0x7f1b63e097d8) at /data/src/10.10/sql/filesort.cc:1195
			 | 
		
					#32 0x000055e84f41e732 in make_sortkey (param=0x7f1b63e09760, to=0x613000051118 '\276' <repeats 200 times>...) at /data/src/10.10/sql/filesort.cc:3042
			 | 
		
					#33 0x000055e84f4134b1 in make_sortkey (param=0x7f1b63e09760, to=0x613000051118 '\276' <repeats 200 times>..., ref_pos=0x6190000994e8 "", using_packed_sortkeys=false) at /data/src/10.10/sql/filesort.cc:1364
			 | 
		
					#34 0x000055e84f4109c5 in find_all_keys (thd=0x62b00007e218, param=0x7f1b63e09760, select=0x62900026f9f0, fs_info=0x615000011880, buffpek_pointers=0x7f1b63e09a10, tempfile=0x7f1b63e09860, pq=0x0, found_rows=0x615000011a70) at /data/src/10.10/sql/filesort.cc:979
			 | 
		
					#35 0x000055e84f40bcea in filesort (thd=0x62b00007e218, table=0x619000098d98, filesort=0x6290002821a8, tracker=0x629000282930, join=0x62900026d9b0, first_table_bit=1) at /data/src/10.10/sql/filesort.cc:357
			 | 
		
					#36 0x000055e84ecf55d8 in create_sort_index (thd=0x62b00007e218, join=0x62900026d9b0, tab=0x629000271eb0, fsort=0x6290002821a8) at /data/src/10.10/sql/sql_select.cc:25510
			 | 
		
					#37 0x000055e84ece3bd3 in st_join_table::sort_table (this=0x629000271eb0) at /data/src/10.10/sql/sql_select.cc:23149
			 | 
		
					#38 0x000055e84ece31a0 in join_init_read_record (tab=0x629000271eb0) at /data/src/10.10/sql/sql_select.cc:23088
			 | 
		
					#39 0x000055e84ecdc725 in sub_select (join=0x62900026d9b0, join_tab=0x629000271eb0, end_of_records=false) at /data/src/10.10/sql/sql_select.cc:22135
			 | 
		
					#40 0x000055e84ecda74f in do_select (join=0x62900026d9b0, procedure=0x0) at /data/src/10.10/sql/sql_select.cc:21668
			 | 
		
					#41 0x000055e84ec61ac8 in JOIN::exec_inner (this=0x62900026d9b0) at /data/src/10.10/sql/sql_select.cc:4854
			 | 
		
					#42 0x000055e84ec5efac in JOIN::exec (this=0x62900026d9b0) at /data/src/10.10/sql/sql_select.cc:4632
			 | 
		
					#43 0x000055e84ec63415 in mysql_select (thd=0x62b00007e218, tables=0x62900026ca68, fields=..., conds=0x0, og_num=1, order=0x0, group=0x6290000e9e70, having=0x0, proc_param=0x0, select_options=2164525824, result=0x6290000ea010, unit=0x62b000082658, select_lex=0x6290000e63b0) at /data/src/10.10/sql/sql_select.cc:5112
			 | 
		
					#44 0x000055e84ec33020 in handle_select (thd=0x62b00007e218, lex=0x62b000082580, result=0x6290000ea010, setup_tables_done_option=0) at /data/src/10.10/sql/sql_select.cc:586
			 | 
		
					#45 0x000055e84eb588a0 in execute_sqlcom_select (thd=0x62b00007e218, all_tables=0x62900026ca68) at /data/src/10.10/sql/sql_parse.cc:6278
			 | 
		
					#46 0x000055e84eb46da7 in mysql_execute_command (thd=0x62b00007e218, is_called_from_prepared_stmt=false) at /data/src/10.10/sql/sql_parse.cc:3948
			 | 
		
					#47 0x000055e84eb636fa in mysql_parse (thd=0x62b00007e218, rawbuf=0x6290000e6238 "SELECT GROUP_CONCAT(b), (SELECT COUNT(*) FROM t WHERE outer_t.a IN (SELECT a FROM t HAVING a > 6)) AS f FROM t AS outer_t GROUP BY f", length=132, parser_state=0x7f1b63e0ba30) at /data/src/10.10/sql/sql_parse.cc:8046
			 | 
		
					#48 0x000055e84eb39461 in dispatch_command (command=COM_QUERY, thd=0x62b00007e218, packet=0x629000258219 "", packet_length=132, blocking=true) at /data/src/10.10/sql/sql_parse.cc:1894
			 | 
		
					#49 0x000055e84eb361b2 in do_command (thd=0x62b00007e218, blocking=true) at /data/src/10.10/sql/sql_parse.cc:1407
			 | 
		
					#50 0x000055e84eff13c2 in do_handle_one_connection (connect=0x608000002e38, put_in_cache=true) at /data/src/10.10/sql/sql_connect.cc:1416
			 | 
		
					#51 0x000055e84eff0d83 in handle_one_connection (arg=0x608000002db8) at /data/src/10.10/sql/sql_connect.cc:1318
			 | 
		
					#52 0x000055e84fc008de in pfs_spawn_thread (arg=0x617000005b98) at /data/src/10.10/storage/perfschema/pfs.cc:2201
			 | 
		
					#53 0x00007f1b6b6a7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
			 | 
		
					#54 0x00007f1b6b7285bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
			 | 
		
Reproducible on all alive versions, with at least MyISAM and Aria.
Not reproducible with the provided test case on InnoDB, although possibly it's just the matter of data.