Skip to content

Instantly share code, notes, and snippets.

@yoku0825
Created June 8, 2020 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoku0825/9683dbe7b5b7b9ebffe99f95ba0f8a54 to your computer and use it in GitHub Desktop.
Save yoku0825/9683dbe7b5b7b9ebffe99f95ba0f8a54 to your computer and use it in GitHub Desktop.
gdb使っちゃえば簡単に再現はできるんだけれども
$ gdb -p 20825
(gdb) up
+up
#1 0x0000000000d4c9ad in Mysqld_socket_listener::listen_for_connection_event (this=0x34bcac0)
at /home/yoku0825/mysql-5.7.30/sql/conn_handler/socket_connection.cc:859
859 int retval= poll(&m_poll_info.m_fds[0], m_socket_map.size(), -1);
(gdb) p connection_count
+p connection_count
No symbol "connection_count" in current context.
(gdb) up
+up
#2 0x000000000078fcf0 in connection_event_loop (this=0x34bc560)
at /home/yoku0825/mysql-5.7.30/sql/conn_handler/connection_acceptor.h:73
73 Channel_info *channel_info= m_listener->listen_for_connection_event();
(gdb) p mgr->connection_count++
+p mgr->connection_count++
$4 = 0
(gdb) p mgr->connection_count
+p mgr->connection_count
$5 = 1
mysql57 6> SHOW GLOBAL STATUS LIKE 'Threads_connected';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Threads_connected | 2 |
+-------------------+-------+
1 row in set (0.00 sec)
mysql57 6> SHOW PROCESSLIST;
+----+-----------------+-----------+------+---------+------+--------------------------------------------------------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+-----------------+-----------+------+---------+------+--------------------------------------------------------+------------------+
| 2 | system user | | NULL | Connect | 146 | Slave has read all relay log; waiting for more updates | NULL |
| 3 | event_scheduler | localhost | NULL | Daemon | 146 | Waiting on empty queue | NULL |
| 6 | root | localhost | NULL | Query | 0 | starting | SHOW PROCESSLIST |
+----+-----------------+-----------+------+---------+------+--------------------------------------------------------+------------------+
3 rows in set (0.00 sec)
mysql57 6> shutdown;
Query OK, 0 rows affected (0.01 sec)
$ tail -f /usr/mysql/5.7.30/data/error.log
2020-06-08T23:12:29.610938+09:00 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 66970ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)
2020-06-08T23:13:43.908373+09:00 0 [Note] Giving 2 client threads a chance to die gracefully
2020-06-08T23:13:43.908412+09:00 0 [Note] Shutting down slave threads
2020-06-08T23:13:43.908451+09:00 2 [Note] Error reading relay log event for channel '': slave SQL thread was killed
2020-06-08T23:13:43.908463+09:00 2 [Note] Slave SQL thread for channel '' exiting, replication stopped in log 'FIRST' at position 0
2020-06-08T23:13:45.909973+09:00 0 [Note] Forcefully disconnecting 1 remaining clients
2020-06-08T23:13:45.910017+09:00 0 [Note] Event Scheduler: Killing the scheduler thread, thread id 3
2020-06-08T23:13:45.910025+09:00 0 [Note] Event Scheduler: Waiting for the scheduler thread to reply
2020-06-08T23:13:45.910122+09:00 0 [Note] Event Scheduler: Stopped
2020-06-08T23:13:45.910135+09:00 0 [Note] Event Scheduler: Purging the queue. 0 events
$ pt-pmp -p 20825
Mon Jun 8 23:15:45 JST 2020
10 __io_getevents_0_4(libaio.so.1),LinuxAIOHandler::collect(os0file.cc:2519),LinuxAIOHandler::poll(os0file.cc:2679),os_aio_linux_handler(os0file.cc:2735),os_aio_handler(os0file.cc:2735),fil_aio_wait(fil0fil.cc:5862),io_handler_thread(srv0start.cc:319),start_thread,clone
3 pthread_cond_wait,wait(os0event.cc:179),wait_low(os0event.cc:179),os_event_wait_low(os0event.cc:179),srv_worker_thread(srv0srv.cc:2527),start_thread,clone
1 pthread_join,mysqld_main(mysqld.cc:5178),__libc_start_main,_start
1 pthread_cond_wait,wait(os0event.cc:179),wait_low(os0event.cc:179),os_event_wait_low(os0event.cc:179),srv_purge_coordinator_suspend(srv0srv.cc:2683),srv_purge_coordinator_thread(srv0srv.cc:2683),start_thread,clone
1 pthread_cond_wait,wait(os0event.cc:179),wait_low(os0event.cc:179),os_event_wait_low(os0event.cc:179),buf_resize_thread(buf0buf.cc:3027),start_thread,clone
1 pthread_cond_wait,wait(os0event.cc:179),wait_low(os0event.cc:179),os_event_wait_low(os0event.cc:179),buf_dump_thread(buf0dump.cc:792),start_thread,clone
1 pthread_cond_wait,native_cond_wait(thr_cond.h:147),my_cond_wait(thr_cond.h:147),inline_mysql_cond_wait(thr_cond.h:147),Connection_handler_manager::wait_till_no_connection(thr_cond.h:147),close_connections(mysqld.cc:1102),signal_hand(mysqld.cc:1102),pfs_spawn_thread(pfs.cc:2197),start_thread,clone
1 pthread_cond_timedwait,os_event::timed_wait(os0event.cc:316),os_event::wait_time_low(os0event.cc:488),os_event_wait_time_low(os0event.cc:594),srv_monitor_thread(srv0srv.cc:1592),start_thread,clone
1 pthread_cond_timedwait,os_event::timed_wait(os0event.cc:316),os_event::wait_time_low(os0event.cc:488),os_event_wait_time_low(os0event.cc:594),srv_error_monitor_thread(srv0srv.cc:1758),start_thread,clone
1 pthread_cond_timedwait,os_event::timed_wait(os0event.cc:316),os_event::wait_time_low(os0event.cc:488),os_event_wait_time_low(os0event.cc:594),pc_sleep_if_needed(buf0flu.cc:2700),buf_flush_page_cleaner_coordinator(buf0flu.cc:2700),start_thread,clone
1 pthread_cond_timedwait,os_event::timed_wait(os0event.cc:316),os_event::wait_time_low(os0event.cc:488),os_event_wait_time_low(os0event.cc:594),lock_wait_timeout_thread(lock0wait.cc:497),start_thread,clone
1 pthread_cond_timedwait,os_event::timed_wait(os0event.cc:316),os_event::wait_time_low(os0event.cc:488),os_event_wait_time_low(os0event.cc:594),ib_wqueue_timedwait(ut0wqueue.cc:168),fts_optimize_thread(fts0opt.cc:2910),start_thread,clone
1 pthread_cond_timedwait,os_event::timed_wait(os0event.cc:316),os_event::wait_time_low(os0event.cc:488),os_event_wait_time_low(os0event.cc:594),dict_stats_thread(dict0stats_bg.cc:435),start_thread,clone
1 nanosleep,os_thread_sleep(os0thread.cc:287),srv_master_sleep(srv0srv.cc:2337),srv_master_thread(srv0srv.cc:2337),start_thread,clone
1 do_sigwaitinfo,__GI___sigwaitinfo,timer_notify_thread_func(posix_timers.c:89),pfs_spawn_thread(pfs.cc:2197),start_thread,clone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment