Bug #90566 adjust system before, mysql stop failure
Submitted: 23 Apr 2018 7:46 Modified: 4 Jun 2018 12:17
Reporter: King.Lee King.Lee Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.7.21 OS:SUSE
Assigned to: CPU Architecture:Any
Tags: stop failure

[23 Apr 2018 7:46] King.Lee King.Lee
Description:
adjust system before, mysql stop failure

eltevar_234:~ # service eappmysql stop
Shutting down MySQL....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................                                  

gstack info, blocking at os_event::timed_wait
    Thread 3 (Thread 0x7feb6ce2c700 (LWP 121887)):
    #0  0x00007feba364b989 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
    #1  0x000000000107263e in os_event::timed_wait (this=<optimized out>, abstime=0x7feb6ce2b980) at /export/home/pb2/build/sb_0-26514852-1514433850.9/mysql-5.7.21/storage/innobase/os/os0event.cc:285
    #2  0x000000000107295e in os_event::wait_time_low (this=0x26f25d8, time_in_usec=<optimized out>, reset_sig_count=2) at /export/home/pb2/build/sb_0-26514852-1514433850.9/mysql-5.7.21/storage/innobase/os/os0event.cc:412
    #3  0x00000000011b0fa3 in pc_sleep_if_needed (sig_count=2, next_loop_time=1524369153308) at /export/home/pb2/build/sb_0-26514852-1514433850.9/mysql-5.7.21/storage/innobase/buf/buf0flu.cc:2690
    #4  buf_flush_page_cleaner_coordinator (arg=<optimized out>) at /export/home/pb2/build/sb_0-26514852-1514433850.9/mysql-5.7.21/storage/innobase/buf/buf0flu.cc:3191
    #5  0x00007feba36477b6 in start_thread () from /lib64/libpthread.so.0
    #6  0x00007feba21b1d6d in clone () from /lib64/libc.so.6
    #7  0x0000000000000000 in ?? ()

abstime in function os_event::timed_wait is the time before adjust, so pthread_cond_timedwait can't timeout
        timed_out = timed_wait(&abstime);

buf_flush_page_cleaner_coordinator , This function will determine whether or not to sleep. 
                ret_sleep = pc_sleep_if_needed(
                next_loop_time, sig_count);
This variable cannot be set.
                page_cleaner->is_running = false;
                
This function cannot exit when shutdown occurs.
                while (buf_page_cleaner_is_active) {
                    ++count;
                    os_thread_sleep(100000);
                    if (srv_print_verbose_log && count > 600) {
                        ib::info() << "Waiting for page_cleaner to"
                            " finish flushing of buffer pool";
                        count = 0;
                    }
                }

2018-04-22T04:54:19.908800Z 0 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
2018-04-22T04:55:20.078766Z 0 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
2018-04-22T04:56:20.253722Z 0 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
2018-04-22T04:57:20.426747Z 0 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
2018-04-22T04:58:20.597515Z 0 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
2018-04-22T04:59:20.765219Z 0 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
2018-04-22T05:00:20.935148Z 0 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
2018-04-22T05:01:21.109336Z 0 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
2018-04-22T05:02:21.278436Z 0 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
2018-04-22T05:03:21.448038Z 0 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool    

How to repeat:
eltevar_234:~ # date
2018年 04月 22日 星期日 15:33:04 CST

eltevar_234:~ # date -s "20180422 11:28:00"
2018年 04月 22日 星期日 11:28:00 CST

eltevar_234:~ # service eappmysql stop
Shutting down MySQL....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................                                  

Suggested fix:
        
os0event.cc

timed_out = timed_wait(&abstime);

abstime need using system time after adjust
[4 May 2018 12:17] MySQL Verification Team
Hi,

Thank you for your bug report. However, it does not seem to us that it is a bug.

You have to give time to page cleaner to finish its job, which is expected behaviour.

Hence, this is either a case of a very large buffer pool(s) or a misconfiguration of the InnoDB SE.
[5 Jun 2018 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".