On Mon, 2002-09-09 at 15:42, Rocco Caputo wrote: > Here's a way to close files above $^F. It's not pretty, not tested, > and may not be very portable. The code would go into Wheel::Run, just > before the function is called in the child process. > > # Assuming 255 open handles max. > use POSIX qw(close); > for my $fd ($^F+1..255) { > POSIX::close($fd); > } > > It should probably be made optional but on by default, probably > controlled by a CloseOnExec option.
I tried this, and it works, no more file descriptor leaks. :-) However, it did not solve the problem of hanging TCP connections as I hoped. I even turned on TRACE_DEFAULT. POE::Kernel is deleting the file descriptor in _internal_select: !!! deleting fileno (5) ... Yet the socket still did not shutdown. I am scratching my head wondering whether this is caused by some interaction with other modules. The fail-safe approach seems to be "shutdown($socket,2)" in my code, which means I am stuck w/ locally patching PoCo::TCP::Server to keep $socket on $heap, *sigh*. Pete