Hello All, I'm using OpenSSH 4.3p2 in HP-UX 11.23. On running tusc (a tool to trace system calls and signals) on sshd, I found lot of close calls upto 2047. Those close calls try to close a non-opened file descriptor and results in an error. This behaviour is seen only from OpenSSH 3.9 where closefrom() call is introduced to close the file descriptors before re-exec. The fix is to check the resource limits before calling close(), but the comment in source code (bsd-closefrom.c) says that it is not recommended to check the resource limits. Is there anyway to fix this too many close() calls which results in performance degradation? Relavant part of tusc output for sshd is given below, ............... .............. set_userthreadid(1) ...................................... = 1 stat("/etc/pam_debug", 0x7ffff5b0) ....................... ERR#2 ENOENT stat("/tcb/files/auth/system/default", 0x7fffec70) ....... ERR#2 ENOENT getuid() ................................................. = 0 (0) getuid() ................................................. = 0 (0) getuid() ................................................. = 0 (0) setgroups(0, NULL) ....................................... = 0 open("/dev/null", O_RDWR|0x800, 0123) .................... = 3 close(3) ................................................. = 0 sysconf(_SC_OPEN_MAX) .................................... = 2048 close(3) ................................................. ERR#9 EBADF close(4) ................................................. ERR#9 EBADF close(5) ................................................. ERR#9 EBADF close(6) ................................................. ERR#9 EBADF close(7) ................................................. ERR#9 EBADF close(8) ................................................. ERR#9 EBADF close(9) ................................................. ERR#9 EBADF ................ ...............
On Mon, Aug 14, 2006 at 10:35:26AM +0530, Logu wrote:> Is there anyway to fix this too many close() calls which > results in performance degradation?is it really a performance degradation?
> On Mon, Aug 14, 2006 at 10:35:26AM +0530, Logu wrote: >> Is there anyway to fix this too many close() calls which >> results in performance degradation? > > is it really a performance degradation? >Yes, we see a performance degradation. We see approximately 30-40 new connections per second in our machine. In another machine we see the number of close calls go upto 60K. I would like to know the impact of checking the resource limits before calling close(). thanks -logu
On Wed, Aug 16, 2006 at 11:51:37PM +0530, Logu wrote:> >On Mon, Aug 14, 2006 at 10:35:26AM +0530, Logu wrote: > >>Is there anyway to fix this too many close() calls which > >>results in performance degradation? > > > >is it really a performance degradation? > > > > Yes, we see a performance degradation. We see approximately 30-40 new > connections per second in our machine. In another machine we see the number > of close calls go upto 60K. > > I would like to know the impact of checking the resource limits before > calling close().if a file is opened and the resource limit is decreased, then looping to the resource limit will miss some open files.
--On Wednesday, August 16, 2006 10:56 PM +0200 Markus Friedl <markus.r.friedl at arcor.de> wrote:> if a file is opened and the resource limit is decreased, > then looping to the resource limit will miss some open files.Does any UNIX variant have a "close all my open fds except for these" syscall? Or an easy way to get back a list of in-use fds? I really wish such a beast would be added, as calling close() on all possible fd numbers is _such_ a hack... -- Carson
Maybe Matching Threads
- OpenSSH is not asking for passwords.
- how to make this qq plot in lattice and/or ggplot2
- Are there any current, in play plans, to multi-thread rsync?
- [PATCH nbdkit] server: Try hard to maintain invariant that fds 0, 1 and 2 are always open.
- Simple Umacs example help..