FDSET problem on linux?

From: Jonathan Larmour <JLarmour@dont-contact.us>
Date: Thu, 21 Nov 1996 01:12:06 GMT

I've been thinking about a curio when starting Squid 1.1.beta20 on linux 2.0.25.
When it starts up, and in cachemgr, it says that the max number of
descriptors is 1024. However configure correctly reports that we can only
open 256.

In squid.h there is the following:
#if SQUID_FD_SETSIZE > 256
#define FD_SETSIZE SQUID_FD_SETSIZE
#endif

Where SQUID_FD_SETSIZE==256 and on linux FD_SETSIZE==1024

This means when modules use FD_SETSIZE to work out how many files the
process can open, it wrongly uses 1024. In the case when SQUID_FD_SETSIZE >
256, then another standard header file (<linux/time.h> by convoluted means)
is included later which stomps over this (admittedly dubious) FD_SETSIZE and
sets it back to 1024.

The (portable) solution? AFAICT the best thing to do is replace all
occurences of FD_SETSIZE in the squid code with SQUID_FD_SETSIZE, and
probably just remove the bit above in squid.h.

However it seems to be deliberately there for a reason. Does anyone know
why? This better get sorted before the 1.1 release otherwise linux boxes
(+others?) will try to allocate too many fd's AND as it is, squid reserves
100 of the 256 fd's already instead of 64.

Jonathan L.
Origin IT Services Ltd., 323 Cambridge Science Park, Cambridge, England.
Tel: +44 (1223) 423355 Fax: +44 (1223) 420724 E-mail: guess...
-------[ Do not think that every sad-eyed woman has loved and lost... ]------
-----------------------[ she may have got him. -Anon ]-----------------------
These opinions are all my own fault.
Received on Wed Nov 20 1996 - 17:12:26 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:33:35 MST