Re: 100% CPU usage
Pasi Kärkkäinen <[email protected]>
| Newsgroups | gmane.linux.keepalived.devel |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Jun 06, 2013 at 09:11:15PM +0100, John Sullivan wrote: > On Thursday, June 6, 2013, 2:55:25 PM, Graeme Fowler wrote: > > It seems that your mail server is the culprit. I don't fully understand why - a couple of messages get out, then a bunch of connectons get stuck: > > Not convinced the keepalived smtp engine is right here. > > > On 6 Jun 2013, at 12:12, Rimbalza Rimbalza <[email protected]> wrote: > >> The log file contains these 3 repeating lines forever. > >> 1530 13:08:46.986966 read(14, "", 512) = 0 > >> 1530 13:08:46.986993 read(13, "", 512) = 0 > >> 1530 13:08:46.987021 select(1024, [4 6 11 13 14], [], [], {0, 62960}) = 2 (in [13 14], left {0, 62958}) > >> 1530 13:08:46.987090 read(14, "", 512) = 0 > >> 1530 13:08:46.987117 read(13, "", 512) = 0 > >> 1530 13:08:46.987145 select(1024, [4 6 11 13 14], [], [], {0, 62836}) = 2 (in [13 14], left {0, 62834}) > > Check out keepalived/core/smtp.c, smtp_read_thread(). > > It does the read, checks for -1 - mostly error conditions except > for EAGAIN which, on a non-blocking socket, simply means no data > is available *yet* but the socket is still good. > > Otherwise it assumes it got some data, appends it to the buffer, > parses for the status code etc., requeues the select for read. > > At no point does it check for a zero return from read(), which > means the socket has been closed by the other end (or otherwise > failed). On a closed socket (where all input has already been > drained), read() will *always* return immediately with 0, and > select() will always indicate readability, hence the spin. > Wanna send a patch? :) -- Pasi ------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. A cloud service to automate IT design, transition and operations 2. Dashboards that offer high-level views of enterprise services 3. A single system of record for all IT processes http://p.sf.net/sfu/servicenow-d2d-j