Thank you for quick reply.
You mean if Apache picks up the closed conn and tries to do some I/O operations like writing, Apache will failover the conn(with closing the conn and creating/reusing new conn). So CLOSE_WAIT may be normal in this case, right?
IMHO, as soon as connections are closed from backend, if Apache can detect closed connections of backend and close them explicitly, CLOSE_WAITs can disappear as soon as possible before Apache tries to reuse them.
Honestly, I didn't know the CLOSE_WAIT conn would be able to be reused because new connections always established in my test(I shut down the old backend and rebooted the new backend, then both ESTABLISHED and CLOSE_WAIT existed).
And I read the default max number which will be allowed to backend is ThreadsPerChild directive and users can set the max or ThreadsPerChild to be a big number. Then, I think many CLOSE_WAITs can be piled up. It's a waste of FDs.
Actually, I was afraid of the following situation.
1. Apache has many backend connections(i.g 8080 backend port)
2. Backend server should be replaced for maintenace
3. So Apache connects new backend server(i.g 9090 backend port) dynamically without reboot and old backend server will be shut down
4. Then all old backend connections(i.g 8080 backend port) will become to be CLOSE_WAIT state for long time.
At this case, I would like to know Apache can also clean up 8080 ports of CLOSE_WAIT state.
Thanks in advance!
[Video 4 Linux]