RE: http24threading t/protocol/eliza.t does not exit

Mark Hedges <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <55EEF0B3C5BF2744B2248754D717EE4C463121@USASHEXMB02.LYV.LiveNation.com>
BTW it timed out after Test 6 and then I hit ctl-C.

-----Original Message-----
From: Mark Hedges 
Sent: Friday, June 06, 2014 5:50 PM
To: [email protected]
Cc: Mark Hedges
Subject: http24threading t/protocol/eliza.t does not exit

1. Problem Description:

This is Apache 2.4.9 using the bundled apr/apr-util.  Trying to build http24threading branch.

t/protocol/eliza.t never exits after the last statement.

I am confused by t/protocol/TestProtocol/eliza.pm.  It seems like it expects a readline interface.  But I added some debugging to TestProtocol::Eliza.  It seems to finish the handler subroutine, so I don't get what's going on.

It doesn't matter if I set blocking or non-blocking, or what.  The connection does not get aborted properly even though the handler subroutine completes.

# please insert nothing before this line: -*- mode: cperl; cperl-indent-level: 4; cperl-continued-statement-offset: 4; indent-tabs-mode: nil -*-
package TestProtocol::eliza;

use strict;
use warnings FATAL => 'all';

use Apache2::Connection ();
use APR::Socket ();

require Chatbot::Eliza;

use Apache2::Const -compile => 'OK';
use APR::Const     -compile => 'SO_NONBLOCK';

use Apache2::Log;

use constant BUFF_LEN => 1024;

my $mybot = new Chatbot::Eliza;

sub handler {
    my Apache2::Connection $c = shift;
    my APR::Socket $socket = $c->client_socket;

    my $s = $c->base_server;
    $s->log_error(__PACKAGE__);

    # starting from Apache 2.0.49 several platforms require you to set
    # the socket to a blocking IO mode
    my $nonblocking = $socket->opt_get(APR::Const::SO_NONBLOCK);
    if ($nonblocking) {
        $socket->opt_set(APR::Const::SO_NONBLOCK, 0);

        # test that we really *are* in the blocking mode
        !$socket->opt_get(APR::Const::SO_NONBLOCK)
            or die "failed to set blocking mode";
    }
        $socket->opt_set(APR::Const::SO_NONBLOCK, 0);

    my $last = 0;

    while ($socket->recv(my $buff, BUFF_LEN)) {
        $s->log_error("received buff: $buff");
        # \r is sent instead of \n if the client is talking over telnet
        $buff =~ s/[\r\n]*$//;
        $last++, $s->log_error("buff is ending line") if $buff eq "Good bye, Eliza";
        $buff = $mybot->transform( $buff ) . "\n";
        $s->log_error("transformed buff: $buff");
        $socket->send($buff);
        $s->log_error("exiting loop"), last if $last;
    }

    $s->log_error("outside of recv loop, returning OK");

    return Apache2::Const::OK;
}

1;

[email protected] /ntfhome/local/src/mod_perl2_svn/mod_perl
2014-06-06 17:39:29 Fri  $ t/TEST -verbose t/protocol/eliza.t 
/ntfhome/local/bin/httpd  -d /ntfhome/local/src/mod_perl2_svn/mod_perl/t -f /ntfhome/local/src/mod_perl2_svn/mod_perl/t/conf/httpd.conf -D APACHE2 -D PERL_USEITHREADS
using Apache/2.4.9 (event MPM)

