Bug #116607 Unnecessary epoll_wait when a socket is closed
Submitted: 10 Nov 2024 7:30 Modified: 12 Nov 2024 15:27
Reporter: Congyu Liu (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S5 (Performance)
Version:8.4.2 OS:Linux
Assigned to: CPU Architecture:Any

[10 Nov 2024 7:30] Congyu Liu
Description:
When a socket is closed by the peer, 1TransporterRegistry::start_disconnecting` is invoked, which seems only setting the state to `DISCONNECTING` and leaves it to be handled by the TransporterRegistry::start_clients_thread thread. However, this thread wakes up every 100ms. Before this threads close the socket, the socket is not removed from epoll fd and keeps producing EPOLLIN events and wake up the TCP handling threads, until the start_clients_thread wake up and removes it.

How to repeat:
Start cluster, then terminate one node.

Suggested fix:
A straightforward fix is to remove the socket from the epoll fd once we notice it is closed by peer.
[12 Nov 2024 15:27] MySQL Verification Team
Thanks for the report