Bug #111859 assertion fails by shutdown trx_sys_close: m_views and trx_sys->mysq
Submitted: 24 Jul 2023 8:43 Modified: 24 Jul 2023 13:16
Reporter: Fan Lyu Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[24 Jul 2023 8:43] Fan Lyu
Description:
I got two assertion fails

UT_LIST_GET_LEN(m_views) == 0

#0  0x0000ffffa07b8a40 in pthread_kill () from /usr/lib64/libpthread.so.0
#1  0x000000000201012c in my_write_core (sig=<optimized out>) at ../../../include/my_thread.h:88
#2  0x0000000000e237f0 in handle_fatal_signal (sig=6) at ../../../sql/signal_handler.cc:180
#3  <signal handler called>
#4  0x0000ffffa01df470 in raise () from /usr/lib64/libc.so.6
#5  0x0000ffffa01e081c in abort () from /usr/lib64/libc.so.6
#6  0x0000000000a01334 in ut_dbg_assertion_failed (expr=expr@entry=0x32719e0 "UT_LIST_GET_LEN(m_views) == 0", 
    file=file@entry=0x3271920 "../../../../storage/innobase/read/read0read.cc", line=line@entry=384) at ../../../../storage/innobase/ut/ut0dbg.cc:99
#7  0x000000000222a388 in MVCC::~MVCC (this=0xffff89655160, __in_chrg=<optimized out>) at ../../../../storage/innobase/read/read0read.cc:384
#8  MVCC::~MVCC (this=0xffff89655160, __in_chrg=<optimized out>) at ../../../../storage/innobase/read/read0read.cc:376
#9  0x00000000022c25e4 in ut_allocator<MVCC>::destroy (p=0xffff89655160, this=<synthetic pointer>) at ../../../../storage/innobase/include/ut0new.h:743
#10 ut_delete<MVCC> (ptr=0xffff89655160) at ../../../../storage/innobase/include/ut0new.h:1049
#11 trx_sys_close () at ../../../../storage/innobase/trx/trx0sys.cc:575
#12 0x000000000229c000 in srv_shutdown () at ../../../../storage/innobase/srv/srv0start.cc:3688
#13 0x000000000213e354 in innodb_shutdown () at ../../../../storage/innobase/handler/ha_innodb.cc:1466
#14 0x0000000000eff6d0 in ha_finalize_handlerton (plugin=0xffff8e198458) at ../../../sql/handler.cc:724
#15 0x0000000000d1fdd4 in plugin_deinitialize (plugin=plugin@entry=0xffff8e198458, ref_check=ref_check@entry=true) at ../../../sql/sql_plugin.cc:1117
#16 0x0000000000d1eb84 in reap_plugins () at ../../../sql/sql_plugin.cc:1192
#17 0x0000000000d1f808 in plugin_shutdown () at ../../../sql/sql_plugin.cc:2035
#18 0x0000000000c20278 in clean_up (print_message=true) at ../../../sql/mysqld.cc:2636
#19 0x0000000000c1281c in mysqld_main (argc=<optimized out>, argv=<optimized out>) at ../../../sql/mysqld.cc:7823
#20 0x0000ffffa01ccf40 in __libc_start_main () from /usr/lib64/libc.so.6
#21 0x0000000000c10b0c in _start () at ../../../sql/mysqld.cc:3972

and UT_LIST_GET_LEN(trx_sys->mysql_trx_list) == 0
#0  0x0000ffff9f702a40 in pthread_kill () from /usr/lib64/libpthread.so.0
#1  0x00000000020dec1c in my_write_core (sig=<optimized out>) at ../../../include/my_thread.h:78
#2  0x0000000000de784c in handle_fatal_signal (sig=6) at ../../../sql/signal_handler.cc:211
#3  <signal handler called>
#4  0x0000ffff9f172470 in raise () from /usr/lib64/libc.so.6
#5  0x0000ffff9f17381c in abort () from /usr/lib64/libc.so.6
#6  0x0000000000de79e4 in my_server_abort () at ../../../sql/signal_handler.cc:267
#7  0x00000000020da754 in my_abort () at ../../../mysys/my_init.cc:259
#8  0x00000000023a2a10 in ut_dbg_assertion_failed (expr=expr@entry=0x3416a68 "UT_LIST_GET_LEN(trx_sys->mysql_trx_list) == 0", 
    file=file@entry=0x34167a0 "../../../../storage/innobase/trx/trx0sys.cc", line=line@entry=641) at ../../../../storage/innobase/ut/ut0dbg.cc:99
#9  0x000000000238fb30 in trx_sys_close () at ../../../../storage/innobase/trx/trx0sys.cc:641
#10 0x00000000023673cc in srv_shutdown () at ../../../../storage/innobase/srv/srv0start.cc:3694
#11 0x000000000220ebfc in innodb_shutdown () at ../../../../storage/innobase/handler/ha_innodb.cc:1514
#12 0x0000000000ec88d0 in ha_finalize_handlerton (plugin=0xffff8843f5c8) at ../../../sql/handler.cc:724
#13 0x0000000000cddb24 in plugin_deinitialize (plugin=plugin@entry=0xffff8843f5c8, ref_check=ref_check@entry=true) at ../../../sql/sql_plugin.cc:1117
#14 0x0000000000cdc62c in reap_plugins () at ../../../sql/sql_plugin.cc:1192
#15 0x0000000000cdd4f4 in plugin_shutdown () at ../../../sql/sql_plugin.cc:2031
#16 0x0000000000bf4e44 in clean_up (print_message=true) at ../../../sql/mysqld.cc:2705
#17 0x0000000000be66b8 in mysqld_main (argc=<optimized out>, argv=<optimized out>) at ../../../sql/mysqld.cc:8142
#18 0x0000ffff9f15ff40 in __libc_start_main () from /usr/lib64/libc.so.6
#19 0x0000000000be4808 in _start () at ../../../sql/mysqld.cc:5434

At first, I thought it's just simple concurrency problem by shutdown.
However, When I use sync_debug to repeat the error, I Found one thing:
before entering clean_up ->...->trx_sys_close,user threads are already killed and connection no more exists.
So I don't think that's caused by user's pquery concurrency. That could probably be some logical fault of clean up.

How to repeat:
hard to repeat, just shutdown when pquery tests.
[24 Jul 2023 13:16] MySQL Verification Team
HI Mr. Lyu,

Thank you for your bug report.

However ......

Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.mysql.com/how-to-report.php 

If you can provide more information, add the fully repeatable test case  it to this bug and we shall  change the status of this report.  

Thank you for your interest in MySQL.