Hi All,
I have a problem that I cannot resolve. Some script, called as CGI, prints "Out of memory!" to the stderr. However, the same script does not display that error if run from the command line.
I could not isolate the problem to a simple test case; the problem does not occur for a simpler script.
The script calls another script ("worker") via open(). The other script forks and executes some "daemon" script. The problem does not occur without calling that daemon:
The limits on the host are the following:my $pid = fork; unless (defined($pid)) { return -1; } if ($pid != 0) { # parent return 1; } POSIX::setsid(); close(STDIN);close(STDOUT);close(STDERR); fork() && exit 0; exec("$command") or return 0;
prstat and top displays up to 33M of memory occupied by the scripts.
When I added some trace messages, the "Out of memory!" message was written after the last command of the "worker" script.
I also tried running truss to trace the worker process. It didn't help too much:
worker: ending main
write(2, " w o r k e r : e n d i".., 19) = 19
worker ending
write(2, " w o r k e r e n d i n".., 13) = 13
setcontext(0xFFBFEAE0)
Out of memory!
write(2, " O u t o f m e m o r".., 15) = 15
Printing the text "worker ending" is the last instruction of the script:
print STDERR "worker ending"; exit 0;
Do you have any ideas, what next should I do? What could be the root of the problem? What tools could be helpful to trace it?
Thanks in advance,
pkal
In reply to Out of memory! in CGI by pkal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |