You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Plymouth Rock <Tr...@newmail.ru> on 2005/07/31 06:58:31 UTC

win32, mod_perl/2.0.1, Apache/2.0.54 - ithreads problem

 I'd using ithreads on ActivePerl 5.8.7 and Apache/2.0.54 (Win32). All scripts
with ithreads did working excellent. Since I've installed mod_perl/2.0.1 with
'ppm install', those scripts have ceased to work (there's an initial HTML-table's
dumping only). Due to I couldn't find another ways to demonstrate several
processes working in pseudo-parallel (on win32), I was forced to write CGI-
scripts just for a browser, not for shell. That is why I print out a multicolumn
table.

 What there are on my PC:
 w2k SP3
 MSIE6 SP1
 Apache/2.0.54 (Win32)
 mod_ssl/2.0.54
 OpenSSL/0.9.7g
 PHP/4.3.11
 mod_perl/2.0.1
 Perl/v5.8.7
 I downloaded the pre-compiled binary file that is about 30 Mb from:
 http://apache.tsuren.net/perl/win32-bin/Perl-5.8-win32-bin-0.10.exe
 It's the "All in one packages": Apache, ActivePerl, mod_perl, mod_php and so on.

 Paths:
 C:\Perl\bin\
 C:\Program Files\Apache Group\Apache2\bin\


 I'm writing and running CGI-scripts under MSIE6 that use the $|++ buffering,
the threads module and so on. Here are all the modules I'm using within any
single thread-script:

use strict;
use warnings;
use Time::HiRes;
use threads;
use threads::shared;
use Thread::Queue;

 Also I've checked up and modified paths and some directives in the
httpd.conf according to mod_perl 2.0 docs:

###################################################################
<IfModule mpm_winnt.c>
ThreadsPerChild 4
MaxRequestsPerChild  0
</IfModule>

LoadFile "C:/Perl/bin/perl58.dll"
LoadModule perl_module modules/mod_perl.so

DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"

<Directory "C:/Program Files/Apache Group/Apache2/htdocs">

Alias /modperl/ "C:/Program Files/Apache Group/Apache2/modperl/"

Alias /perl/ "/Apache2/perl/"
  <Location /perl>
     SetHandler perl-script
     PerlResponseHandler ModPerl::Registry
     Options +ExecCGI
     PerlOptions +ParseHeaders
  </Location>

ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache2/cgi-bin/"

<Directory "C:/Program Files/Apache Group/Apache2/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

<IfModule mod_perl.c>
    Include conf/perl.conf
</IfModule>
###################################################################

 Also I made like that in the perl.conf.

 A script was placed to C:/Program Files/Apache Group/Apache2/perl/ 
dir and running from MSIE as http://localhost/perl/myscript.pl with no
shebang!

 Now the error.log says:

Sat Jul 30 16:33:19 2005] [notice] Child 1048: Child process is running
[Sat Jul 30 16:33:19 2005] [notice] Child 1048: Acquired the start mutex.
[Sat Jul 30 16:33:19 2005] [notice] Child 1048: Starting 4 worker threads.
Variable "$q_letters" will not stay shared at (eval 75) line 75.
Variable "@threads" will not stay shared at (eval 75) line 73.
...and so on.

 When I'd running that script with Perl.exe interpreter from cgi-bin dir
and #!C:\Perl\bin\perl -w shebang, there weren't any errors and warning
messages.

 Here is an example of what is the $q_letters variable:
my $q_letters = new Thread::Queue;
$q_letters->enqueue('a','b','c',   'd','e','f',   'g','h','i');

 When I'm running the same script just in a shell, I seeing a HTML-table's
dumpimg again and no more, although the CPU still doing something hidden for
certain period.
 Also I'd looking at processes and seeing something like leak of memory:
Apache.exe did growing up to 45 Mb after that w2k had displayed alert msg
about "virtual memory is almost up".

 What's wrong? How to solve the problem of running win32-CGI-thread-scripts
on mod_perl 2.0 and Apache2? Is mod_perl 2.0 intended for using the win32's
threads module and the rest I using?
 If you're interesting, I'll post my script (3 kb) here.

 Thanx.

 P.S.: While I'd writing the message I nevertheless could wait until
a script shows some incorrect results in MSIE (about 10 min!!! later after
script was started).