waiting 300 seconds for server to start: .[Fri Jun 06 17:39:37.749566 2014] [perl:info] [pid 14289:tid 47949163987568] 6 Apache2:: modules loaded
[Fri Jun 06 17:39:37.750017 2014] [perl:info] [pid 14289:tid 47949163987568] 0 APR:: modules loaded
[Fri Jun 06 17:39:37.750257 2014] [perl:info] [pid 14289:tid 47949163987568] base server + 32 vhosts ready to run tests
........
waiting 300 seconds for server to start: ok (waited 7 secs)
server localhost:8529 started
server localhost:8530 listening (filter_out_apache)
server localhost:8531 listening (perlsections)
server localhost:8532 listening (inherit)
server localhost:8533 listening (TestModperl::perl_options)
server localhost:8534 listening (TestModperl::perl_options2)
server localhost:8535 listening (TestModperl::merge)
server localhost:8536 listening (TestModperl::setupenv)
server localhost:8537 listening (TestVhost::log)
server localhost:8538 listening (TestVhost::config)
server localhost:8539 listening (TestModules::proxy)
server localhost:8540 listening (TestDirective::perlcleanuphandler)
server localhost:8541 listening (TestUser::rewrite)
server localhost:8542 listening (TestProtocol::pseudo_http)
server localhost:8543 listening (TestProtocol::echo_filter)
server localhost:8544 listening (TestProtocol::echo_nonblock)
server localhost:8545 listening (TestProtocol::echo_bbs)
server localhost:8546 listening (TestProtocol::echo_timeout)
server localhost:8547 listening (TestProtocol::eliza)
server localhost:8548 listening (TestProtocol::echo_bbs2)
server localhost:8549 listening (TestProtocol::echo_block)
server localhost:8550 listening (TestPreConnection::note)
server localhost:8551 listening (TestHooks::hookrun)
server localhost:8552 listening (TestHooks::trans)
server localhost:8553 listening (TestHooks::startup)
server localhost:8554 listening (TestHooks::init)
server localhost:8555 listening (TestHooks::stacked_handlers2)
server localhost:8556 listening (TestFilter::both_str_con_add)
server localhost:8557 listening (TestFilter::in_str_msg)
server localhost:8558 listening (TestFilter::in_bbs_inject_header)
server localhost:8559 listening (TestFilter::in_bbs_msg)
server localhost:8560 listening (TestDirective::perlrequire)
server localhost:8561 listening (TestDirective::perlmodule)
server localhost:8562 listening (TestPerl::ithreads)
server localhost:8563 listening (TestPerl::ithreads3)
server localhost:8564 listening (TestAPI::add_config)
server localhost:8565 listening (TestDirective::perlloadmodule3)
server localhost:8566 listening (TestDirective::perlloadmodule4)
server localhost:8567 listening (TestDirective::perlloadmodule5)
server localhost:8568 listening (TestDirective::perlloadmodule6)
server localhost:8569 listening (TestHooks::push_handlers_anon)
t/protocol/eliza.t .. 
1..7
# Running under perl version 5.020000 for linux
# Current time local: Fri Jun  6 17:39:46 2014
# Current time GMT:   Sat Jun  7 00:39:46 2014
# Using Test.pm version 1.26
# Using Apache/Test.pm version 1.38
ok 1
# send: Hello Eliza
# recv: How do you do. Please state your problem.
ok 2
# send: How are you?
# recv: Does that question interest you?
ok 3
# send: Why do I have core dumped?
# recv: Have you asked such questions before?
ok 4
# send: I feel like writing some tests today, what about you?
# recv: That is interesting. Please continue.
ok 5
# send: Good bye, Eliza
# recv: Does talking about this bother you?
ok 6
[warning] 
halting tests
[warning] server localhost:8529 shutdown
[warning] port 8529 still in use...
............done
                                               
