# Hundreds of courier-imapd processes with D status

## acarstoiu

This is yet another surprise I've been having lately.

I used to find in /var/log/messages tons of lines like

```
imapd-ssl: Connection, ip=[::ffff:<ipv4 address>]

imapd-ssl: LOGIN, user=<user>, ip=[::ffff:<ipv4 address>], port=[63086], protocol=IMAP

imapd-ssl: Unexpected SSL connection shutdown.

imapd-ssl: DISCONNECTED, user=<user>, ip=[::ffff:<ipv4 address>], headers=0, body=0, rcvd=67, sent=137, time=0, starttls=1
```

After puting in /etc/courier-imap/imapd-ssl 

```
TLS_STARTTLS_PROTOCOL=SSL23
```

 I find in /var/log/messages tons of lines like

```
imapd-ssl: Connection, ip=[::ffff:<ipv4 address>]
```

by themselves and in top output hundreds of processes

```
/usr/sbin/courier-imapd .maildir
```

 run by the same <user>, all in the uninterruptible sleep status (D). CPU usage percentage is under 10%.

The <user> connects to his e-mail account via secure IMAP from a Windows 7 machine (with Live Mail). I cannot test with Thunderbird for the moment. What's going on?

----------

## Ant P.

Sounds like another one of the things in Windows 7 that's really *really* broken, and that it's DoS'ing your server with connections. Look into using iptables hashlimit to throttle connections on the IMAP port per IP, if the server itself doesn't have an option for it.

----------

## acarstoiu

Well, the server has always had a limit:

```
MAXPERIP=4
```

It turns out that Thunderbird is doing the same thing, namely opening connections which "hang" - I cannot get a working connection right now to my e-mail server. I have no other option than experiment with the Courier IMAP configuration files (imapd, imapd-ssl) until it works, somehow...

By the way, is it necessary for courier-imapd service to be started for courier-imapd-ssl to work? I believe not, otherwise they would have been declared dependent.

----------

## acarstoiu

I have restarted the server machine after explicitly switching the security protocol to SSL v3, changed the Windows e-mail client to Thunderbird and it's been working fine for 2 days now. I believe Windows (XP, 7, most likely Vista, too) as an operating system has a problem with both SSL v2 and TLS connections.

I also got rid of those 

```
Unexpected SSL connection shutdown.
```

 lines in /var/log/messages. Nice   :Wink: 

----------

## Ant P.

It should probably be using SSLv3 there, not v2... 2 is really outdated.

----------

## acarstoiu

As for the myriad of D state courier-imapd processes, it is a kernel-related issue, see here.

----------

