FAQ
Hi there,

I'm using the FCGI module (version 0.67) and a lighttpd
to create an imageserver.

But currently I have the problem that if I
shutdown the lighttpd server, the perl processes are still there with an
open file descriptor to the socket.

There are not a child process
anymore and are only killable.

Here some code:

#!/usr/bin/perl

use
strict;
use warnings;

use FCGI;

my $handling_request = 0;
my
$exit_requested = 0;

my $request = FCGI::Request();

sub sig_handler {

$exit_requested = 1;
if ( !$handling_request ) {
$request->Flush();

$request->Finish();
exit( 0 );
}
}

$SIG{USR1} =
&sig_handler;
$SIG{TERM} = &sig_handler;
$SIG{PIPE} = 'IGNORE';

# Main
function
sub do_request {
$request->Flush();

$request->Finish();
}

while ( $handling_request = ( $request->Accept()
= 0 ) ) {
&do_request;

$handling_request = 0;
last if
$exit_requested;
}

$request->Flush();
$request->Finish();

exit( 0
);

Here is the lighttpd config (only fastcgi section):


fastcgi.server = ( "" =>
((
"max-procs" => 1,
"socket" =>
"/tmp/img.promobil.de.fcgi.socket",
"bin-path" =>
"/home/friedrich/public_html/promobil/trunk/imageserver/imageserver.pl",

"check-local" => "disable",
"allow-x-send-file" => "enable",
))
)

I
don't know why the perl processes hung there and do not exit...

Here
also some output of lsof (from such a process):

imageserv 21482
www-data cwd DIR 3,5 4096 17076805
/home/friedrich/public_html/promobil/trunk/imageserver
imageserv 21482
www-data rtd DIR 3,1 4096 2 /
imageserv 21482 www-data txt REG 3,1
1061700 4637988 /usr/bin/perl
imageserv 21482 www-data mem REG 0,0 0
[heap] (stat: No such file or directory)
imageserv 21482 www-data mem
REG 3,1 51936 4670723 /usr/lib/perl5/auto/FCGI/FCGI.so
imageserv 21482
www-data mem REG 3,1 111304 4655487
/usr/lib/perl/5.8.8/auto/POSIX/POSIX.so
imageserv 21482 www-data mem REG
3,1 123180 4838084 /usr/share/locale/de/LC_MESSAGES/libc.mo
imageserv
21482 www-data mem REG 3,1 16672 3424409
/usr/lib/libXdmcp.so.6.0.0
imageserv 21482 www-data mem REG 3,1 7220
3424404 /usr/lib/libXau.so.6.0.0
imageserv 21482 www-data mem REG 3,1
320344 3424432 /usr/lib/libXt.so.6.0.0
imageserv 21482 www-data mem REG
3,1 288776 3424669 /usr/lib/libjasper-1.701.so.1.0.0
imageserv 21482
www-data mem REG 3,1 78500 3425061 /usr/lib/libz.so.1.2.3
imageserv
21482 www-data mem REG 3,1 1148124 3425051
/usr/lib/libxml2.so.2.6.27
imageserv 21482 www-data mem REG 3,1 66200
4345035 /lib/libbz2.so.1.0.3
imageserv 21482 www-data mem REG 3,1 965952
3424401 /usr/lib/libX11.so.6.2.0
imageserv 21482 www-data mem REG 3,1
85060 3424349 /usr/lib/libICE.so.6.3.0
imageserv 21482 www-data mem REG
3,1 32144 3424396 /usr/lib/libSM.so.6.0.0
imageserv 21482 www-data mem
REG 3,1 52848 3424411 /usr/lib/libXext.so.6.4.0
imageserv 21482 www-data
mem REG 3,1 137760 3424926 /usr/lib/libpng12.so.0.15.0
imageserv 21482
www-data mem REG 3,1 127488 3424674 /usr/lib/libjpeg.so.62.0.0
imageserv
21482 www-data mem REG 3,1 434840 3424584
/usr/lib/libfreetype.so.6.3.10
imageserv 21482 www-data mem REG 3,1
343712 3425020 /usr/lib/libtiff.so.4.2.1
imageserv 21482 www-data mem
REG 3,1 197880 3424800 /usr/lib/liblcms.so.1.0.15
imageserv 21482
www-data mem REG 3,1 3637020 3424364
/usr/lib/libMagick.so.9.0.0
imageserv 21482 www-data mem REG 3,1 18824
4655442 /usr/lib/perl/5.8.8/auto/Time/HiRes/HiRes.so
imageserv 21482
www-data mem REG 3,1 11075 4703010
/usr/local/lib/perl/5.8.8/auto/String/CRC32/CRC32.so
imageserv 21482
www-data mem REG 3,1 270772 4670737
/usr/lib/perl5/auto/Image/Magick/Magick.so
imageserv 21482 www-data mem
REG 3,1 11784 4655489 /usr/lib/perl/5.8.8/auto/Fcntl/Fcntl.so
imageserv
21482 www-data mem REG 3,1 20592 6422549
/usr/local/lib/perl/5.8.8/auto/IO/IO.so
imageserv 21482 www-data mem REG
3,1 14133 5341196 /usr/local/lib/perl/5.8.8/auto/Cwd/Cwd.so
imageserv
21482 www-data mem REG 3,1 30392 4655249
/usr/lib/perl/5.8.8/auto/Data/Dumper/Dumper.so
imageserv 21482 www-data
mem REG 3,1 21568 4653125 /usr/lib/gconv/gconv-modules.cache
imageserv
21482 www-data mem REG 3,1 126854 4702923
/usr/local/lib/perl/5.8.8/auto/List/MoreUtils/MoreUtils.so
imageserv
21482 www-data mem REG 3,1 9553 5832710
/usr/local/lib/perl/5.8.8/auto/Devel/GlobalDestruction/GlobalDestruction.so
imageserv
21482 www-data mem REG 3,1 11162 4703017
/usr/local/lib/perl/5.8.8/auto/Sub/Name/Name.so
imageserv 21482 www-data
mem REG 3,1 23758 4702897
/usr/local/lib/perl/5.8.8/auto/Class/C3/XS/XS.so
imageserv 21482
www-data mem REG 3,1 1902160 3145750
/usr/lib/locale/locale-archive
imageserv 21482 www-data mem REG 3,1
21868 4358808 /lib/tls/i686/cmov/libcrypt-2.3.6.so
imageserv 21482
www-data mem REG 3,1 1253680 4358806
/lib/tls/i686/cmov/libc-2.3.6.so
imageserv 21482 www-data mem REG 3,1
89370 4358823 /lib/tls/i686/cmov/libpthread-2.3.6.so
imageserv 21482
www-data mem REG 3,1 145136 4358805
/lib/tls/i686/cmov/libm-2.3.6.so
imageserv 21482 www-data mem REG 3,1
9592 4358801 /lib/tls/i686/cmov/libdl-2.3.6.so
imageserv 21482 www-data
mem REG 3,1 19099 4866090
/usr/local/lib/perl/5.8.8/auto/Class/MOP/MOP.so
imageserv 21482 www-data
mem REG 3,1 42356 4702926
/usr/local/lib/perl/5.8.8/auto/List/Util/Util.so
imageserv 21482
www-data mem REG 3,1 88164 4349843 /lib/ld-2.3.6.so
imageserv 21482
www-data 0u unix 0xffff8801cdb0d740 69730688
/tmp/img.promobil.de.fcgi.socket-0
imageserv 21482 www-data 1w CHR 1,3
791 /dev/null
imageserv 21482 www-data 2u CHR 136,58 60
/dev/pts/58