[email protected] /ntfhome/local/src/mod_perl2_svn/mod_perl
2014-06-06 17:40:16 Fri  $ cat t/logs/error_log 
********************************************************************************
*** This is a test for Apache2::ServerUtil::server_shutdown_cleanup_register ***
*** Following a line consisting only of * characters there should be a line  ***
*** containing                                                               ***
***     "cleanup died: testing server_shutdown_cleanup_register".            ***
*** The next line should then read                                           ***
***     "done with server_shutdown_cleanup_register"                         ***
********************************************************************************
Apache2::ServerUtil: cleanup died: testing server_shutdown_cleanup_register
*** done with server_shutdown_cleanup_register                               ***
********************************************************************************
END in modperl_extra.pl, pid=14289
END in modperl_extra.pl, pid=14289
[Fri Jun 06 17:39:45.799240 2014] [mpm_event:notice] [pid 14293:tid 47949163987568] AH00489: Apache/2.4.9 (Unix) world domination series/2.0 mod_perl/2.0.9dev Perl/v5.20.0 configured -- resuming normal operations
[Fri Jun 06 17:39:45.799299 2014] [mpm_event:info] [pid 14293:tid 47949163987568] AH00490: Server built: Jun  4 2014 17:22:40
[Fri Jun 06 17:39:45.799348 2014] [core:notice] [pid 14293:tid 47949163987568] AH00094: Command line: '/ntfhome/local/bin/httpd -d /ntfhome/local/src/mod_perl2_svn/mod_perl/t -f /ntfhome/local/src/mod_perl2_svn/mod_perl/t/conf/httpd.conf -D APACHE2 -D PERL_USEITHREADS'
[Fri Jun 06 17:39:46.344956 2014] [authz_core:debug] [pid 14299:tid 1098656064] mod_authz_core.c(828): [client 127.0.0.1:34000] AH01628: authorization result: granted (no directives)
[Fri Jun 06 17:39:47.737706 2014] [:error] [pid 14299:tid 1109145920] TestProtocol::eliza
[Fri Jun 06 17:39:47.737988 2014] [:error] [pid 14299:tid 1109145920] received buff: Hello Eliza\n
[Fri Jun 06 17:39:47.739809 2014] [:error] [pid 14299:tid 1109145920] transformed buff: How do you do. Please state your problem.\n
[Fri Jun 06 17:39:47.741191 2014] [:error] [pid 14299:tid 1109145920] received buff: How are you?\n
[Fri Jun 06 17:39:47.743146 2014] [:error] [pid 14299:tid 1109145920] transformed buff: Does that question interest you?\n
[Fri Jun 06 17:39:47.744186 2014] [:error] [pid 14299:tid 1109145920] received buff: Why do I have core dumped?\n
[Fri Jun 06 17:39:47.746973 2014] [:error] [pid 14299:tid 1109145920] transformed buff: Have you asked such questions before?\n
[Fri Jun 06 17:39:47.747994 2014] [:error] [pid 14299:tid 1109145920] received buff: I feel like writing some tests today, what about you?\n
[Fri Jun 06 17:39:47.752041 2014] [:error] [pid 14299:tid 1109145920] transformed buff: That is interesting. Please continue.\n
[Fri Jun 06 17:39:47.753124 2014] [:error] [pid 14299:tid 1109145920] received buff: Good bye, Eliza\n
[Fri Jun 06 17:39:47.753165 2014] [:error] [pid 14299:tid 1109145920] buff is ending line
[Fri Jun 06 17:39:47.755806 2014] [:error] [pid 14299:tid 1109145920] transformed buff: Does talking about this bother you?\n
[Fri Jun 06 17:39:47.755853 2014] [:error] [pid 14299:tid 1109145920] exiting loop
[Fri Jun 06 17:39:47.755867 2014] [:error] [pid 14299:tid 1109145920] outside of recv loop, returning OK
[Fri Jun 06 17:39:58.004026 2014] [perl:info] [pid 14299:tid 47949163987568] Child process pid=14299 is exiting
[Fri Jun 06 17:39:58.004344 2014] [perl:info] [pid 14324:tid 47949163987568] Child process pid=14324 is exiting
[Fri Jun 06 17:39:58.004633 2014] [perl:info] [pid 14299:tid 47949163987568] Child process pid=14299 is exiting - server push
[Fri Jun 06 17:39:58.004781 2014] [perl:info] [pid 14297:tid 47949163987568] Child process pid=14297 is exiting
[Fri Jun 06 17:39:58.005298 2014] [perl:info] [pid 14324:tid 47949163987568] Child process pid=14324 is exiting - server push
END in modperl_extra.pl, pid=14299
[Fri Jun 06 17:39:58.006433 2014] [perl:info] [pid 14297:tid 47949163987568] Child process pid=14297 is exiting - server push
END in modperl_extra.pl, pid=14324
END in modperl_extra.pl, pid=14297
END in modperl_extra.pl, pid=14297
END in modperl_extra.pl, pid=14324
END in modperl_extra.pl, pid=14299
[Fri Jun 06 17:40:01.352428 2014] [core:warn] [pid 14293:tid 47949163987568] AH00045: child process 14297 still did not exit, sending a SIGTERM
[Fri Jun 06 17:40:01.357250 2014] [core:warn] [pid 14293:tid 47949163987568] AH00045: child process 14299 still did not exit, sending a SIGTERM
[Fri Jun 06 17:40:01.357299 2014] [core:warn] [pid 14293:tid 47949163987568] AH00045: child process 14324 still did not exit, sending a SIGTERM
[Fri Jun 06 17:40:03.356566 2014] [core:warn] [pid 14293:tid 47949163987568] AH00045: child process 14297 still did not exit, sending a SIGTERM
[Fri Jun 06 17:40:03.356660 2014] [core:warn] [pid 14293:tid 47949163987568] AH00045: child process 14299 still did not exit, sending a SIGTERM
[Fri Jun 06 17:40:03.356733 2014] [core:warn] [pid 14293:tid 47949163987568] AH00045: child process 14324 still did not exit, sending a SIGTERM
[Fri Jun 06 17:40:05.358091 2014] [core:info] [pid 14293:tid 47949163987568] AH00096: removed PID file /ntfhome/local/src/mod_perl2_svn/mod_perl/t/logs/httpd.pid (pid=14293)
[Fri Jun 06 17:40:05.358158 2014] [mpm_event:notice] [pid 14293:tid 47949163987568] AH00491: caught SIGTERM, shutting down
********************************************************************************
*** This is a test for Apache2::ServerUtil::server_shutdown_cleanup_register ***
*** Following a line consisting only of * characters there should be a line  ***
*** containing                                                               ***
***     "cleanup died: testing server_shutdown_cleanup_register".            ***
*** The next line should then read                                           ***
***     "done with server_shutdown_cleanup_register"                         ***
********************************************************************************
Apache2::ServerUtil: cleanup died: testing server_shutdown_cleanup_register
*** done with server_shutdown_cleanup_register                               ***
********************************************************************************
END in modperl_extra.pl, pid=14293
END in modperl_extra.pl, pid=14293




