Re: Possible Bug: high CPU usage for stats collector in 8.2 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Possible Bug: high CPU usage for stats collector in 8.2
Date
Msg-id 16546.1172781749@sss.pgh.pa.us
Whole thread Raw
In response to Re: Possible Bug: high CPU usage for stats collector in 8.2  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: Possible Bug: high CPU usage for stats collector in 8.2
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> Good catch. I am also a bit dubious about this code:

>         input_fd.fd = pgStatSock;
>         input_fd.events = POLLIN | POLLERR;
>         input_fd.revents = 0;

Hm.  The Single Unix Spec saith that POLLERR is ignored in the events
field, but it is not clear to me that older systems might not treat it
as a condition bit.  For instance on HPUX the poll man page says only
    The condition flags POLLERR, POLLHUP, and POLLNVAL are always set in    revents if the conditions they indicate are
truefor the specified    file descriptor, whether or not these flags are set in events.
 

> AIUI you are not supposed to put POLLERR in the events field. We should 
> probably be setting POLLIN | POLLPRI,  and we should also probably check 
> exactly what event was returned in revents.

We don't need to check what was returned because the action is the same
either way: do a recv().  I'm not seeing the point of setting POLLPRI.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Possible Bug: high CPU usage for stats collector in 8.2
Next
From: Andrew Dunstan
Date:
Subject: Re: Possible Bug: high CPU usage for stats collector in 8.2