You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by bo...@technogeeks.com on 2005/02/03 04:15:08 UTC

[mp2] threaded applications inside of mod_perl

-------------8<---------- Start Bug Report ------------8<----------
1. Problem Description:

This program when run under :

=====================
#!/usr/bin/perl
use strict;
use threads;

my $thread = threads->create(sub { print "I am a thread"; },undef);

=====================

Causes a segfault

[Wed Feb 02 16:55:57 2005] [notice] child pid 15039 exit signal 
Segmentation
fault (11)

The "interoperation of threads.pm and threaded apps embedding perl" March 
1, 2003 email to the devel list by Stas Bekman was the closest I have been 
able to find directly regarding this issue.  I am wondering is this a 
known bug or is this something others can do and I should look at my 
configuration in greater detail.


2. Used Components and their Configuration:

*** mod_perl version 1.999021

*** using 
/usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi/Apache/BuildC
onfig.pm

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


*** The httpd binary was not found
Server version: Apache/2.0.51
Server built:   Nov 12 2004 10:10:20
Server's Module Magic Number: 20020903:9
Architecture:   32-bit
Server compiled with....
   -D APACHE_MPM_DIR="server/mpm/prefork"
   -D APR_HAS_SENDFILE
   -D APR_HAS_MMAP
   -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
   -D APR_USE_SYSVSEM_SERIALIZE
   -D APR_USE_PTHREAD_SERIALIZE
   -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
   -D APR_HAS_OTHER_CHILD
   -D AP_HAVE_RELIABLE_PIPED_LOGS
   -D HTTPD_ROOT="/etc/httpd"
   -D SUEXEC_BIN="/usr/sbin/suexec"
   -D DEFAULT_PIDLOG="logs/httpd.pid"
   -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
   -D DEFAULT_LOCKFILE="logs/accept.lock"
   -D DEFAULT_ERRORLOG="logs/error_log"
   -D AP_TYPES_CONFIG_FILE="conf/mime.types"
   -D SERVER_CONFIG_FILE="conf/httpd.conf"


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

   -lapr-0 -lrt -lm -lcrypt  -lpthread -ldl
   -laprutil-0 -lldap -llber -ldb-4.2 -lexpat



*** /usr/bin/perl -V
Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
    Platform:
      osname=linux, osvers=2.4.22, archname=i386-linux-thread-multi
      uname='linux why.ak.technogeeks.com 2.4.22 #7 thu aug 26 02:44:38 pdt 
2004 i
686 athlon i386 gnulinux '
      config_args='-des -Doptimize=-O2 -g -march=i386 -mcpu=i686 
-Dversion=5.8.6 -
Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, 
Inc.
-Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux 
-Dvendorprefix=/usr -Ds
iteprefix=/usr -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles 
-Dd_dosui
d -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog 
-Dman3ext=3pm
-Duseperlio -Dinstallusrbinperl -Ubincompat5005 -Uversiononly 
-Dpager=/usr/bin/l
ess -isr -Dinc_version_list=5.8.5 5.8.4 5.8.3 5.8.2 5.8.1 5.8.0'
      hint=recommended, useposix=true, d_sigaction=define
      usethreads=define use5005threads=undef useithreads=define 
usemultiplicity=de
fine
      useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
      use64bitint=undef use64bitall=undef uselongdouble=undef
      usemymalloc=n, bincompat5005=undef
    Compiler:
      cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING 
-fno-strict-alias
ing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 
-I/usr
/include/gdbm',
      optimize='-O2 -g -march=i386 -mcpu=i686',
      cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing 
-pipe
-I/usr/local/include -I/usr/include/gdbm'
      ccversion='', gccversion='3.3.3 20040412 (Red Hat Linux 3.3.3-7)', 
gccosandv
ers=''
      intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
      d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
      ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', 
