too many close calls for non-opened fds

Logu logsnaath at gmx.net
Tue Aug 22 16:17:18 EST 2006


>> I thought this issue occurs from openssh-3.9 because of introduction of
>> re-exec feature.
>> I tried by disabling the re-exec feature and still I see a large number 
>> of
>> close() calls during connection.
>
> If you run sshd with "-r", how many close() calls do you see per 
> connection?
>
> If it's 60 or so then session.c does this:
>
>        /*
>         * Close any extra open file descriptors so that we don't have them
>         * hanging around in clients.  Note that we want to do this after
>         * initgroups, because at least on Solaris 2.3 it leaves file
>         * descriptors open.
>         */
>        for (i = 3; i < 64; i++)
>                close(i);
>
> but I can't see that having a significant performance impact.
>

Hi Daren,

Actually that was a mistake on my part. When -r option is used the close 
call occurs only during startup and not for every connection. During startup 
with -r option we get around 60K close calls.
We are about to do a fix for this issue on HP-UX (without -r option). The 
approach is to find out the open fds and close the unwanted ones. Will this 
be a valid approach.

Thanks
-logu 




More information about the openssh-unix-dev mailing list