Greetings from a new subscriber,
I’m having a problem on Macintosh OSX 10.4 &
10.5 involving user information lookup where the
‘getpwuid(getuid())’ call sequence starts unexpectedly returning
NULL after an initial period of successful operation. On some systems the
lookup failures start within than a day; on others, no failures have yet been
observed.
I have a parent daemon process running as 'root' which
spawns child processes running as some non-privileged, local user (with UID
502, for example) that invoke the call sequence 'getpwuid(getuid())’ to
obtain user information. After the parent has been in operation for a day or
so, the child 'getpwuid(getuid())' invocations start returning NULL (I've
verified that 'getuid()' is still returning 502 as expected). This condition
seems to persist until the parent process is killed and restarted, at which
point lookups in child processes start working again and the cycle repeats. The
machine itself is not rebooted.
The question is: Why would restarting the parent daemon
cause user info lookups in child processes to start working again? There's
virtually nothing being inherited by the child from the parent other than a
single socket connected to the child's STDIO file descriptors. The forked child
processes 'exec' a completely different program from that of the parent. (Also
the 'lsof' listings of child processes whose user info lookups fail are the
same as those whose lookups succeed.)
I've seen a few posts in various mailing lists reporting
similar problems (Apple's and others - e.g. http://lists.apple.com/archives/macos-x-server/2008/Aug/msg00153.html
thread) but have yet to see a technical explanation for why this might be
happening or a definitive procedure for avoiding it. Some responses to these
posts suggest that the issue has been resolved in OSX 10.5 but the problem is
still being observed with OSX 10.5.4 & 10.5.5, both on our in-house systems
as well as at customer sites.
Any insights on how to address this problem would be
greatly appreciated.
// sean
P.S. In my desperation, I've cross-posted to the
following Apple mailing lists: Darwin-dev, Darwin-userlevel, Macos-x-server and
Unix-porting. Apologies for any inconvenience.