[OT] select and sysread problem on solaris

Paul Johnson paul at pjcj.net
Thu Sep 11 10:20:05 BST 2008


On Thu, Sep 11, 2008 at 02:36:55AM +0100, Andy Armstrong wrote:
> On 11 Sep 2008, at 02:12, Paul Johnson wrote:
>> Is my assumption correct that if select tells you there is something to
>> be read then there should be something there to be read?  Can anyone
>> think of any other possibilities?
>
>
> 210 + ~30 = ~240 - which is getting close to 255. Since select uses a fixed 
> bit field to represent filenos there's an upper limit on the filenos you 
> can select on. What does this print?
>
> #include <sys/select.h>
> #include <stdio.h>
>
> int main( void ) {
>     printf( "%d\n", FD_SETSIZE );
>     return 0;
> }

Hi Andy,

Thanks for thinking about this.

The output is 1024, but I'm not convinced the problem lies in this area.

The numbers I gave are a little inaccurate (I was trying to remember off
the top of my head early in the morning).  There were previously 343
named pipes being monitored, and there will now be about 60 more.  These
are split between three processes, so each one will be selecting over
about 135 pipes.

As you see, this should be covered and, in addition, I am using
PERLIO=perlio so that Perl's own IO implementation is being used,
allowing 1024 files to be opened per process, rather than the 256 which
would be allowed with Solaris' stdio implementation.

We have just moved from under 128 files per select to just over, but I
don't think this is the problem.  Additionally, the system will seem to
work fine for many Gb of data before this problem is (seemingly
randonly) triggered.

Thanks again for your hint.  Do you (or anyone else) have any more?  (I
know you'd all rather talk about macs and mobiles.)

-- 
Paul Johnson - paul at pjcj.net
http://www.pjcj.net


More information about the london.pm mailing list