[syslog-ng] Fixed number fd-limit doesn't scale

Balazs Scheidler bazsi at balabit.hu
Fri Jan 16 20:53:11 CET 2009


Hi,

On Wed, 2009-01-14 at 13:12 +0100, Corinna Vinschen wrote:
> Hi,
> 
> in 3.0.1, in src/gprocess.c, line 112, the fd_limit_min is set to the 
> fixed value 4096.  This doesn't work well on systems which have a hard
> limit smaller than 4K.  While there's a command line option --fd-limit
> (but unfortunately no equivalent config file option), the default on
> those systems is to get an error message at startup:
> 
>   syslog-ng: Error setting file number limit; limit='4096';
>   error='Too many open files'
> 
> Wouldn't it be better to choose a system specifc default like OPEN_MAX
> instead or better, to call sysconf(_SC_OPEN_MAX) to fetch the system
> default and only use 4096 as fallback if none of the two is available
> or the values are larger than 4K?

Thanks for the suggestion. I'm not sure that sysconf() returns the
proper values, on my Linux box it returns 1024, even though it is
certainly possible to use higher ulimits. And people do hit this limit.

Is there a preprocessor define I could use to detect cygwin? Even though
I hate conditional compilation something like the below fragment could
work.

#if __cygwin__
 .fd_limit_min = 1024,
#else
 .fd_limit_min = 4096
#endif

-- 
Bazsi




More information about the syslog-ng mailing list