FYI Monthy PKP Usage statistics report causes mysql 10.4 buffer overflow

No action required this is informative at this point.

On 12-31 and 01-31 we had a serious crash loop happen. As it turned out the the crash was related to the query below, I triaged the problem by putting our ojs database on a serperate 5.5 server. I believe this to be some sort of a mysql bug or I need to make performance adjustments. Given the fact its a buffer overflow, I’m leaning towards bug. I’m posting here for the benifit of others.
https://jira.mariadb.org/browse/MDEV-21642

Server version: 10.4.10-MariaDB-log
key_buffer_size=134217728
read_buffer_size=131072
max_used_connections=501
max_threads=502
thread_count=83
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 1235745 K bytes of memory
Hope that’s ok; if not, decrease some variables in the equation.

Thread pointer: 0x7f785c48a548
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 = 0x7f7833b12cf0 thread_stack 0x49000

      • buffer overflow detected *: /usr/sbin/mysqld terminated
        ======= Backtrace: =========
        /lib64/libc.so.6(__fortify_fail+0x37)[0x7f78da19d567]
        /lib64/libc.so.6(+0x1166e2)[0x7f78da19b6e2]
        /lib64/libc.so.6(+0x1184c7)[0x7f78da19d4c7]
        /usr/sbin/mysqld(my_addr_resolve+0xda)[0x5579154d794a]
        /usr/sbin/mysqld(my_print_stacktrace+0x1c2)[0x5579154c00c2]
        /usr/sbin/mysqld(handle_fatal_signal+0x30f)[0x557914f563af]
        /lib64/libpthread.so.0(+0xf630)[0x7f78dbdea630]
        /usr/sbin/mysqld(_ZNK26Type_handler_string_result13Item_const_eqEPK10Item_constS2_b+0x41)[0x557914e84151]
        /usr/sbin/mysqld(_ZNK9Item_func2eqEPK4Itemb+0xf5)[0x557914fc2545]
        /usr/sbin/mysqld(_ZN17Item_func_between14add_key_fieldsEP4JOINPP9KEY_FIELDPjyPP14SARGABLE_PARAM+0x16f)[0x557914d78ccf]
        /usr/sbin/mysqld(_ZN13Item_cond_and14add_key_fieldsEP4JOINPP9KEY_FIELDPjyPP14SARGABLE_PARAM+0x5b)[0x557914d6ed4b]
        /usr/sbin/mysqld(+0x6ca792)[0x557914d79792]
        /usr/sbin/mysqld(_ZN4JOIN14optimize_innerEv+0x17ba)[0x557914da16da]
        /usr/sbin/mysqld(_ZN4JOIN8optimizeEv+0x9d)[0x557914da365d]
        /usr/sbin/mysqld(+0x65e3f3)[0x557914d0d3f3]
        /usr/sbin/mysqld(_Z27mysql_handle_single_derivedP3LEXP10TABLE_LISTj+0x104)[0x557914d0ccb4]
        /usr/sbin/mysqld(_ZN4JOIN14optimize_innerEv+0xc04)[0x557914da0b24]
        /usr/sbin/mysqld(_ZN4JOIN8optimizeEv+0x9d)[0x557914da365d]
        /usr/sbin/mysqld(_Z12mysql_selectP3THDP10TABLE_LISTjR4ListI4ItemEPS4_jP8st_orderS9_S7_S9_yP13select_resultP18st_select_lex_unitP13st_select_lex+0xe1)[0x557914da3761]
        /usr/sbin/mysqld(_Z13handle_selectP3THDP3LEXP13select_resultm+0x1d7)[0x557914da4377]
        /usr/sbin/mysqld(+0x58fd84)[0x557914c3ed84]
        /usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x449a)[0x557914d4bb6a]
        /usr/sbin/mysqld(_ZN18Prepared_statement7executeEP6Stringb+0x4b6)[0x557914d63b16]
        /usr/sbin/mysqld( ZN18Prepared_statement12execute_loopEP6StringbPhS2 +0x92)[0x557914d63cd2]
        /usr/sbin/mysqld(+0x6b55e7)[0x557914d645e7]
        /usr/sbin/mysqld(_Z19mysqld_stmt_executeP3THDPcj+0x27)[0x557914d64677]
        /usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcjbb+0x17dd)[0x557914d5356d]
        /usr/sbin/mysqld(_Z10do_commandP3THD+0x11c)[0x557914d5507c]
        /usr/sbin/mysqld(_Z24do_handle_one_connectionP7CONNECT+0x1fa)[0x557914e30afa]
        /usr/sbin/mysqld(handle_one_connection+0x3d)[0x557914e30bdd]
        /lib64/libpthread.so.0(+0x7ea5)[0x7f78dbde2ea5]
        /lib64/libc.so.6(clone+0x6d)[0x7f78da1838cd]
        ======= Memory map: ========
        5579146af000-557915afd000 r-xp 00000000 fd:00 2101454 /usr/sbin/mysqld
        557915cfc000-557915e28000 r–p 0144d000 fd:00 2101454 /usr/sbin/mysqld
        557915e28000-557915ee2000 rw-p 01579000 fd:00 2101454 /usr/sbin/mysqld
        557915ee2000-557916791000 rw-p 00000000 00:00 0
        5579177ef000-55791b72a000 rw-p 00000000 00:00 0 [heap]
        7f782d93a000-7f782d93b000 —p 00000000 00:00 0
        7f782d93b000-7f782d985000 rw-p 00000000 00:00 0
        7f782da66000-7f782da67000 —p 00000000 00:00 0
        7f782da67000-7f782dab1000 rw-p 00000000 00:00 0
        7f782dcbe000-7f782dcbf000 —p 00000000 00:00 0
        7f782dcbf000-7f782dd09000 rw-p 00000000 00:00 0
        7f782ddea000-7f782ddeb000 —p 00000000 00:00 0
        7f782ddeb000-7f782de35000 rw-p 00000000 00:00 0
        7f782de80000-7f782de81000 —p 00000000 00:00 0
        7f782de81000-7f782decb000 rw-p 00000000 00:00 0
        7f782decb000-7f782decc000 —p 00000000 00:00 0
        7f782decc000-7f782df16000 rw-p 00000000 00:00 0
        7f782df61000-7f782df62000 —p 00000000 00:00 0
        7f782df62000-7f782dfac000 rw-p 00000000 00:00 0

        Fatal signal 6 while backtracing
        2020-01-31 18:00:27 0 [Note] mysqld: Aria engine: starting recovery
        tables to flush: 2 1 0
        (0.0 seconds);
        2020-01-31 18:00:27 0 [Note] mysqld: Aria engine: recovery done
        2020-01-31 18:00:27 0 [Note] InnoDB: Using Linux native AIO
        2020-01-31 18:00:27 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
        2020-01-31 18:00:27 0 [Note] InnoDB: Uses event mutexes
        2020-01-31 18:00:27 0 [Note] InnoDB: Compressed tables use zlib 1.2.7
        2020-01-31 18:00:27 0 [Note] InnoDB: Number of pools: 1
        2020-01-31 18:00:27 0 [Note] InnoDB: Using SSE2 crc32 instructions
        2020-01-31 18:00:27 0 [Note] InnoDB: Initializing buffer pool, total size = 1G, instances = 8, chunk size = 128M
        2020-01-31 18:00:27 0 [Note] InnoDB: Completed initialization of buffer pool
        2020-01-31 18:00:27 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
        2020-01-31 18:00:27 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=5135529723
        2020-01-31 18:00:27 0 [Note] InnoDB: Last binlog file ‘./dbsvc-528-bin.000073’, position 291012683
        2020-01-31 18:00:27 0 [Note] InnoDB: Resizing redo log from 2
        50331648 to 2
        134217728 bytes; LSN=5135529741
        2020-01-31 18:00:27 0 [Note] InnoDB: Starting to delete and rewrite log files.
        2020-01-31 18:00:27 0 [Note] InnoDB: Setting log file ./ib_logfile101 size to 134217728 bytes
        2020-01-31 18:00:27 0 [Note] InnoDB: Setting log file ./ib_logfile1 size to 134217728 bytes
        2020-01-31 18:00:27 0 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
        2020-01-31 18:00:27 0 [Note] InnoDB: New log files created, LSN=5135529741
        2020-01-31 18:00:27 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
        2020-01-31 18:00:27 0 [Note] InnoDB: Removed temporary tablespace data file: “ibtmp1”
        2020-01-31 18:00:27 0 [Note] InnoDB: Creating shared tablespace for temporary tables
        2020-01-31 18:00:27 0 [Note] InnoDB: Setting file ‘./ibtmp1’ size to 12 MB. Physically writing the file full; Please wait …
        2020-01-31 18:00:27 0 [Note] InnoDB: File ‘./ibtmp1’ size is now 12 MB.
        2020-01-31 18:00:27 0 [Note] InnoDB: Waiting for purge to start
        2020-01-31 18:00:27 0 [Note] InnoDB: 10.4.10 started; log sequence number 5135529741; transaction id 5898129
        2020-01-31 18:00:27 0 [Note] InnoDB: Loading buffer pool(s) from /data/mysql/ib_buffer_pool
        2020-01-31 18:00:27 0 [Note] Plugin ‘FEEDBACK’ is disabled.
        2020-01-31 18:00:27 0 [Note] Recovering after a crash using dbsvc-528-bin
        2020-01-31 18:00:28 0 [Note] Starting crash recovery…
        2020-01-31 18:00:28 0 [Note] Crash recovery finished.
        2020-01-31 18:00:28 0 [Note] Server socket created on IP: ‘::’.
        2020-01-31 18:00:28 0 [Note] Reading of all Master_info entries succeeded
        2020-01-31 18:00:28 0 [Note] Added new Master_info ‘’ to hash table
        2020-01-31 18:00:28 10 [Note] Slave I/O thread: Start asynchronous replication to master ‘replication@dbsvc-527.wichita.edu:3306’ in log ‘dbsvc-527-bin.000049’ at position 393
        2020-01-31 18:00:28 11 [Note] Slave SQL thread initialized, starting replication in log ‘dbsvc-527-bin.000049’ at position 393, relay log ‘./dbsvc-528-relay-bin.000173’ position: 696
        2020-01-31 18:00:28 0 [Note] /usr/sbin/mysqld: ready for connections.
        Version: ‘10.4.10-MariaDB-log’ socket: ‘/data/mysql/mysql.sock’ port: 3306 MariaDB Server
        2020-01-31 18:00:28 10 [ERROR] Slave I/O: error connecting to master ‘replication@dbsvc-527.wichita.edu:3306’ - retry-time: 60 maximum-retries: 86400 message: Can’t connect to MySQL server on ‘dbsvc-527.wichita.edu’ (111 “Connection refused”), Internal MariaDB error code: 2003
        2020-01-31 18:00:29 12 [Note] Start binlog_dump to slave_server(1), pos(dbsvc-528-bin.000073, 291041118)
        2020-01-31 18:00:30 0 [Note] InnoDB: Buffer pool(s) load completed at 200131 18:00:30
        2020-01-31 18:00:48 14 [Warning] IP address ‘10.0.59.19’ could not be resolved: Name or service not known
        2020-01-31 18:00:49 16 [ERROR] mysqld: Table ‘./idtgroup/wp_options’ is marked as crashed and should be repaired
        2020-01-31 18:00:49 15 [ERROR] mysqld: Table ‘./wpstart/wp_options’ is marked as crashed and should be repaired
        2020-01-31 18:00:49 16 [Warning] Checking table: ‘./idtgroup/wp_options’
        2020-01-31 18:00:49 15 [Warning] Checking table: ‘./wpstart/wp_options’
        2020-01-31 18:00:49 16 [ERROR] mysqld: Table ‘./idtgroup/wp_posts’ is marked as crashed and should be repaired
        2020-01-31 18:00:50 16 [Warning] Checking table: ‘./idtgroup/wp_posts’
        2020-01-31 18:00:50 17 [ERROR] mysqld: Table ‘./wpstart/wp_posts’ is marked as crashed and should be repaired
        2020-01-31 18:00:50 17 [Warning] Checking table: ‘./wpstart/wp_posts’
        2020-01-31 18:00:50 17 [ERROR] mysqld: Table ‘./wpstart/wp_users’ is marked as crashed and should be repaired
        2020-01-31 18:00:50 17 [Warning] Checking table: ‘./wpstart/wp_users’
        2020-01-31 18:00:50 17 [ERROR] mysqld: Table ‘./wpstart/wp_usermeta’ is marked as crashed and should be repaired
        2020-01-31 18:00:50 17 [Warning] Checking table: ‘./wpstart/wp_usermeta’
        2020-01-31 18:00:50 16 [ERROR] mysqld: Table ‘./idtgroup/wp_postmeta’ is marked as crashed and should be repaired
        2020-01-31 18:00:50 16 [Warning] Checking table: ‘./idtgroup/wp_postmeta’
        2020-01-31 18:00:51 20 [ERROR] mysqld: Table ‘./wpwsutv/wp_options’ is marked as crashed and should be repaired
        2020-01-31 18:00:51 20 [Warning] Checking table: ‘./wpwsutv/wp_options’
        2020-01-31 18:00:51 20 [ERROR] mysqld: Table ‘./wpwsutv/wp_nextend2_section_storage’ is marked as crashed and should be repaired
        2020-01-31 18:00:51 20 [Warning] Checking table: ‘./wpwsutv/wp_nextend2_section_storage’
        2020-01-31 18:00:52 22 [ERROR] mysqld: Table ‘./wpwsutv/wp_usermeta’ is marked as crashed and should be repaired
        2020-01-31 18:00:52 22 [Warning] Checking table: ‘./wpwsutv/wp_usermeta’
        2020-01-31 18:00:52 22 [ERROR] mysqld: Table ‘./wpwsutv/wp_posts’ is marked as crashed and should be repaired
        2020-01-31 18:00:52 22 [Warning] Checking table: ‘./wpwsutv/wp_posts’
        2020-01-31 18:00:52 22 [ERROR] mysqld: Table ‘./wpwsutv/wp_postmeta’ is marked as crashed and should be repaired
        2020-01-31 18:00:52 22 [Warning] Checking table: ‘./wpwsutv/wp_postmeta’
        2020-01-31 18:00:52 20 [ERROR] mysqld: Table ‘./wpwsutv/wp_term_taxonomy’ is marked as crashed and should be repaired
        2020-01-31 18:00:52 20 [Warning] Checking table: ‘./wpwsutv/wp_term_taxonomy’
        2020-01-31 18:00:52 20 [ERROR] mysqld: Table ‘./wpwsutv/wp_term_relationships’ is marked as crashed and should be repaired
        2020-01-31 18:00:52 20 [Warning] Checking table: ‘./wpwsutv/wp_term_relationships’
        2020-01-31 18:00:57 32 [ERROR] mysqld: Table ‘./wpcomm305/comm305_options’ is marked as crashed and should be repaired
        2020-01-31 18:00:57 32 [Warning] Checking table: ‘./wpcomm305/comm305_options’
        2020-01-31 18:00:57 32 [ERROR] mysqld: Table ‘./wpcomm305/comm305_wfHits’ is marked as crashed and should be repaired
        2020-01-31 18:00:57 32 [Warning] Checking table: ‘./wpcomm305/comm305_wfHits’
        2020-01-31 18:00:58 32 [ERROR] mysqld: Table ‘./wpcomm305/comm305_usermeta’ is marked as crashed and should be repaired
        2020-01-31 18:00:58 32 [Warning] Checking table: ‘./wpcomm305/comm305_usermeta’
        2020-01-31 18:00:58 32 [ERROR] mysqld: Table ‘./wpcomm305/comm305_users’ is marked as crashed and should be repaired
        2020-01-31 18:00:58 32 [Warning] Checking table: ‘./wpcomm305/comm305_users’
        2020-01-31 18:01:13 41 [ERROR] mysqld: Table ‘./idtgroup/wp_usermeta’ is marked as crashed and should be repaired
        2020-01-31 18:01:13 41 [Warning] Checking table: ‘./idtgroup/wp_usermeta’
        2020-01-31 18:01:22 45 [ERROR] mysqld: Table ‘./ksarn/wp_options’ is marked as crashed and should be repaired
        2020-01-31 18:01:22 45 [Warning] Checking table: ‘./ksarn/wp_options’
        2020-01-31 18:01:23 45 [ERROR] mysqld: Table ‘./ksarn/wp_posts’ is marked as crashed and should be repaired
        2020-01-31 18:01:23 45 [Warning] Checking table: ‘./ksarn/wp_posts’
        2020-01-31 18:01:23 45 [ERROR] mysqld: Table ‘./ksarn/wp_postmeta’ is marked as crashed and should be repaired
        2020-01-31 18:01:23 45 [Warning] Checking table: ‘./ksarn/wp_postmeta’
        2020-01-31 18:01:24 47 [ERROR] mysqld: Table ‘./ksarn/wp_term_taxonomy’ is marked as crashed and should be repaired
        2020-01-31 18:01:24 47 [Warning] Checking table: ‘./ksarn/wp_term_taxonomy’
        2020-01-31 18:01:24 47 [ERROR] mysqld: Table ‘./ksarn/wp_term_relationships’ is marked as crashed and should be repaired
        2020-01-31 18:01:24 47 [Warning] Checking table: ‘./ksarn/wp_term_relationships’
        2020-01-31 18:01:25 50 [ERROR] mysqld: Table ‘./ksarn/wp_bp_activity’ is marked as crashed and should be repaired
        2020-01-31 18:01:25 50 [Warning] Checking table: ‘./ksarn/wp_bp_activity’
        2020-01-31 18:01:25 50 [ERROR] mysqld: Table ‘./ksarn/wp_bp_activity_meta’ is marked as crashed and should be repaired
        2020-01-31 18:01:25 50 [Warning] Checking table: ‘./ksarn/wp_bp_activity_meta’
        2020-01-31 18:01:25 50 [ERROR] mysqld: Table ‘./ksarn/wp_eum_logs’ is marked as crashed and should be repaired
        2020-01-31 18:01:25 50 [Warning] Checking table: ‘./ksarn/wp_eum_logs’
        2020-01-31 18:01:25 50 [ERROR] mysqld: Table ‘./ksarn/wp_gf_form_view’ is marked as crashed and should be repaired
        2020-01-31 18:01:25 50 [Warning] Checking table: ‘./ksarn/wp_gf_form_view’
        2020-01-31 18:01:25 50 [ERROR] mysqld: Table ‘./ksarn/wp_learndash_user_activity’ is marked as crashed and should be repaired
        2020-01-31 18:01:25 50 [Warning] Checking table: ‘./ksarn/wp_learndash_user_activity’
        2020-01-31 18:01:25 50 [ERROR] mysqld: Table ‘./ksarn/wp_learndash_user_activity_meta’ is marked as crashed and should be repaired
        2020-01-31 18:01:25 50 [Warning] Checking table: ‘./ksarn/wp_learndash_user_activity_meta’
        2020-01-31 18:01:25 50 [ERROR] mysqld: Table ‘./ksarn/wp_usermeta’ is marked as crashed and should be repaired
        2020-01-31 18:01:25 50 [Warning] Checking table: ‘./ksarn/wp_usermeta’
        2020-01-31 18:01:25 50 [ERROR] mysqld: Table ‘./ksarn/wp_users’ is marked as crashed and should be repaired
        2020-01-31 18:01:25 50 [Warning] Checking table: ‘./ksarn/wp_users’
        2020-01-31 18:01:25 50 [ERROR] mysqld: Table ‘./ksarn/wp_wp_pro_quiz_statistic’ is marked as crashed and should be repaired
        2020-01-31 18:01:25 50 [Warning] Checking table: ‘./ksarn/wp_wp_pro_quiz_statistic’
        2020-01-31 18:01:25 50 [ERROR] mysqld: Table ‘./ksarn/wp_wp_pro_quiz_statistic_ref’ is marked as crashed and should be repaired
        2020-01-31 18:01:25 50 [Warning] Checking table: ‘./ksarn/wp_wp_pro_quiz_statistic_ref’
        2020-01-31 18:01:28 10 [Note] Slave I/O thread: connected to master ‘replication@dbsvc-527.wichita.edu:3306’,replication started in log ‘dbsvc-527-bin.000049’ at position 393
        2020-01-31 18:01:35 54 [ERROR] mysqld: Table ‘./ojsdata/sessions’ is marked as crashed and should be repaired
        2020-01-31 18:01:35 54 [Warning] Checking table: ‘./ojsdata/sessions’
        2020-01-31 18:01:35 54 [ERROR] mysqld: Table ‘./ojsdata/site’ is marked as crashed and should be repaired
        2020-01-31 18:01:35 54 [Warning] Checking table: ‘./ojsdata/site’
        2020-01-31 18:01:36 55 [ERROR] mysqld: Table ‘./ojsdata/scheduled_tasks’ is marked as crashed and should be repaired
        2020-01-31 18:01:36 55 [Warning] Checking table: ‘./ojsdata/scheduled_tasks’
        2020-01-31 18:01:36 55 [ERROR] mysqld: Table ‘./ojsdata/controlled_vocabs’ is marked as crashed and should be repaired
        2020-01-31 18:01:36 55 [Warning] Checking table: ‘./ojsdata/controlled_vocabs’
        200131 18:01:36 [ERROR] mysqld got signal 11 ;
        This could be because you hit a bug. It is also possible that this binary
        or one of the libraries it was linked against is corrupt, improperly built,
        or misconfigured. This error can also be caused by malfunctioning hardware.