2. Used Components and their Configuration:

*** mod_perl version 2.000009

*** using /ntfhome/local/src/mod_perl2_svn/mod_perl/lib/Apache2/BuildConfig.pm

*** Makefile.PL options:
  MP_APR_CONFIG  => /ntfhome/local/bin/apr-1-config
  MP_APR_LIB     => aprext
  MP_APXS        => /ntfhome/local/bin/apxs
  MP_COMPAT_1X   => 0
  MP_GENERATE_XS => 1
  MP_LIBNAME     => mod_perl
  MP_USE_DSO     => 1
  MP_USE_GTOP    => 1


*** The httpd binary was not found


*** (apr|apu)-config linking info

 -L/ntfhome/local/lib -laprutil-1     -lexpat 
 -L/ntfhome/local/lib -lapr-1 -luuid -lrt -lcrypt  -lpthread -ldl 

(Using apr/apr-util bundled with Apache 2.4.9.)

*** /ntfhome/software/perl/5.20.0/bin/perl -V
Summary of my perl5 (revision 5 version 20 subversion 0) configuration:
   
  Platform:
    osname=linux, osvers=2.6.18-308.0.0.0.1.el5xen, archname=x86_64-linux-thread-multi-ld
    uname='linux nta1.ntf.cftdev1.coresys.tmcs 2.6.18-308.0.0.0.1.el5xen #1 smp sat feb 25 16:26:29 est 2012 x86_64 x86_64 x86_64 gnulinux '
    config_args='-de -Dprefix=/ntfhome/software/perl/5.20.0 -Duse64bitall -Dusethreads -Dinc_version_list=none -Duselongdouble -Dusemorebits -Dotherlibdirs=/ntf/shared/ntf/lib/perl5:/ntf/shared/tmns/lib/perl:/ntf/shared/csweb/lib/perl -A ccflags=-fPIC'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    use64bitint=define, use64bitall=define, uselongdouble=define
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fPIC -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fPIC -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.1.2 20080704 (Red Hat 4.1.2-52)', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='long double', nvsize=16, Off_t='off_t', lseeksize=8
    alignbytes=16, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib /lib /lib64 /usr/lib64 /usr/local/lib64
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=libc-2.5.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.5'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'


Characteristics of this binary (from libperl): 
  Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
                        PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
                        PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
                        PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV
                        USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS
                        USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE
                        USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LONG_DOUBLE
                        USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API
  Built under linux
  Compiled at Jun  6 2014 12:31:05
  %ENV:
    PERL5LIB="/nta/shared/conf/perl:/nta/shared/lib/perl:/nta/ntf/lib/site_perl"
    PERL_BASEDIR="/software/perl/5.8.4"
    PERL_BINDIR="/software/perl/5.8.4/bin"
    PERL_LWP_USE_HTTP_10="1"
    PERL_SITE_BINDIR="/software/perl/5.8.4/lib/perl5/bin"
    PERL_VERSION="5.8.4"
  @INC:
    /nta/shared/conf/perl
    /nta/shared/lib/perl
    /nta/ntf/lib/site_perl
    /ntfhome/software/perl/5.20.0/lib/site_perl/5.20.0/x86_64-linux-thread-multi-ld
    /ntfhome/software/perl/5.20.0/lib/site_perl/5.20.0
    /ntfhome/software/perl/5.20.0/lib/5.20.0/x86_64-linux-thread-multi-ld
    /ntfhome/software/perl/5.20.0/lib/5.20.0
    /ntf/shared/ntf/lib/perl5/x86_64-linux-thread-multi-ld
    /ntf/shared/ntf/lib/perl5
    /ntf/shared/tmns/lib/perl
    /ntf/shared/csweb/lib/perl
    .

*** Packages of interest status:

Apache2            : -
Apache2::Request   : -
CGI                : 3.65, 4.01
ExtUtils::MakeMaker: 6.98
LWP                : 6.06
mod_perl           : -
mod_perl2          : -


3. This is the core dump trace: (if you get a core dump):

  [CORE TRACE COMES HERE]

This report was generated by t/REPORT on Sat Jun  7 00:00:11 2014 GMT.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.