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:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Reply via email to