We have a mail server, which have courier running. Inside the same box, I setup the Roundcube webmail, which connect the courier by IMAP.
Below is the listing of lsof output.
apache2 4528 www-data 15u IPv6 7132064 0t0 TCP localhost:55153->localhost:imap2 (CLOSE_WAIT)
apache2 6441 www-data 15u IPv6 7123710 0t0 TCP localhost:40516->localhost:imap2 (CLOSE_WAIT)
apache2 6711 www-data 15u IPv6 7125315 0t0 TCP localhost:54507->localhost:imap2 (CLOSE_WAIT)
apache2 8003 www-data 15u IPv6 7118138 0t0 TCP localhost:38712->localhost:imap2 (CLOSE_WAIT)
apache2 18613 www-data 15u IPv6 5109270 0t0 TCP localhost:51262->localhost:imap2 (CLOSE_WAIT)
Sometime the apache2 -> courier connection has CLOSE_WAIT, it will slow down the CPU and wait forever, we have to kill them each time. I have search the internet and Server Fault here, some say it is due to the client problem has bug, it has not send the close signal back to the server. Anway, I have notice it is openning in IPv6. Is it the reason of the problem? if yes, how can I force the apache2 -> courier imap connection in IPv4?