lseeksize
=8
      alignbytes=4, prototype=define
    Linker and Libraries:
      ld='gcc', ldflags =' -L/usr/local/lib'
      libpth=/usr/local/lib /lib /usr/lib
      libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
      perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
      libc=/lib/libc-2.3.3.so, so=so, useshrplib=true, libperl=libperl.so
      gnulibc_version='2.3.3'
    Dynamic Linking:
      dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E 
-Wl,-rpath,
/usr/lib/perl5/5.8.6/i386-linux-thread-multi/CORE'
      cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
    Compile-time options: DEBUGGING MULTIPLICITY USE_ITHREADS 
USE_LARGE_FILES PERL
_IMPLICIT_CONTEXT
    Built under linux
    Compiled at Feb  2 2005 15:56:04
    %ENV:
      PERL_LWP_USE_HTTP_10="1"
    @INC:
      /usr/lib/perl5/5.8.6/i386-linux-thread-multi
      /usr/lib/perl5/5.8.6
      /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi
      /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi
      /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi
      /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi
      /usr/lib/perl5/site_perl/5.8.2/i386-linux-thread-multi
      /usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi
      /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
      /usr/lib/perl5/site_perl/5.8.6
      /usr/lib/perl5/site_perl/5.8.5
      /usr/lib/perl5/site_perl/5.8.4
      /usr/lib/perl5/site_perl/5.8.3
      /usr/lib/perl5/site_perl/5.8.2
      /usr/lib/perl5/site_perl/5.8.1
      /usr/lib/perl5/site_perl/5.8.0
      /usr/lib/perl5/site_perl
      /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi
      /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi
      /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi
      /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi
      /usr/lib/perl5/vendor_perl/5.8.2/i386-linux-thread-multi
      /usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi
      /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
      /usr/lib/perl5/vendor_perl/5.8.6
      /usr/lib/perl5/vendor_perl/5.8.5
      /usr/lib/perl5/vendor_perl/5.8.4
      /usr/lib/perl5/vendor_perl/5.8.3
      /usr/lib/perl5/vendor_perl/5.8.2
      /usr/lib/perl5/vendor_perl/5.8.1
      /usr/lib/perl5/vendor_perl/5.8.0
      /usr/lib/perl5/vendor_perl
      .

*** Packages of interest status:

Apache::Request: -
CGI            : 3.05
LWP            : 5.79
mod_perl       : 1.999021, 1.999021


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

    [CORE TRACE COMES HERE]

This report was generated by /usr/bin/mp2bug on Thu Feb  3 02:55:12 2005 
GMT.

-------------8<---------- End Bug Report --------------8<----------

Note: Complete the rest of the details and post this bug report to
modperl <at> perl.apache.org. To subscribe to the list send an empty
email to modperl-subscribe@perl.apache.org.


Re: [mp2] threaded applications inside of mod_perl

Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
> Stas Bekman wrote:
> 
>> Thanks for the details. I can now reproduce the segfault. I'll post 
>> again when this is fixed.
> 
> 
> I've traced it down to a perl-core issue. I'm submitting a report to p5p 
> and I've CC'ed you, so you can stay in the loop.

doesn't look like anybody is going to try to fix perl, luckily we have 
workarounds. Anyway I've opened a ticket:
http://rt.perl.org/rt3/Ticket/Display.html?id=34180


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: [mp2] threaded applications inside of mod_perl

Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
> Stas Bekman wrote:
> 
>> Thanks for the details. I can now reproduce the segfault. I'll post 
>> again when this is fixed.
> 
> 
> I've traced it down to a perl-core issue. I'm submitting a report to p5p 
> and I've CC'ed you, so you can stay in the loop.
> 
> Meanwhile, there are two workarounds:

In fact just using:

  SetHandler modperl

and starting your script with:

my $r = shift;
tie *STDOUT, $r;

is sufficient. Below you will find all the workarounds that I've found 
working at the moment (added as a test to the mp2 test suite):

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

