Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Daemon-Control CPAN distribution.

Report information
The Basics
Id: 77423
Status: resolved
Priority: 0/
Queue: Daemon-Control

People
Owner: Nobody in particular
Requestors: chansen [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Should close inherited descriptors
D::C should close inherited descriptors, POSIX::sysconf(POSIX::_SC_OPEN_MAX) can be used to obtain the maximum number of descriptors. -- chansen
On Fri May 25 06:55:59 2012, CHANSEN wrote: Show quoted text
> D::C should close inherited descriptors, > POSIX::sysconf(POSIX::_SC_OPEN_MAX) can be used to > obtain the maximum number of descriptors.
No it shouldn't; this is an absolute disaster of a "feature". When D::C is used with a collaborating perl application, filehandles opened beforehand may still be in use, and forcibly closing the C-level file descriptors will leave the PerlIO ones still active. I've previously seen a Catalyst application end up logging to its pid file as a result of this since a C-level file descriptor was forcibly closed and then the pid file open re-used the fdno - the perl level descriptor of course had no idea its underlying file had changed. When D::C is used with an external binary, close-on-exec should already handle that, and open() will default any file descriptor higher than $^F (which defaults to 2) to be set close-on-exec so mistakes should be relatively unlikely. If you want to write and ship a small module that does the forcible closing of these descriptors, I'd be quite happy to see a doc patch linking to it for people who have a reason to want this "feature", but I believe that adding it to Daemon::Control is going to result in more shot-off feet than anything else. If you'd like to discuss this further, please join #perl-daemon-control on irc.freenode.net and talk to kaitlyn (SYMKAT) and I rather than re-opening this ticket.