Bug #118515 | Contribution by Tencent: trx_cleanup_at_db_startup did not clean up trx_sys->shards | ||
---|---|---|---|
Submitted: | 24 Jun 9:08 | Modified: | 30 Jun 10:48 |
Reporter: | yewei Xu (OCA) | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S2 (Serious) |
Version: | 8.4, 8.4.5 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | Contribution |
[24 Jun 9:08]
yewei Xu
[30 Jun 10:48]
MySQL Verification Team
Hello Yewei Xu, Thank you for the report and contribution. Please ensure to re-send the patch via "Contribution" tab otherwise we would not be able to accept it. Thank you. regards, Umesh
[30 Jun 10:50]
MySQL Verification Team
-- 8.4.5 -- Apply provided patch on top of 8.4.5 and build scl enable gcc-toolset-12 bash MYSQL_VERSION="Bug118515" TARGET=/bv/ushastry/Work/Source/$MYSQL_VERSION rm -rf /bv/ushastry/Work/Source/$MYSQL_VERSION rm -rf bld/ mkdir bld && cd bld rm -rf CMakeCache.txt cmake .. -DBUILD_CONFIG=mysql_release -DWITH_DEBUG=1 -DWITH_UNIT_TESTS=0 -DCMAKE_INSTALL_PREFIX=$TARGET -G Ninja ninja -j8 ninja install - [umshastr@bug118403:/bv/ushastry/Work/Source/Bug118515/mysql-test]$ ./mtr bug118515 Logging: ./mtr bug118515 MySQL Version 8.4.5 Checking supported features - Binaries are debug compiled Using 'all' suites Collecting tests Removing old var directory Creating var directory '/bv/ushastry/Work/Source/Bug118515/mysql-test/var' Installing system database Using parallel: 1 ============================================================================== TEST NAME RESULT TIME (ms) COMMENT ------------------------------------------------------------------------------ [ 50%] main.bug118515 [ fail ] Test ended at 2025-06-30 12:47:32 CURRENT_TEST: main.bug118515 mysqltest: At line 24: Query 'update t1 set id = 3 where id = 2' failed. ERROR 2013 (HY000): Lost connection to MySQL server during query safe_process[86692]: Child process: 86693, exit: 1 .. excerpts from error log 2025-06-30T10:47:27.909386Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 13020, socket: /bv/ushastry/Work/Source/Bug118515/mysql-test/var/tmp/mysqlx.1.sock 2025-06-30T10:47:27.909671Z 0 [System] [MY-010931] [Server] /bv/ushastry/Work/Source/Bug118515/bin/mysqld: ready for connections. Version: '8.4.5-debug' socket: '/bv/ushastry/Work/Source/Bug118515/mysql-test/var/tmp/mysqld.1.sock' port: 13000 Source distribution. 2025-06-30T10:47:28.036450Z 8 [ERROR] [MY-013183] [InnoDB] Assertion failure: trx0trx.ic:59:state == TRX_STATE_NOT_STARTED || state == TRX_STATE_FORCED_ROLLBACK thread 140047948146240 InnoDB: We intentionally generate a memory trap. InnoDB: Submit a detailed bug report to http://bugs.mysql.com. InnoDB: If you get repeated assertion failures or crashes, even InnoDB: immediately after the mysqld startup, there may be InnoDB: corruption in the InnoDB tablespace. Please refer to InnoDB: http://dev.mysql.com/doc/refman/8.4/en/forcing-innodb-recovery.html InnoDB: about forcing recovery. 2025-06-30T10:47:28Z UTC - mysqld got signal 6 ; Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware. BuildID[sha1]=5291e0e638adcda180cee2f2c629fd305ab7526c Thread pointer: 0x7f5eb4001040 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 = 7f5f743359f0 thread_stack 0x100000 #0 0x387a8ab print_fatal_signal at /bv/ushastry/Work/Source/mysql-8.4.5/sql/signal_handler.cc:319 #1 0x387abf7 _Z15my_server_abortv at /bv/ushastry/Work/Source/mysql-8.4.5/sql/signal_handler.cc:447 #2 0x4d63c28 _Z8my_abortv at /bv/ushastry/Work/Source/mysql-8.4.5/mysys/my_init.cc:267 #3 0x51a6636 _Z23ut_dbg_assertion_failedPKcS0_m at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/ut/ut0dbg.cc:100 #4 0x4eee88c trx_state_eq at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/include/trx0trx.ic:59 #5 0x4f0dc2e _ZNK18Trx_by_id_with_min3getEm at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/include/trx0sys.h:408 #6 0x4eeedca operator() at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/include/trx0sys.h:577 #7 0x4eeee2b latch_and_execute<trx_sys_t::latch_and_execute_with_active_trx<trx_rw_is_active(trx_id_t, bool)::<lambda(trx_t*)> >(trx_id_t, trx_rw_is_active(trx_id_t, bool)::<lambda(trx_t*)>&&, const ut::Location&)::<lambda(Trx_by_id_with_min&)> > at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/include/ut0guarded.h:54 #8 0x4eeeeb2 latch_and_execute_with_active_trx<trx_rw_is_active(trx_id_t, bool)::<lambda(trx_t*)> > at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/include/trx0sys.h:575 #9 0x4eeef79 trx_rw_is_active at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/include/trx0sys.ic:218 #10 0x4f00f4a _Z29lock_rec_convert_impl_to_explPK11buf_block_tPKhP12dict_index_tPKm at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/lock/lock0lock.cc:5325 #11 0x4f01e22 _Z34lock_clust_rec_read_check_and_lock15lock_duration_tPK11buf_block_tPKhP12dict_index_tPKm11select_mode9lock_modemP9que_thr_t at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/lock/lock0lock.cc:5538 #12 0x50bd4f6 sel_set_rec_lock at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/row/row0sel.cc:1163 #13 0x50c79ef _Z15row_search_mvccPh15page_cur_mode_tP14row_prebuilt_tmm at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/row/row0sel.cc:5244 #14 0x4df14d3 _ZN11ha_innobase10index_readEPhPKhj16ha_rkey_function at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/handler/ha_innodb.cc:10536 #15 0x3a4580f _ZN7handler14index_read_mapEPhPKhm16ha_rkey_function at /bv/ushastry/Work/Source/mysql-8.4.5/sql/handler.h:5621 #16 0x3a3388b _ZN7handler17ha_index_read_mapEPhPKhm16ha_rkey_function at /bv/ushastry/Work/Source/mysql-8.4.5/sql/handler.cc:3287 #17 0x3a3f254 _ZN7handler16read_range_firstEPK9key_rangeS2_bb at /bv/ushastry/Work/Source/mysql-8.4.5/sql/handler.cc:7405 #18 0x4df2b9a _ZN11ha_innobase16read_range_firstEPK9key_rangeS2_bb at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/handler/ha_innodb.cc:11024 #19 0x3a3d003 _ZN7handler21multi_range_read_nextEPPc at /bv/ushastry/Work/Source/mysql-8.4.5/sql/handler.cc:6553 #20 0x3a3dfe9 _ZN10DsMrr_impl10dsmrr_nextEPPc at /bv/ushastry/Work/Source/mysql-8.4.5/sql/handler.cc:6904 #21 0x4e0e3ff _ZN11ha_innobase21multi_range_read_nextEPPc at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/handler/ha_innodb.cc:23701 #22 0x3a3cd35 _ZN7handler24ha_multi_range_read_nextEPPc at /bv/ushastry/Work/Source/mysql-8.4.5/sql/handler.cc:6491 #23 0x3d4c03e _ZN22IndexRangeScanIterator4ReadEv at /bv/ushastry/Work/Source/mysql-8.4.5/sql/range_optimizer/index_range_scan.cc:374 #24 0x377198c _ZN14Sql_cmd_update19update_single_tableEP3THD at /bv/ushastry/Work/Source/mysql-8.4.5/sql/sql_update.cc:876 #25 0x3774ae9 _ZN14Sql_cmd_update13execute_innerEP3THD at /bv/ushastry/Work/Source/mysql-8.4.5/sql/sql_update.cc:1824 #26 0x36b6daf _ZN11Sql_cmd_dml7executeEP3THD at /bv/ushastry/Work/Source/mysql-8.4.5/sql/sql_select.cc:782 #27 0x362c57f _Z21mysql_execute_commandP3THDb at /bv/ushastry/Work/Source/mysql-8.4.5/sql/sql_parse.cc:3672 #28 0x3631f4f _Z20dispatch_sql_commandP3THDP12Parser_state at /bv/ushastry/Work/Source/mysql-8.4.5/sql/sql_parse.cc:5406 #29 0x3627f12 _Z16dispatch_commandP3THDPK8COM_DATA19enum_server_command at /bv/ushastry/Work/Source/mysql-8.4.5/sql/sql_parse.cc:2136 #30 0x3625d5b _Z10do_commandP3THD at /bv/ushastry/Work/Source/mysql-8.4.5/sql/sql_parse.cc:1465 #31 0x3864f0f handle_connection at /bv/ushastry/Work/Source/mysql-8.4.5/sql/conn_handler/connection_handler_per_thread.cc:304 #32 0x59e8c0d pfs_spawn_thread at /bv/ushastry/Work/Source/mysql-8.4.5/storage/perfschema/pfs.cc:3061 #33 0x7f5f7f0bc1a9 <unknown> #34 0x7f5f7f14128f <unknown> #35 0xffffffffffffffff <unknown> Trying to get some variables. Some pointers may be invalid and cause the dump to abort. Query (7f5eb400bae0): update t1 set id = 3 where id = 2 Connection ID (thread ID): 8 Status: NOT_KILLED
[30 Jun 10:52]
MySQL Verification Team
--bt Thread 1 (Thread 0x7f5f74336640 (LWP 86746)): #0 0x00007f5f7f0bdf1c in __pthread_kill_implementation () from /lib64/libc.so.6 #1 0x0000000004d6d068 in my_write_core (sig=6) at /bv/ushastry/Work/Source/mysql-8.4.5/mysys/stacktrace.cc:344 #2 0x000000000387ab7e in handle_fatal_signal (sig=6, info=0x7f5f7432f870, ucontext=0x7f5f7432f740) at /bv/ushastry/Work/Source/mysql-8.4.5/sql/signal_handler.cc:409 #3 <signal handler called> #4 0x00007f5f7f0bdf1c in __pthread_kill_implementation () from /lib64/libc.so.6 #5 0x00007f5f7f070b46 in raise () from /lib64/libc.so.6 #6 0x00007f5f7f05a833 in abort () from /lib64/libc.so.6 #7 0x000000000387ad0c in my_server_abort () at /bv/ushastry/Work/Source/mysql-8.4.5/sql/signal_handler.cc:465 #8 0x0000000004d63c29 in my_abort () at /bv/ushastry/Work/Source/mysql-8.4.5/mysys/my_init.cc:267 #9 0x00000000051a6637 in ut_dbg_assertion_failed (expr=0x74d5c50 "state == TRX_STATE_NOT_STARTED || state == TRX_STATE_FORCED_ROLLBACK", file=0x74d5bd8 "/bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/include/trx0trx.ic", line=59) at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/ut/ut0dbg.cc:100 #10 0x0000000004eee88d in trx_state_eq (trx=0x7f5f7746d428, state=TRX_STATE_COMMITTED_IN_MEMORY) at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/include/trx0trx.ic:59 #11 0x0000000004f0dc2f in Trx_by_id_with_min::get (this=0x7f5f703791f8, trx_id=1557) at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/include/trx0sys.h:408 #12 0x0000000004eeedcb in operator() (__closure=0x7f5f743308c0, trx_by_id_with_min=...) at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/include/trx0sys.h:577 #13 0x0000000004eeee2c in ut::Guarded<Trx_by_id_with_min, (latch_id_t)79>::latch_and_execute<trx_sys_t::latch_and_execute_with_active_trx<trx_rw_is_active(trx_id_t, bool)::<lambda(trx_t*)> >(trx_id_t, trx_rw_is_active(trx_id_t, bool)::<lambda(trx_t*)>&&, const ut::Location&)::<lambda(Trx_by_id_with_min&)> >(struct {...} &&, const ut::Location &) (this=0x7f5f70379140, f=..., loc=...) at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/include/ut0guarded.h:54 #14 0x0000000004eeeeb3 in trx_sys_t::latch_and_execute_with_active_trx<trx_rw_is_active(trx_id_t, bool)::<lambda(trx_t*)> >(trx_id_t, struct {...} &&, const ut::Location &) (this=0x7f5f703773b0, trx_id=1557, f=..., loc=...) at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/include/trx0sys.h:575 #15 0x0000000004eeef7a in trx_rw_is_active (trx_id=1557, do_ref_count=true) at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/include/trx0sys.ic:218 #16 0x0000000004f00f4b in lock_rec_convert_impl_to_expl (block=0x7f5f750f4948, rec=0x7f5f75eb0093 "", index=0x7f5eb40c25b8, offsets=0x7f5f74331100) at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/lock/lock0lock.cc:5325 #17 0x0000000004f01e23 in lock_clust_rec_read_check_and_lock (duration=lock_duration_t::REGULAR, block=0x7f5f750f4948, rec=0x7f5f75eb0093 "", index=0x7f5eb40c25b8, offsets=0x7f5f74331100, sel_mode=SELECT_ORDINARY, mode=LOCK_X, gap_mode=1024, thr=0x7f5eb40c9848) at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/lock/lock0lock.cc:5538 #18 0x00000000050bd4f7 in sel_set_rec_lock (pcur=0x7f5eb40c9160, rec=0x7f5f75eb0093 "", index=0x7f5eb40c25b8, offsets=0x7f5f74331100, sel_mode=SELECT_ORDINARY, mode=3, type=1024, thr=0x7f5eb40c9848, mtr=0x7f5f74331430) at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/row/row0sel.cc:1163 #19 0x00000000050c79f0 in row_search_mvcc (buf=0x7f5eb409d550 "\377", mode=PAGE_CUR_GE, prebuilt=0x7f5eb40c8ef8, match_mode=1, direction=0) at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/row/row0sel.cc:5244 #20 0x0000000004df14d4 in ha_innobase::index_read (this=0x7f5eb409d240, buf=0x7f5eb409d550 "\377", key_ptr=0x7f5eb40a7d08 "\002", key_len=4, find_flag=HA_READ_KEY_EXACT) at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/handler/ha_innodb.cc:10536 #21 0x0000000003a45810 in handler::index_read_map (this=0x7f5eb409d240, buf=0x7f5eb409d550 "\377", key=0x7f5eb40a7d08 "\002", keypart_map=1, find_flag=HA_READ_KEY_EXACT) at /bv/ushastry/Work/Source/mysql-8.4.5/sql/handler.h:5621 #22 0x0000000003a3388c in handler::ha_index_read_map (this=0x7f5eb409d240, buf=0x7f5eb409d550 "\377", key=0x7f5eb40a7d08 "\002", keypart_map=1, find_flag=HA_READ_KEY_EXACT) at /bv/ushastry/Work/Source/mysql-8.4.5/sql/handler.cc:3287 #23 0x0000000003a3f255 in handler::read_range_first (this=0x7f5eb409d240, start_key=0x7f5eb409d320, end_key=0x7f5eb409d340, eq_range_arg=true, sorted=true) at /bv/ushastry/Work/Source/mysql-8.4.5/sql/handler.cc:7405 #24 0x0000000004df2b9b in ha_innobase::read_range_first (this=0x7f5eb409d240, start_key=0x7f5eb409d320, end_key=0x7f5eb409d340, eq_range_arg=true, sorted=true) at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/handler/ha_innodb.cc:11024 #25 0x0000000003a3d004 in handler::multi_range_read_next (this=0x7f5eb409d240, range_info=0x7f5f74332738) at /bv/ushastry/Work/Source/mysql-8.4.5/sql/handler.cc:6553 #26 0x0000000003a3dfea in DsMrr_impl::dsmrr_next (this=0x7f5eb409d4c8, range_info=0x7f5f74332738) at /bv/ushastry/Work/Source/mysql-8.4.5/sql/handler.cc:6904 #27 0x0000000004e0e400 in ha_innobase::multi_range_read_next (this=0x7f5eb409d240, range_info=0x7f5f74332738) at /bv/ushastry/Work/Source/mysql-8.4.5/storage/innobase/handler/ha_innodb.cc:23701 #28 0x0000000003a3cd36 in handler::ha_multi_range_read_next (this=0x7f5eb409d240, range_info=0x7f5f74332738) at /bv/ushastry/Work/Source/mysql-8.4.5/sql/handler.cc:6491 #29 0x0000000003d4c03f in IndexRangeScanIterator::Read (this=0x7f5eb40a8208) at /bv/ushastry/Work/Source/mysql-8.4.5/sql/range_optimizer/index_range_scan.cc:374 #30 0x000000000377198d in Sql_cmd_update::update_single_table (this=0x7f5eb400f010, thd=0x7f5eb4001040) at /bv/ushastry/Work/Source/mysql-8.4.5/sql/sql_update.cc:876 #31 0x0000000003774aea in Sql_cmd_update::execute_inner (this=0x7f5eb400f010, thd=0x7f5eb4001040) at /bv/ushastry/Work/Source/mysql-8.4.5/sql/sql_update.cc:1824 #32 0x00000000036b6db0 in Sql_cmd_dml::execute (this=0x7f5eb400f010, thd=0x7f5eb4001040) at /bv/ushastry/Work/Source/mysql-8.4.5/sql/sql_select.cc:782 #33 0x000000000362c580 in mysql_execute_command (thd=0x7f5eb4001040, first_level=true) at /bv/ushastry/Work/Source/mysql-8.4.5/sql/sql_parse.cc:3672 #34 0x0000000003631f50 in dispatch_sql_command (thd=0x7f5eb4001040, parser_state=0x7f5f743348e0) at /bv/ushastry/Work/Source/mysql-8.4.5/sql/sql_parse.cc:5406 #35 0x0000000003627f13 in dispatch_command (thd=0x7f5eb4001040, com_data=0x7f5f743359c0, command=COM_QUERY) at /bv/ushastry/Work/Source/mysql-8.4.5/sql/sql_parse.cc:2136 #36 0x0000000003625d5c in do_command (thd=0x7f5eb4001040) at /bv/ushastry/Work/Source/mysql-8.4.5/sql/sql_parse.cc:1465 #37 0x0000000003864f10 in handle_connection (arg=0x1939dd00) at /bv/ushastry/Work/Source/mysql-8.4.5/sql/conn_handler/connection_handler_per_thread.cc:304 #38 0x00000000059e8c0e in pfs_spawn_thread (arg=0x194405c0) at /bv/ushastry/Work/Source/mysql-8.4.5/storage/perfschema/pfs.cc:3061 #39 0x00007f5f7f0bc1aa in start_thread () from /lib64/libc.so.6 #40 0x00007f5f7f141290 in clone3 () from /lib64/libc.so.6
[1 Jul 1:43]
yewei Xu
fix trx_cleanup_at_db_startup did not clean up trx_sys->shards (*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.
Contribution: bug118515.patch (application/octet-stream, text), 746 bytes.
[1 Jul 4:35]
MySQL Verification Team
Thank you, for the Contribution. regards, Umesh