#
# there is a problem when STDOUT is internally opened to an
# Apache::PerlIO layer is cloned on a new thread start. PerlIO_clone
# in perl_clone() is called too early, before PL_defstash is
# cloned. As PerlIO_clone calls PerlIOApache_getarg, which calls
# gv_fetchpv via sv_setref_pv and boom the segfault happens.
#
# at the moment we should either not use an internally opened to
# :Apache streams, so the config must be:
#
# SetHandler modperl
#
# and then either use $r->print("foo") or tie *STDOUT, $r + print "foo"
#
# or close and re-open STDOUT to :Apache *after* the thread was spawned
#
# the above discussion equally applies to STDIN
#
# XXX: ->join calls leak under registry, this doesn't happen in the
# non-registry tests.

use threads;

my $r = shift;
$r->print("Content-type: text/plain\n\n");

{
     # now we can use $r->print API:
     my $thr = threads->new(
         sub {
             my $id = shift;
             $r->print("thread $id\n");
             return 1;
         }, 1);
     # $thr->join; # XXX: leaks scalar
}

{
     # close and re-open STDOUT to :Apache *after* the thread was
     # spawned
     my $thr = threads->new(
         sub {
             my $id = shift;
             close STDOUT;
             open STDOUT, ">:Apache", $r
                 or die "can't open STDOUT via :Apache layer : $!";
             print "thread $id\n";
             return 1;
         }, 2);
     # $thr->join; # XXX: leaks scalar
}

{
     # tie STDOUT to $r *after* the ithread was started has
     # happened, in which case we can use print
     my $thr = threads->new(
         sub {
             my $id = shift;
             tie *STDOUT, $r;
             print "thread $id\n";
             return 1;
         }, 3);
     # $thr->join; # XXX: leaks scalar
}

{
     # tie STDOUT to $r before the ithread was started has
     # happened, in which case we can use print
     tie *STDOUT, $r;
     my $thr = threads->new(
         sub {
             my $id = shift;
             print "thread $id\n";
             return 1;
         }, 4);
     # $thr->join; # XXX: leaks scalar
}

print "parent";




-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: [mp2] threaded applications inside of mod_perl

Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
> Thanks for the details. I can now reproduce the segfault. I'll post 
> again when this is fixed.

I've traced it down to a perl-core issue. I'm submitting a report to p5p 
and I've CC'ed you, so you can stay in the loop.

Meanwhile, there are two workarounds:

You must start with not using a tied STDOUT, i.e. change the SetHandler 
setting to 'modperl':

<Directory "/home/nk/www/vhosts/web/apps/">
               SetHandler modperl
               PerlResponseHandler ModPerl::Registry
               PerlOptions +ParseHeaders +GlobalRequest
               Options ExecCGI
</Directory>

now you can either use $r->print(), or tie STDOUT to $r in each thread 
where you want to use it. Do not tie it before starting the threads, since 
you will hit the same problem. The following program demonstrates both 
techniques:

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

use threads;

my $r = shift;
$r->print("Content-type: text/plain\n\n");

threads->create(
     sub {
        $r->print("thread 1\n");
     }, undef);

threads->create(
     sub {
         tie *STDOUT, $r;
         print "thread 2\n";
     }, undef);

$r->print("done");

as you use +GlobalRequest you can replace:

my $r = shift;

with

my $r = Apache->request;

but it's a bit slower.



-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: [mp2] threaded applications inside of mod_perl

Posted by Stas Bekman <st...@stason.org>.
Thanks for the details. I can now reproduce the segfault. I'll post again 
when this is fixed.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: [mp2] threaded applications inside of mod_perl

Posted by bo...@technogeeks.com.
On Thu, 3 Feb 2005, Stas Bekman wrote:

> where is the modperl confguration? As far as you've shown there is no 
> mod_perl involved in serving any requests. (Hint: show us 
> Directory/Location/etc container responsible for a request that has triggered 
> the segfault)
<Directory "/home/nk/www/vhosts/web/apps/">
               SetHandler perl-script
               PerlResponseHandler ModPerl::Registry
               PerlOptions +ParseHeaders +GlobalRequest
               Options ExecCGI