To report this bug, see https://mariadb.com/kb/en/reporting-bugs

We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

Server version: 10.4.10-MariaDB-log
key_buffer_size=134217728
read_buffer_size=131072
max_used_connections=6
max_threads=502
thread_count=15
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 1235745 K bytes of memory
Hope that’s ok; if not, decrease some variables in the equation.

Thread pointer: 0x7f14f8000a88
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 = 0x7f15000afcf0 thread_stack 0x49000
/usr/sbin/mysqld(my_print_stacktrace+0x2e)[0x560d5781ff2e]
/usr/sbin/mysqld(handle_fatal_signal+0x30f)[0x560d572b63af]
sigaction.c:0(__restore_rt)[0x7f156aa6c630]
/usr/sbin/mysqld(_ZNK26Type_handler_string_result13Item_const_eqEPK10Item_constS2_b+0x41)[0x560d571e4151]
/usr/sbin/mysqld(_ZNK9Item_func2eqEPK4Itemb+0xf5)[0x560d57322545]
/usr/sbin/mysqld(_ZN17Item_func_between14add_key_fieldsEP4JOINPP9KEY_FIELDPjyPP14SARGABLE_PARAM+0x16f)[0x560d570d8ccf]
/usr/sbin/mysqld(_ZN13Item_cond_and14add_key_fieldsEP4JOINPP9KEY_FIELDPjyPP14SARGABLE_PARAM+0x5b)[0x560d570ced4b]
/usr/sbin/mysqld(+0x6ca792)[0x560d570d9792]
/usr/sbin/mysqld(_ZN4JOIN14optimize_innerEv+0x17ba)[0x560d571016da]
/usr/sbin/mysqld(_ZN4JOIN8optimizeEv+0x9d)[0x560d5710365d]
/usr/sbin/mysqld(+0x65e3f3)[0x560d5706d3f3]
/usr/sbin/mysqld(_Z27mysql_handle_single_derivedP3LEXP10TABLE_LISTj+0x104)[0x560d5706ccb4]
/usr/sbin/mysqld(_ZN4JOIN14optimize_innerEv+0xc04)[0x560d57100b24]
/usr/sbin/mysqld(_ZN4JOIN8optimizeEv+0x9d)[0x560d5710365d]
/usr/sbin/mysqld(_Z12mysql_selectP3THDP10TABLE_LISTjR4ListI4ItemEPS4_jP8st_orderS9_S7_S9_yP13select_resultP18st_select_lex_unitP13st_select_lex+0xe1)[0x560d57103761]
/usr/sbin/mysqld(_Z13handle_selectP3THDP3LEXP13select_resultm+0x1d7)[0x560d57104377]
/usr/sbin/mysqld(+0x58fd84)[0x560d56f9ed84]
/usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x449a)[0x560d570abb6a]
/usr/sbin/mysqld(_ZN18Prepared_statement7executeEP6Stringb+0x4b6)[0x560d570c3b16]
/usr/sbin/mysqld( ZN18Prepared_statement12execute_loopEP6StringbPhS2 +0x92)[0x560d570c3cd2]
/usr/sbin/mysqld(+0x6b55e7)[0x560d570c45e7]
/usr/sbin/mysqld(_Z19mysqld_stmt_executeP3THDPcj+0x27)[0x560d570c4677]
/usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcjbb+0x17dd)[0x560d570b356d]
/usr/sbin/mysqld(_Z10do_commandP3THD+0x11c)[0x560d570b507c]
/usr/sbin/mysqld(_Z24do_handle_one_connectionP7CONNECT+0x1fa)[0x560d57190afa]
/usr/sbin/mysqld(handle_one_connection+0x3d)[0x560d57190bdd]
pthread_create.c:0(start_thread)[0x7f156aa64ea5]
/lib64/libc.so.6(clone+0x6d)[0x7f1568e058cd]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7f14f800fe80): select statistics.*, COALESCE(statistics.submission_declined_initial, 0) + COALESCE(statistics.submission_declined, 0) + COALESCE(statistics.submission_declined_other, 0) AS submission_declined_total, (COALESCE(statistics.submission_declined_initial, 0) + COALESCE(statistics.submission_declined, 0) + COALESCE(statistics.submission_declined_other, 0)) / statistics.submission_received * 100 AS submission_rejection_rate, statistics.submission_received / years.count AS avg_submission_received, statistics.submission_accepted / years.count AS avg_submission_accepted, statistics.submission_published / years.count AS avg_submission_published, statistics.submission_declined_initial / years.count AS avg_submission_declined_initial, statistics.submission_declined / years.count AS avg_submission_declined, statistics.submission_declined_other / years.count AS avg_submission_declined_other, (COALESCE(statistics.submission_declined_initial, 0) + COALESCE(statistics.submission_declined, 0) + COALESCE(statistics.submission_declined_other, 0)) / years.count AS avg_submission_declined_total from (select COUNT(active_s.submission_id) AS active_total, COUNT(CASE WHEN active_s.stage_id = 1 THEN 0 END) AS active_submission, COUNT(CASE WHEN active_s.stage_id = 2 THEN 0 END) AS active_internal_review, COUNT(CASE WHEN active_s.stage_id = 3 THEN 0 END) AS active_external_review, COUNT(CASE WHEN active_s.stage_id = 4 THEN 0 END) AS active_copy_editing, COUNT(CASE WHEN active_s.stage_id = 5 THEN 0 END) AS active_production, COUNT(ranged_s.submission_id) AS submission_received, COUNT(CASE WHEN ranged_ed.decision IN (1, 7) THEN 0 END) AS submission_accepted, COUNT(CASE WHEN s.status = 3 AND EXISTS ( SELECT 0 FROM published_submissions ps WHERE ps.submission_id = ranged_s.submission_id ) THEN 0 END) AS submission_published, COUNT(CASE WHEN ranged_ed.decision = 9 THEN 0 END) AS submission_declined_initial, COUNT(CASE WHEN ranged_ed.decision = 4 THEN 0 END) AS submission_declined, COUNT( CASE WHEN ranged_s.status = 4 AND (ed.decision NOT IN (4, 9) OR ed.decision IS NULL) THEN 0 END ) AS submission_declined_other, AVG( CASE WHEN ranged_ed.decision IN (7, 1) THEN DATEDIFF(ranged_ed.date_decided,COALESCE(s.date_submitted, s.last_modified)) END ) AS submission_days_to_accept, AVG( CASE WHEN ranged_ed.decision IN (4, 9) THEN DATEDIFF(ranged_ed.date_decided,COALESCE(s.date_submitted, s.last_modified)) END ) AS submission_days_to_reject, AVG(DATEDIFF(first_ed.date_decided,COALESCE(s.date_submitted, s.last_modified))) AS submission_days_to_first_decision, AVG(DATEDIFF(ranged_ed.date_decided,COALESCE(s.date_submitted, s.last_modified))) AS submission_days_to_decide, COUNT(CASE WHEN ranged_s_ed.decision IN (1, 7) THEN 0 END) / COUNT(ranged_s.submission_id) * 100 AS submission_acceptance_rate, COUNT(CASE WHEN ranged_s_ed.decision = 9 THEN 0 END) / COUNT(ranged_s.submission_id) * 100 AS submission_declined_initial_rate, COUNT(CASE WHEN ranged_s_ed.decision = 4 THEN 0 END) / COUNT(ranged_s.submission_id) * 100 AS submission_declined_rate, COUNT( CASE WHEN ranged_s.status = 4 AND ( ranged_s_ed.decision NOT IN (4, 9) OR ranged_s_ed.decision IS NULL ) THEN 0 END ) / COUNT(ranged_s.submission_id) * 100 AS submission_declined_other_rate from submissions as s left join submissions as active_s on active_s.submission_id = s.submission_id and active_s.status = 1 left join submissions as ranged_s on ranged_s.submission_id = s.submission_id and ranged_s.date_submitted BETWEEN COALESCE(NULL, ranged_s.date_submitted) AND COALESCE(NULL, ranged_s.date_submitted) left join edit_decisions as ed on ed.edit_decision_id = (select ed.edit_decision_id from edit_decisions as ed where ed.submission_id = s.submission_id order by ed.stage_id desc, ed.round desc, ed.date_decided desc limit 1) left join edit_decisions as ranged_s_ed on ranged_s_ed.edit_decision_id = (select ed.edit_decision_id from edit_decisions as ed where ed.submission_id = ranged_s.submission_id order by ed.stage_id desc, ed.round desc, ed.date_decided desc limit 1) left join edit_decisions as ranged_ed on ranged_ed.edit_decision_id = ed.edit_decision_id and ranged_ed.date_decided BETWEEN COALESCE(NULL, ranged_ed.date_decided) AND COALESCE(NULL, ranged_ed.date_decided) left join edit_decisions as first_ed on ranged_ed.edit_decision_id is not null and first_ed.edit_decision_id = (select ed.edit_decision_id from edit_decisions as ed where ed.submission_id = s.submission_id order by ed.stage_id asc, ed.round asc, ed.date_decided asc limit 1) where s.submission_progress = 0 and s.context_id = 1) AS statistics inner join (select EXTRACT(YEAR FROM COALESCE(NULL, CURRENT_TIMESTAMP)) - EXTRACT(YEAR FROM COALESCE( NULL, (select s.date_submitted from submissions as s where s.date_submitted is not null order by s.date_submitted asc limit 1), CURRENT_TIMESTAMP ) ) + 1 AS count) AS years on 1 = 1
Connection ID (thread ID): 56
Status: NOT_KILLED

Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
Writing a core file…
Working directory at /data/mysql
Resource Limits:
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 15066 15066 processes
Max open files 16364 16364 files
Max locked memory 65536 65536 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 15066 15066 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us

Any solutions to this?
We are running into problems to upgrade our OJS 3 test.
It’s running latest Linux (Ubuntu or Debian) PHP and MySQL (8).
The sort_buffer variable does not exist in MySQL 8.
We created it but made no difference.
I’ll post our problem as a different post, anyway.