[opensuse-programming] getpwnam() -> too many open files ??
I've got a new daemon that needs to run on openSUSE 12.2 and 11.0. There is no problem on the former, but on 11.0 I run into $SUBJ every now and then. Not frequently, but it's a problem. Pseudo-code: fork() the child closes stdin, prepares to stdout write to a pipe getpwnam() so I can setuid() execv(). Why would the getpwnam() call result in too many open files?? -- Per Jessen, Zürich (0.1°C) http://www.dns24.ch/ - free DNS hosting, made in Switzerland. -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-programming+owner@opensuse.org
On Thursday 07 February 2013 10:52:52 Per Jessen wrote:
I've got a new daemon that needs to run on openSUSE 12.2 and 11.0. There is no problem on the former, but on 11.0 I run into $SUBJ every now and then. Not frequently, but it's a problem.
Pseudo-code:
fork() the child closes stdin, prepares to stdout write to a pipe getpwnam() so I can setuid()
execv().
Why would the getpwnam() call result in too many open files??
Well, getpwnam() does open files, if nothing else a socket to nscd, if that is running, /etc/passwd or a connection to whatever name service is in use if it isn't if the system wide limit is reached it will result in an error Anders -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-programming+owner@opensuse.org
Anders Johansson wrote:
On Thursday 07 February 2013 10:52:52 Per Jessen wrote:
I've got a new daemon that needs to run on openSUSE 12.2 and 11.0. There is no problem on the former, but on 11.0 I run into $SUBJ every now and then. Not frequently, but it's a problem.
Pseudo-code:
fork() the child closes stdin, prepares to stdout write to a pipe getpwnam() so I can setuid()
execv().
Why would the getpwnam() call result in too many open files??
Well, getpwnam() does open files, if nothing else a socket to nscd, if that is running, /etc/passwd or a connection to whatever name service is in use if it isn't
if the system wide limit is reached it will result in an error
Yes, I did check that, but although the system wide limit for the 11.0 system is only 40000 (75000 on the 12.2), it doesn't seem reasonable that it would be reached? It's a very old box (Pentium II at 400MHz with 384Mb RAM), but it's been running for years and years without no such problems, so I was beginning to wonder if I'd done something wrong with the getpwname() call. ncsd runs on both systems, although it isn't stable on the older system. -- Per Jessen, Zürich (0.4°C) http://www.dns24.ch/ - free DNS hosting, made in Switzerland. -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-programming+owner@opensuse.org
Per Jessen wrote:
Anders Johansson wrote:
On Thursday 07 February 2013 10:52:52 Per Jessen wrote:
I've got a new daemon that needs to run on openSUSE 12.2 and 11.0. There is no problem on the former, but on 11.0 I run into $SUBJ every now and then. Not frequently, but it's a problem.
Pseudo-code:
fork() the child closes stdin, prepares to stdout write to a pipe getpwnam() so I can setuid()
execv().
Why would the getpwnam() call result in too many open files??
Well, getpwnam() does open files, if nothing else a socket to nscd, if that is running, /etc/passwd or a connection to whatever name service is in use if it isn't
if the system wide limit is reached it will result in an error
Yes, I did check that, but although the system wide limit for the 11.0 system is only 40000 (75000 on the 12.2), it doesn't seem reasonable that it would be reached? It's a very old box (Pentium II at 400MHz with 384Mb RAM), but it's been running for years and years without no such problems, so I was beginning to wonder if I'd done something wrong with the getpwname() call. ncsd runs on both systems, although it isn't stable on the older system.
Just wondering out loud - what would people normally do for error-handling for getpwnam() - sleep(1) and try again ? -- Per Jessen, Zürich (0.2°C) http://www.dns24.ch/ - free DNS hosting, made in Switzerland. -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-programming+owner@opensuse.org
participants (2)
-
Anders Johansson
-
Per Jessen