Stas writes:
> How about
>
> close STDOUT;
> close STDIN;
> close STDERR;
>
> in your child code?
>
> check this out:
>
> http://perl.apache.org/guide/performance.html#Forking_and_Executing_Subprocess
>
> it's explained there.
I have tried closing STDOUT, STDIN and STDERR, but that
doesn't make any difference.
What I do at the moment is:
1. Start the long running process (runs indefinitly for the
purpose of this test), which closes STDOUT, STDIN and
STDERR and then calls setsid().
2. Stop the apache server.
3. Start the apache server (this fails).
4. netstat -na reveals that the port it tries to use is still
in LISTEN state.
5. Kill the long running process.
6. Start the apache server (this now works).
I think the following might be the solution, we have done
that in a (not internet related) C program here to solve
almost the same problem.
Vivek writes:
> KV72> Has anyone got an idea how to get around this? Can I get to
> KV72> the inherited socket connection and close it when I have
> KV72> detached from the calling process?
>
> After you fork, why not close all open file descriptors you are not
> using?
I have had a look throught the camel book. How do I close a
file descriptor (or find out if it is open), the perl close
function only accepts file handles.
Kees