Bug #104982 long wait for log_wait_for_flush
Submitted: 18 Sep 8:02 Modified: 18 Sep 8:04
Reporter: yongliang lee Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:8.0.19 OS:Any
Assigned to: CPU Architecture:Any

[18 Sep 8:02] yongliang lee
Description:
Hi:
  we encounter a problem, some time,innodb is hang then crash(900s long semaphore)

----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 254
--Thread 140138344982272 has waited at srv0tmp.h line 182 for 274 seconds the semaphore:
Mutex at 0x7f75c88c7198, Mutex TEMP_POOL_MANAGER created srv0tmp.cc:181, lock var 1

--Thread 140138346751744 has waited at srv0tmp.h line 182 for 874 seconds the semaphore:
Mutex at 0x7f75c88c7198, Mutex TEMP_POOL_MANAGER created srv0tmp.cc:181, lock var 1

we use pstack tool to catch stack report.find some user thread wait at log_wait_for_flush, example:

Thread 5 (Thread 0x7f7480652700 (LWP 14973)):
#0  0x00007f75e55a1d42 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00000000020ace25 in os_event::timed_wait(timespec const*) () at ../../../mysql-8.0.19/storage/innobase/include/sync0types.h:540
#2  0x00000000020ad9e1 in os_event::wait_time_low (this=0x7f75c83a5c98, time_in_usec=<optimized out>, reset_sig_count=1) at ../../../mysql-8.0.19/storage/innobase/os/os0event.cc:495
#3  0x0000000002091331 in os_event_wait_for<log_wait_for_flush(const log_t&, lsn_t)::<lambda(bool)> > (condition=..., timeout=100000, spins_limit=<optimized out>, event=@0x7f75c8392790: 0x7f75c83a5c98) at /opt/rh/devtoolset-8/root/usr/include/c++/8/ext/new_allocator.h:86
#4  log_wait_for_flush (lsn=3436585392735, log=...) at ../../../mysql-8.0.19/storage/innobase/log/log0write.cc:896

here wait to flush lsn is 3436585392735 , but in err.log "Log buffer completed up to"(log.recent_written.tail) has always been 3436585392273 until 900s long semaphore crash,

---
LOG
---
Log sequence number          3436585392795
Log buffer assigned up to    3436585392795
Log buffer completed up to   3436585392273
Log written up to            3436585392273
Log flushed up to            3436585392273
Added dirty pages up to      3436585392795
Pages flushed up to          3436585391907
Last checkpoint at           3436585391907

so user thread wait log_wait_for_flush , but log_writer have no thing to do.
errlog and pstack see the attachment。
have any bug here? thanks!!

How to repeat:
i dont kown.

Suggested fix:
i dont kown.
[18 Sep 8:04] yongliang lee
another describe