</Directory>

============================================
I have changed the startup.pl file to read to remove as many variables as 
possible.  It still segfaults with this minimal configuration

#!/usr/bin/perl

1;


============================================
> Please reread my original reply. I still have no idea how you've invoked the 
> script. i.e. show us the URL that you've called. and above I've asked you for 
> the relevant config section.


I invoke the script by running
http://localhost:8080/apps/test

Resulting in a closed connection and

[Thu Feb 03 21:25:19 2005] [notice] child pid 7393 exit signal 
Segmentation fault (11)


========================
Is a script using threads beneath the mod_perl interpretor expected to 
work or is this a dark corner of mod_perl best left untouched?


#!/usr/bin/perl
use strict;
require threads;

my $thread = threads->create(sub { print "I am a thread"},undef);



Thank you for your time.

Re: [mp2] threaded applications inside of mod_perl

Posted by Stas Bekman <st...@stason.org>.
bob-modperl@technogeeks.com wrote:
> On Thu, 3 Feb 2005, Stas Bekman wrote:
> 
>> Almost there. What this report lacks is:
>>
>> 1) the explanation of how this script was invoked. Is it running under 
>> ModPerl::Registry or else? Please show us the relevant httpd.conf bits.
>>
>> 2) backtrace. Please read:
>> http://perl.apache.org/docs/2.0/user/help/help.html#Resolving_Segmentation_Faults 
>>
> 
> 
> 
> httpd.conf
> ===========# prefork MPM
> # StartServers ......... number of server processes to start
> # MinSpareServers ...... minimum number of server processes which are 
> kept spare
> # MaxSpareServers ...... maximum number of server processes which are 
> kept spare
> # MaxClients ........... maximum number of server processes allowed to 
> start
> # MaxRequestsPerChild .. maximum number of requests a server process serves
> <IfModule prefork.c>
> StartServers         5
> MinSpareServers      5
> MaxSpareServers     10
> MaxClients          100
> MaxRequestsPerChild 10000
> </IfModule>
> 
> # pthread MPM
> # StartServers ......... initial  number of server processes to start
> # MaxClients ........... maximum  number of server processes allowed to 
> start
> # MinSpareThreads ...... minimum  number of worker threads which are 
> kept spare
> # MaxSpareThreads ...... maximum  number of worker threads which are 
> kept spare
> # ThreadsPerChild ...... constant number of worker threads in each 
> server process
> # MaxRequestsPerChild .. maximum  number of requests a server process 
> serves
> <IfModule worker.c>
> StartServers         2
> MaxClients         150
> MinSpareThreads     25
> MaxSpareThreads     75
> ThreadsPerChild     25
> MaxRequestsPerChild  0
> </IfModule>
> 
> # perchild MPM
> # NumServers ........... constant number of server processes
> # StartThreads ......... initial  number of worker threads in each 
> server process
> # MinSpareThreads ...... minimum  number of worker threads which are 
> kept spare
> # MaxSpareThreads ...... maximum  number of worker threads which are 
> kept spare
> # MaxThreadsPerChild ... maximum  number of worker threads in each 
> server process
> # MaxRequestsPerChild .. maximum  number of connections per server 
> process (then it dies)
> <IfModule perchild.c>
> NumServers           5
> StartThreads         5
> MinSpareThreads      5
> MaxSpareThreads     10
> MaxThreadsPerChild  20
> MaxRequestsPerChild  0
> AcceptMutex fcntl
> </IfModule>
> 
> # Include module configuration:
> #Include /etc/apache2/mods-enabled/*.load
> #Include /etc/apache2/mods-enabled/*.conf
> LoadModule log_config_module /usr/lib/httpd/modules/mod_log_config.so
> LoadModule env_module /usr/lib/httpd/modules/mod_env.so
> LoadModule alias_module /usr/lib/httpd/modules/mod_alias.so
> LoadModule cgi_module /usr/lib/httpd/modules/mod_cgi.so
> LoadModule rewrite_module /usr/lib/httpd/modules/mod_rewrite.so
> LoadModule access_module /usr/lib/httpd/modules/mod_access.so
> LoadModule dir_module /usr/lib/httpd/modules/mod_dir.so
> LoadModule mime_module /usr/lib/httpd/modules/mod_mime.so
> LoadModule autoindex_module /usr/lib/httpd/modules/mod_autoindex.so
> LoadModule negotiation_module /usr/lib/httpd/modules/mod_negotiation.so
> LoadModule setenvif_module /usr/lib/httpd/modules/mod_setenvif.so
> LoadModule status_module /usr/lib/httpd/modules/mod_status.so
> LoadModule auth_module /usr/lib/httpd/modules/mod_auth.so
> LoadModule deflate_module /usr/lib/httpd/modules/mod_deflate.so

