Bug #104688 purge binlog,show variables,binlog rotate will cause deadlock
Submitted: 23 Aug 2021 7:43 Modified: 23 Aug 2021 11:46
Reporter: lockli lockli Email Updates:
Status: Duplicate Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.7.22-5.5.24 OS:Any
Assigned to: CPU Architecture:Any

[23 Aug 2021 7:43] lockli lockli
We use MySQL 5.7.24, we have notice MySQL will hang.Can not write record to DB.when this three operations  happen:
1,show binlog or binlog rotate
2,show variabels
3,purge binlog

Cause this problem:
1,Not write any record to DB.
2,New connection can not attact to DB.finaly ,Instance will report error "to many connection" .I quess,the connections have up to max connection =3500 ,
3,The long live connection  can execute select,So we HA can not change master to semi slave.

How to repeat:
1,In test DB.Execute "flush logs",Create many binlog file.
2,Ready two script,one is execute "purge binlog" ,another execute "show variables".

We  analyse like this :
1. binlog rotate 
	hold lock_log waiting lock_index
2. purge binlog 
	hold lock_index waiting lock_thd_lock
3. show variabless
    hold lock_thd_lock waiting lock_log

How to repeat:
when we execute the two scripts. It will repeat .

purge binlog,show variables,binlog rotate will cause deadlock
[23 Aug 2021 11:46] MySQL Verification Team
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments to the original bug instead.


Thank you for your interest in MySQL.