Does somebody see an error I've made?

Greets

Christoph

Search Discussions

  • C.DeRykus at Jan 24, 2011 at 5:48 pm

    On Jan 21, 9:03 am, perl-l...@christophfriedrich.de wrote:
    Hi there,

    I'm using the FCGI module (version 0.67) and a lighttpd
    to create an imageserver.

    But currently I have the problem that if I
    shutdown the lighttpd server, the perl processes are still there with an
    open file descriptor to the socket.

    There are not a child process
    anymore and are only killable.

    Here some code:

    #!/usr/bin/perl

    use
    strict;
    use warnings;

    use FCGI;

    my $handling_request = 0;
    my
    $exit_requested = 0;

    my $request = FCGI::Request();

    sub sig_handler {

    $exit_requested = 1;
    if ( !$handling_request ) {
    $request->Flush();

    $request->Finish();
    exit( 0 );
    }

    }

    $SIG{USR1} =
    &sig_handler;
    $SIG{TERM} = &sig_handler;
    $SIG{PIPE} = 'IGNORE';

    # Main
    function
    sub do_request {
    $request->Flush();

    $request->Finish();

    }

    while ( $handling_request = ( $request->Accept()>= 0 ) ) {

    &do_request;

    $handling_request = 0;
    last if
    $exit_requested;

    }

    $request->Flush();
    $request->Finish();

    exit( 0
    );

    Here is the lighttpd config (only fastcgi section):

    fastcgi.server = ( "" =>
    ((
    "max-procs" => 1,
    "socket" =>
    "/tmp/img.promobil.de.fcgi.socket",
    "bin-path" =>
    "/home/friedrich/public_html/promobil/trunk/imageserver/imageserver.pl",

    "check-local" => "disable",
    "allow-x-send-file" => "enable",
    ))
    )

    I
    don't know why the perl processes hung there and do not exit...

    Here
    also some output of lsof (from such a process):
    [ snip ]

    Just a shot in the dark but what is the reason for ignoring
    SIGPIPE...?

    --
    Charles DeRykus

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupbeginners @
categoriesperl
postedJan 21, '11 at 5:03p
activeJan 24, '11 at 5:48p
posts2
users2
websiteperl.org

2 users in discussion

C.DeRykus: 1 post Perl-list: 1 post

People

Translate

site design / logo © 2021 Grokbase