where is the modperl confguration? As far as you've shown there is no 
mod_perl involved in serving any requests. (Hint: show us 
Directory/Location/etc container responsible for a request that has 
triggered the segfault)


> I have recompiled httpd with debugging and removed all references to 
> strip, recompiled perl with DEBUGGING, recompiled mod_perl as well.
> 
> I know this is not useful but I'm still not getting a good backtrace.  
> Any suggestions would be useful.
> 
> Starting program: /usr/src/redhat/BUILD/httpd-2.0.51/worker/httpd -X
> 
> Program received signal SIGINT, Interrupt.
> 0x406826ad in ?? ()
> (gdb) bt
> #0  0x406826ad in ?? ()
> #1  0x801684d8 in ?? ()
> #2  0x80285e4c in ?? ()
> #3  0x01000001 in ?? ()
> #4  0x80046c20 in ?? ()
> #5  0x402b7314 in ?? ()
> #6  0x4020a84e in ?? ()
> #7  0x00000000 in ?? ()

Please reread my original reply. I still have no idea how you've invoked 
the script. i.e. show us the URL that you've called. and above I've asked 
you for the relevant config section.



-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: [mp2] threaded applications inside of mod_perl

Posted by bo...@technogeeks.com.
On Thu, 3 Feb 2005, Stas Bekman wrote:

> Almost there. What this report lacks is:
>
> 1) the explanation of how this script was invoked. Is it running under 
> ModPerl::Registry or else? Please show us the relevant httpd.conf bits.
>
> 2) backtrace. Please read:
> http://perl.apache.org/docs/2.0/user/help/help.html#Resolving_Segmentation_Faults


httpd.conf
===========# prefork MPM
# StartServers ......... number of server processes to start
# MinSpareServers ...... minimum number of server processes which are kept 
spare
# MaxSpareServers ...... maximum number of server processes which are kept 
spare
# MaxClients ........... maximum number of server processes allowed to 
start
# MaxRequestsPerChild .. maximum number of requests a server process 
serves
<IfModule prefork.c>
StartServers         5
MinSpareServers      5
MaxSpareServers     10
MaxClients          100
MaxRequestsPerChild 10000
</IfModule>

# pthread MPM
# StartServers ......... initial  number of server processes to start
# MaxClients ........... maximum  number of server processes allowed to 
start
# MinSpareThreads ...... minimum  number of worker threads which are kept 
spare
# MaxSpareThreads ...... maximum  number of worker threads which are kept 
spare
# ThreadsPerChild ...... constant number of worker threads in each server 
process
# MaxRequestsPerChild .. maximum  number of requests a server process 
serves
<IfModule worker.c>
StartServers         2
MaxClients         150
MinSpareThreads     25
MaxSpareThreads     75
ThreadsPerChild     25
MaxRequestsPerChild  0
</IfModule>

