[MDEV-22115] handle_fatal_signal (sig=8, SIGFPE) in dict_index_add_to_cache Created: 2020-04-02  Updated: 2020-04-17  Resolved: 2020-04-02

Status: Closed
Project: MariaDB Server
Component/s: GIS, Storage Engine - InnoDB
Affects Version/s: 10.5
Fix Version/s: 10.4.13, 10.5.2

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: not-10.1, not-10.2, not-10.3, not-10.4, regression

Issue Links:
Duplicate
duplicates MDEV-21792 Server aborts upon attempt to create ... Closed

 Description   

CREATE TABLE t (c MULTIPOLYGON UNIQUE);
ALTER TABLE t ADD INDEX(c);
# ---- OR ----
CREATE TABLE t (c GEOMETRYCOLLECTION UNIQUE);
ALTER TABLE t ADD INDEX(c);
# ---- OR ----
CREATE TABLE t(c LINESTRING UNIQUE);
ALTER TABLE t ADD INDEX(c);

Leads to:

10.5.2 535c284aedddb6cc3bedba4a8877b501f456991e

Core was generated by `/data/MD180320-mariadb-10.5.2-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGFPE, Arithmetic exception.
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=8)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
[Current thread is 1 (Thread 0x7f298129f700 (LWP 2811))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=8) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000055eecad6d7d4 in my_write_core (sig=sig@entry=8) at /data/git/10.5_dbg/mysys/stacktrace.c:518
#2  0x000055eeca516b5f in handle_fatal_signal (sig=8) at /data/git/10.5_dbg/sql/signal_handler.cc:325
#3  <signal handler called>
#4  0x000055eecac0552c in dict_index_add_to_cache (index=@0x7f2952c829d0: 0x7f2952ca4498, page_no=page_no@entry=4294967295, add_v=<optimized out>) at /data/git/10.5_dbg/storage/innobase/dict/dict0dict.cc:2035
#5  0x000055eecabf171b in dict_create_index_step (thr=thr@entry=0x7f2952c8bc38) at /data/git/10.5_dbg/storage/innobase/dict/dict0crea.cc:1247
#6  0x000055eeca9ec2d9 in que_thr_step (thr=0x7f2952c8bc38) at /data/git/10.5_dbg/storage/innobase/que/que0que.cc:1048
#7  que_run_threads_low (thr=0x7f2952c8bc38) at /data/git/10.5_dbg/storage/innobase/que/que0que.cc:1100
#8  que_run_threads (thr=thr@entry=0x7f2952c8bc38) at /data/git/10.5_dbg/storage/innobase/que/que0que.cc:1140
#9  0x000055eecaa4d4eb in row_create_index_for_mysql (index=<optimized out>, index@entry=0x7f2952ca4498, trx=trx@entry=0x7f296b4033b0, field_lengths=field_lengths@entry=0x7f2952c5a368) at /data/git/10.5_dbg/storage/innobase/row/row0mysql.cc:2544
#10 0x000055eeca8ef112 in create_index (trx=<optimized out>, form=<optimized out>, table=<optimized out>, key_num=key_num@entry=1) at /data/git/10.5_dbg/storage/innobase/handler/ha_innodb.cc:11002
#11 0x000055eeca8eba5c in create_table_info_t::create_table (this=this@entry=0x7f2981298ec0, create_fk=create_fk@entry=true) at /data/git/10.5_dbg/storage/innobase/handler/ha_innodb.cc:12712
#12 0x000055eeca8f81ad in ha_innobase::create (this=<optimized out>, name=0x7f298129cf4d "./test/#sql-90d_5", form=<optimized out>, create_info=0x7f298129d2d0, file_per_table=<optimized out>, trx=<optimized out>, trx@entry=0x0) at /data/git/10.5_dbg/storage/innobase/handler/ha_innodb.cc:13175
#13 0x000055eeca8ebdb9 in ha_innobase::create (this=<optimized out>, name=<optimized out>, form=<optimized out>, create_info=<optimized out>) at /data/git/10.5_dbg/storage/innobase/handler/ha_innodb.cc:13228
#14 0x000055eeca5261d9 in handler::ha_create (this=0x7f2952c31ea0, name=0x7f298129cf4d "./test/#sql-90d_5", form=form@entry=0x7f2981299480, info_arg=info_arg@entry=0x7f298129d2d0) at /data/git/10.5_dbg/sql/handler.cc:4859
#15 0x000055eeca526ec5 in ha_create_table (thd=thd@entry=0x7f2952c15088, path=path@entry=0x7f298129cf4d "./test/#sql-90d_5", db=0x7f2952c74858 "test", table_name=0x7f2952c74150 "t", create_info=create_info@entry=0x7f298129d2d0, frm=frm@entry=0x7f298129aab0) at /data/git/10.5_dbg/sql/handler.cc:5323
#16 0x000055eeca346cab in mysql_alter_table (thd=thd@entry=0x7f2952c15088, new_db=new_db@entry=0x7f2952c19938, new_name=new_name@entry=0x7f2952c19d40, create_info=create_info@entry=0x7f298129d2d0, table_list=<optimized out>, table_list@entry=0x7f2952c74188, alter_info=alter_info@entry=0x7f298129d200, order_num=0, order=0x0, ignore=false) at /data/git/10.5_dbg/sql/sql_table.cc:10266
#17 0x000055eeca3c8066 in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x7f2952c15088) at /data/git/10.5_dbg/sql/sql_alter.cc:519
#18 0x000055eeca274cae in mysql_execute_command (thd=thd@entry=0x7f2952c15088) at /data/git/10.5_dbg/sql/sql_parse.cc:5887
#19 0x000055eeca27c7a5 in mysql_parse (thd=thd@entry=0x7f2952c15088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7f298129e450, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/git/10.5_dbg/sql/sql_parse.cc:7926
#20 0x000055eeca268664 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f2952c15088, packet=packet@entry=0x7f2952c67089 "ALTER TABLE t ADD INDEX(c)", packet_length=packet_length@entry=26, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/git/10.5_dbg/sql/sql_parse.cc:1839
#21 0x000055eeca266eaf in do_command (thd=0x7f2952c15088) at /data/git/10.5_dbg/sql/sql_parse.cc:1358
#22 0x000055eeca3c0a09 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x7f295d62b3a8, put_in_cache=put_in_cache@entry=true) at /data/git/10.5_dbg/sql/sql_connect.cc:1422
#23 0x000055eeca3c0d38 in handle_one_connection (arg=arg@entry=0x7f295d62b3a8) at /data/git/10.5_dbg/sql/sql_connect.cc:1319
#24 0x000055eeca81dcfc in pfs_spawn_thread (arg=0x7f297ec45888) at /data/git/10.5_dbg/storage/perfschema/pfs.cc:2201
#25 0x00007f29806c66db in start_thread (arg=0x7f298129f700) at pthread_create.c:463
#26 0x00007f297fac488f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.5.2 (dbg)

Bug confirmed not present in:
MariaDB: 10.1.45 (dbg), 10.1.45 (opt), 10.2.32 (dbg), 10.2.32 (opt), 10.3.23 (dbg), 10.3.23 (opt), 10.4.13 (dbg), 10.4.13 (opt), 10.5.2 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)



 Comments   
Comment by Roel Van de Paar [ 2020-04-02 ]

Any connection to MDEV-21792?

Comment by Marko Mäkelä [ 2020-04-02 ]

I am unable to reproduce this.

--source include/have_innodb.inc
SET innodb_strict_mode=0;
CREATE TABLE t (c MULTIPOLYGON UNIQUE) ENGINE=InnoDB;
ALTER TABLE t ADD INDEX(c);
DROP TABLE t;
CREATE TABLE t (c GEOMETRYCOLLECTION UNIQUE) ENGINE=InnoDB;
ALTER TABLE t ADD INDEX(c);
DROP TABLE t;
CREATE TABLE t(c LINESTRING UNIQUE);
ALTER TABLE t ADD INDEX(c);
DROP TABLE t;

With or without overriding innodb_strict_mode, I get the following output, but no crash:

10.5 33ffcecc8902af467761569be92aea160335e3bd

SET innodb_strict_mode=0;
CREATE TABLE t (c MULTIPOLYGON UNIQUE) ENGINE=InnoDB;
ALTER TABLE t ADD INDEX(c);
Warnings:
Warning	1071	Specified key was too long; max key length is 3072 bytes
DROP TABLE t;
CREATE TABLE t (c GEOMETRYCOLLECTION UNIQUE) ENGINE=InnoDB;
ALTER TABLE t ADD INDEX(c);
Warnings:
Warning	1071	Specified key was too long; max key length is 3072 bytes
DROP TABLE t;
CREATE TABLE t(c LINESTRING UNIQUE);
ALTER TABLE t ADD INDEX(c);
Warnings:
Warning	1071	Specified key was too long; max key length is 1000 bytes
DROP TABLE t;

Can you please supply a ./mtr test case and specify the failing source code revision? I would expect that the claimed bug was fixed in MDEV-21792.

Note: it is strange that in the last case, the maximum key length is claimed to be 1000 bytes instead of 3072.

Comment by Roel Van de Paar [ 2020-04-02 ]

10.5.3 33ffcecc8902af467761569be92aea160335e3bd

Specified key was too long; max key length is 3072 bytes

Using the latest revision, I can confirm I also get the above (3072) for all three testcases in 10.5.3, `innodb_strict_mode` on or off.

Re: 1000 length. could it be that you had a different default engine or similar? (the 3rd `CREATE TABLE` in the proposed MTR testcase does not have `ENGINE=InnoDB`)?

Can someone confirm that the 3072 warning is accurate?

Comment by Marko Mäkelä [ 2020-04-02 ]

This was reproduced with 535c284aedddb6cc3bedba4a8877b501f456991e, which was before the 10.5.2 release and missing the MDEV-21792 fix. Hence, we can conclude that this report is a duplicate of MDEV-21792.

Comment by Roel Van de Paar [ 2020-04-02 ]

Also tested MySQL, FYI

MySQL 5.7.29 output

5.7.29>CREATE TABLE t (c MULTIPOLYGON UNIQUE) ENGINE=InnoDB;
ERROR 1170 (42000): BLOB/TEXT column 'c' used in key specification without a key length
5.7.29>CREATE TABLE t (c GEOMETRYCOLLECTION UNIQUE) ENGINE=InnoDB;
ERROR 1170 (42000): BLOB/TEXT column 'c' used in key specification without a key length
5.7.29>CREATE TABLE t(c LINESTRING UNIQUE) ENGINE=InnoDB;
ERROR 1170 (42000): BLOB/TEXT column 'c' used in key specification without a key length

MySQL 8.0.19 output

8.0.19>CREATE TABLE t (c MULTIPOLYGON UNIQUE) ENGINE=InnoDB;
ERROR 3728 (HY000): Spatial indexes can't be primary or unique indexes.
8.0.19>CREATE TABLE t (c GEOMETRYCOLLECTION UNIQUE) ENGINE=InnoDB;
ERROR 3728 (HY000): Spatial indexes can't be primary or unique indexes.
8.0.19>CREATE TABLE t(c LINESTRING UNIQUE) ENGINE=InnoDB;
ERROR 3728 (HY000): Spatial indexes can't be primary or unique indexes.

Comment by Roel Van de Paar [ 2020-04-17 ]

Just for the record adding another testcase which was still in queue

USE test;
CREATE TABLE t (c YEAR KEY,e JSON,d GEOMETRY);
ALTER TABLE t ADD INDEX(d),ADD UNIQUE (d);
ALTER TABLE t ADD INDEX(d),ADD UNIQUE (d);

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