perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Wittek <m...@gedankenkonstrukt.de>
Subject [BUG] Pointer to DATA handle wrong when preloading modules with PerlModule and threaded MPM or perchild MPM
Date Fri, 22 Sep 2006 11:25:26 GMT
Hello!

I guess I've found a bug in mod_perl2.

I've run into troubles accessing the __DATA__ section of my
modules/handlers. A minimal demonstration handler looks like this:

  #!/usr/bin/perl
  package TestHandler;
  sub handler {
    warn tell DATA;
    return 0;
  }
  1;
  __DATA__
  foobarbaz

Correct result without preloading of the module:

  93 at /mnt/data/pro/konstrukt/dev/lib/TestHandler.pm line 4.

Incorrect result when preloading it with the Apache directive PerlModule
or in a script which is loaded by PerlRequire:

  103 at /mnt/data/pro/konstrukt/dev/lib/TestHandler.pm line 4.

The cursor is positioned at the end of the file. On some larger files it
is often positioned somewhere in the middle of the DATA section.
These results are from the _first_ run after `apache2 restart` and I
have not read anything from DATA. I know that you have to store the
original DATA position on the first request, if you want to read from it
in multiple requests. But I don't read from DATA, the position is
already wrong before the first read.

My configuration details (Debian testing):

  root@server# dpkg -l | pcregrep '(libapache2-mod-perl2 |apache2 )'
  ii  apache2                    2.0.55-4.1 [..]
  ii  libapache2-mod-perl2       2.0.2-2    [..]
  root@server# uname -a
  Linux server.zentrifuge.intra 2.6.17 #1 PREEMPT Tue Jul 11 02:32:04
CEST 2006 i686 GNU/Linux

Same problem on Ubuntu Dapper:

  ii  apache2                2.0.55-4ubuntu2
  ii  libapache2-mod-perl2   2.0.2-2ubuntu1
  Linux m1ndfuck 2.6.15-26-386 #1 PREEMPT Fri Jul 7 19:27:00 UTC 2006
i686 GNU/Linux

The problem does not appear on my Apache1/mod_perl1 installation. It
also doesn't appear on Apache2/mod_perl2 using xampp/WindowsXP.

It also does not appear when using the preforking MPM. So there seems to
be a problem in this combination:
-Apache2/mod_perl2 with threaded MPM (or perchild MPM)
-Preloading the Perl module using 'PerlModule' or 'PerlRequire'

Best regards
--
Thomas Wittek
http://gedankenkonstrukt.de/
Jabber: streawkceur@jabber.i-pobox.net


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message