# perchild MPM
# NumServers ........... constant number of server processes
# StartThreads ......... initial  number of worker threads in each server 
process
# MinSpareThreads ...... minimum  number of worker threads which are kept 
spare
# MaxSpareThreads ...... maximum  number of worker threads which are kept 
spare
# MaxThreadsPerChild ... maximum  number of worker threads in each server 
process
# MaxRequestsPerChild .. maximum  number of connections per server process 
(then it dies)
<IfModule perchild.c>
NumServers           5
StartThreads         5
MinSpareThreads      5
MaxSpareThreads     10
MaxThreadsPerChild  20
MaxRequestsPerChild  0
AcceptMutex fcntl
</IfModule>

# Include module configuration:
#Include /etc/apache2/mods-enabled/*.load
#Include /etc/apache2/mods-enabled/*.conf
LoadModule log_config_module /usr/lib/httpd/modules/mod_log_config.so
LoadModule env_module /usr/lib/httpd/modules/mod_env.so
LoadModule alias_module /usr/lib/httpd/modules/mod_alias.so
LoadModule cgi_module /usr/lib/httpd/modules/mod_cgi.so
LoadModule rewrite_module /usr/lib/httpd/modules/mod_rewrite.so
LoadModule access_module /usr/lib/httpd/modules/mod_access.so
LoadModule dir_module /usr/lib/httpd/modules/mod_dir.so
LoadModule mime_module /usr/lib/httpd/modules/mod_mime.so
LoadModule autoindex_module /usr/lib/httpd/modules/mod_autoindex.so
LoadModule negotiation_module /usr/lib/httpd/modules/mod_negotiation.so
LoadModule setenvif_module /usr/lib/httpd/modules/mod_setenvif.so
LoadModule status_module /usr/lib/httpd/modules/mod_status.so
LoadModule auth_module /usr/lib/httpd/modules/mod_auth.so
LoadModule deflate_module /usr/lib/httpd/modules/mod_deflate.so



startup.pl
===========
#!/usr/bin/perl
use Apache2 ();

# preload all mp2 modules
# use ModPerl::MethodLookup;
# ModPerl::MethodLookup::preload_all_modules();

use Apache::Status();
use Apache::DBI();
$Apache::DBI::DEBUG = 1;

use ModPerl::Util (); #for CORE::GLOBAL::exit

use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::RequestUtil ();

#use Apache::Server ();
use Apache::ServerUtil ();
use Apache::Connection ();
use Apache::Log ();

use APR::Table ();

use ModPerl::Registry ();

use Apache::Const -compile => ':common';
use APR::Const -compile => ':common';



===================

I have recompiled httpd with debugging and removed all references to 
strip, recompiled perl with DEBUGGING, recompiled mod_perl as well.

I know this is not useful but I'm still not getting a good backtrace.  Any 
suggestions would be useful.

Starting program: /usr/src/redhat/BUILD/httpd-2.0.51/worker/httpd -X

Program received signal SIGINT, Interrupt.
0x406826ad in ?? ()
(gdb) bt
#0  0x406826ad in ?? ()
#1  0x801684d8 in ?? ()
#2  0x80285e4c in ?? ()
#3  0x01000001 in ?? ()
#4  0x80046c20 in ?? ()
#5  0x402b7314 in ?? ()
#6  0x4020a84e in ?? ()
#7  0x00000000 in ?? ()



Re: [mp2] threaded applications inside of mod_perl

Posted by Stas Bekman <st...@stason.org>.
bob-modperl@technogeeks.com wrote:
> -------------8<---------- Start Bug Report ------------8<----------
> 1. Problem Description:
> 
> This program when run under :
> 
> =====================
> #!/usr/bin/perl
> use strict;
> use threads;
> 
> my $thread = threads->create(sub { print "I am a thread"; },undef);
> 
> =====================
> 
> Causes a segfault
> 
> [Wed Feb 02 16:55:57 2005] [notice] child pid 15039 exit signal 
> Segmentation
> fault (11)

Almost there. What this report lacks is:

1) the explanation of how this script was invoked. Is it running under 
ModPerl::Registry or else? Please show us the relevant httpd.conf bits.

2) backtrace. Please read:
http://perl.apache.org/docs/2.0/user/help/help.html#Resolving_Segmentation_Faults

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com