You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Thomas Wittek <ma...@gedankenkonstrukt.de> on 2006/09/22 13:25:26 UTC

[BUG] Pointer to DATA handle wrong when preloading modules with PerlModule and threaded MPM or perchild MPM

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


Re: [BUG] Pointer to DATA handle wrong when preloading modules with PerlModule and threaded MPM or perchild MPM

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Thomas Wittek wrote:
> Hello!
> 
> I guess I've found a bug in mod_perl2.
We're not ignoring you... just busy.

I'll see about getting a test into the test suite this weekend.

> 
> 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

-- 
------------------------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

"In all that I've done wrong I know I must have done something right to
deserve a hug every morning and butterfly kisses at night."
    __  ___     ___ ____  __
   /  |/  /_ __/ __/ __ \/ /
  / /|_/ / // /\ \/ /_/ / /__
/_/  /_/\_, /___/\___\_\___/
        <___/

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