Dave Mitchell wrote:
On Sat, Feb 19, 2005 at 02:20:28AM -0000, Stas Bekman wrote:

We have yet another chicken-n-egg problem with perl_clone. If you do a
simple:

use threads;
my $thread = threads->create(sub {}, undef)

and STDOUT is opened to some PerlIO layer, an attempt to clone it will be
performed. The problem is that this cloning happens too early:


do you have a complete script that reproduces this?

something simple like binmode STDOUT, ':utf8';
didn't segfault

Under mod_perl2

package My::Bug;

use Apache2::RequestRec ();
use Apache2::RequestIO ();

use Apache2::Const -compile => qw(OK);

use threads;

sub handler {
    my $r = shift;

    my $thread = threads->create(sub {}, undef);
    $thread->join;

    $r->content_type('text/plain');
    print 'found a bug';

    return Apache2::Const::OK;
}

1;

and config:

<Location /bug>
  SetHandler perl-script
  PerlResponseHandler My::Bug
</Location>

I've attached a tarball that reproduces the problem. Assuming that you've mod_perl2 installed, unpack it and run:

perl Makefile.PL -httpd /home/stas/httpd/prefork/bin/httpd
make
make test
(you should get a segfault)
(adjust the path to the location of your httpd)

Thanks Dave.

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

Attachment: bug-reporting-skeleton-mp2.tar.gz
Description: GNU Zip compressed data

Reply via email to