When using MySQL5.7 for semi-synchronous replication, it is found that a simple write operation of the main library executes 1s, which is caused by the show profile analysis that is semi-synchronous.
Check the master-slave log, found the following error:
Main Library error:
2018-05-21t05:34:06.955592z 0 [ERROR]/usr/local/mysql-5.7.21-linux-glibc2.12-x86_64/bin/mysqld:got an error reading Communication packets
2018-05-21t05:34:06.967776z [Note] while initializing dump thread for slave with UUID <26b1280d-2125-11e8-b5a8-0050 56ac3676> found a zombie dump thread with the same UUID. Master is killing the zombie dump thread (20).
2018-05-21t05:34:06.967864z [Note] Stop semi-sync binlog_dump to Slave (server_id:12233306)
2018-05-21t05:34:06.967954z [Note] Start binlog_dump to master_thread_id (+) Slave_server (12233306), POS ( mysql-bin.000004, 484)
2018-05-21t05:34:07.957450z [Note] Start semi-sync binlog_dump to Slave (server_id:12233306), POS (mysql-bin.000004, 4 84)
Error from Library
2018-05-21t05:54:29.787788z 4 [ERROR] Error reading packet from server for channel ": Lost connection to MySQL server dur ing query (server_errno=2013)
2018-05-21T05:54:29.787880Z 4 [Note] Slave I/O thread:failed reading log event, reconnecting to retry, log ' mysql-bin.000 004 ' at position 484 for channel '
2018-05-21t05:54:29.787908z 4 [Warning] storing MySQL user name or password information in the master info repository is n OT secure and is therefore not recommended. Consider using the USER and PASSWORD connection options for START SLAVE; See the ' START SLAVE Syntax ' on the MySQL Manual for more information.
After a preliminary analysis, only the semi-synchronous will trigger the problem, then it should be returned from the Library ACK packet bug, the main library can not be resolved, the final adjustment parameters, confirm the semi-synchronization, only from the library to open the parameter Slave_compressed_protocol will appear this problem, The official default parameter is off.
That is the condition of the problem, a.5.7 B. From the library slave_compressed_protocol=1 c. master-Slave semi-synchronous
The problem was confirmed as 5.7bug, and has been mentioned, but there are few cases on the Internet.
https://bugs.mysql.com/bug.php?id=85382
On the experimental diagram:
Normal
Trigger a bug
Workaround: Set slave_compressed_protocol=0 from library
(5.7 is not very mature .....) )
MySQL 5.7slave_compressed_protocol parameter causes replication bug