New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
__DATA__ conflicts with Proc::Daemon. A "half closed" filehandle. #10130
Comments
From kissg@ssg.ki.iif.huThis is a bug report for perl from kissg@ssg.ki.iif.hu, Please run this shell script that calls the PERL program below: --------------8<---------------8<---------------- echo "No fork" echo File perlbug: use Proc::Daemon; system("(echo before open pid=$$: ; ls -l /proc/$$/fd) > /tmp/perlbug.out"); { # comment out this line: The result is this: Daemonize process before opening files Note that /etc/passwd (filehandle 3) remained open at the second run However if you comment out the __DATA__ line everything works well. The problem is not limited to ordinary files. A server process that daemonize itself with Proc::Daemon::Init() (Yes, I could find a workaround to handle this situation.) My Linux system is a Debian lenny with kernel 2.6.26-2-686. Gabor Flags: Site configuration information for perl 5.10.0: Configured by Debian Project at Fri Aug 28 22:30:10 UTC 2009. Summary of my perl5 (revision 5 version 10 subversion 0) configuration: Locally applied patches: @INC for perl 5.10.0: Environment for perl 5.10.0: |
From @iabynOn Thu, Feb 04, 2010 at 01:29:18AM -0800, kissg@ssg.ki.iif.hu wrote:
This isn't a problem with perl. Proc::Daemon is "secretly" closing file You can see a similar effect withe these two programs that don't require use POSIX (); and use POSIX (); -- |
The RT System itself - Status changed from 'new' to 'open' |
From kissg@ssg.ki.iif.huI think if you are right, there is no way to daemonize a process An application any time can use a third party module with a Did I miss something? Gabor |
From deti@cpan.orgOn Fr. 05. Feb. 2010, 15:52:56, davem wrote:
1) Not a perl problem? Isn't POSIX a part of perl nowadays? Thanks and regards Detlef Pilzecker |
From @iabynOn Sat, May 21, 2011 at 11:32:29AM -0700, Detlef Pilzecker via RT wrote:
It's documented to do what it does: close the OS-level file descriptor;
It's useful if you just want to close a UNIX file descriptor.
There isn't an easy way. Bear in mind that several different Perl-level Some approaches to making this available at the perl level would be: 1) at the bottom: add an extra level of indirection between the PerlIO 2) At the middle: call the close method on every file stack in PL_perlio; 3) At the top: scan the SV arenas for PVIOs, and close each one. This has Note that the standard C library suffers from exactly the same problem: main (int argc, char **argv, char **env) In short, there isn't a practical way to do what you want (close all files -- |
@iabyn - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#72526 (status was 'rejected')
Searchable as RT72526$
The text was updated successfully, but these errors were encountered: