You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Dmitri Tikhonov <dm...@netilla.com> on 2003/05/07 19:27:17 UTC

[mp2] Apache::Reload and touch files.

In both 1.99_08 (the version I'm using) and in current version of
mod_perl, Apache::Reload contains these lines:
 
        $TouchModules = <$sym>;
        chomp $TouchModules;

The documentation on perl.apache.org states that 'touch /tmp/somefile'
will reload modules on next request.  However, if the file is touched
and is empty, the next request produces an internal server error and
this message in the log file:
 
[Wed May 07 13:06:42 2003] [error] [client 192.168.1.105] Use of
uninitialized value in scalar chomp at
/usr/lib/perl5/site_perl/5.6.1/i386-linux/Apache/Reload.pm line 66.

'echo " " > /tmp/somefile' works fine.
 
The question is, is this a bug in documentation or in implementation?
 
  - Dmitri.
 
P.S.  Linux 2.4.21pre5, Perl 5.6.1.
 

Re: [mp2] Apache::Reload and touch files.

Posted by Stas Bekman <st...@stason.org>.
Dmitri Tikhonov wrote:
> Yup, 1.99_09 does the same thing without the patch, but the patch fixes
> it, thanks.

Thank you, Dmitri ;)

I'll commit it shortly. I'll also bump up the module's version, to avoid such 
confusions in the future.

> P.S.  Is it just me or is 1.99_09 faster than the previous release?

What are your conclusions based on? There were quite a few changes since 
1.99_08, but none was particularly optimization oriented.

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


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


Re: [mp2] Apache::Reload and touch files.

Posted by Dmitri Tikhonov <dm...@netilla.com>.
Yup, 1.99_09 does the same thing without the patch, but the patch fixes
it, thanks.

  - Dmitri.

P.S.  Is it just me or is 1.99_09 faster than the previous release?

On Thu, 8 May 2003, Stas Bekman wrote:

> Dmitri Tikhonov wrote:
> > This is a patch against Apache::Reload from 1.99_08:
> >
> > --- Apache/Reload.pm.orig       Wed May  7 19:49:21 2003
> > +++ Apache/Reload.pm    Wed May  7 19:49:24 2003
> > @@ -62,7 +62,7 @@
> >          $TouchTime = $touch_mtime;
> >          my $sym = Apache->gensym;
> >          open($sym, $TouchFile) || die "Can't open '$TouchFile': $!";
> > -        $TouchModules = <$sym>;
> > +        $TouchModules = (<$sym> || '');
> >          chomp $TouchModules;
> >      }
>
> But this is not the code that we have in 1.99_09 (sorry I've missed the fact
> that you were talking about 1.99_08). Can you please try to install 1.99_09?
>
> with this patch on top of it:
>
> Index: lib/Apache/Reload.pm
> ===================================================================
> RCS file: /home/cvs/modperl-2.0/lib/Apache/Reload.pm,v
> retrieving revision 1.9
> diff -u -r1.9 Reload.pm
> --- lib/Apache/Reload.pm        17 Feb 2003 09:39:54 -0000      1.9
> +++ lib/Apache/Reload.pm        8 May 2003 00:08:37 -0000
> @@ -72,7 +72,7 @@
>           $TouchTime = $touch_mtime;
>           open my $fh, $TouchFile or die "Can't open '$TouchFile': $!";
>           $TouchModules = <$fh>;
> -        chomp $TouchModules;
> +        chomp $TouchModules if $TouchModules;
>       }
>
>       if (ref($o) && (lc($o->dir_config("ReloadAll") || 'on') eq 'on')) {
>
>
>
> __________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
> http://stason.org/     mod_perl Guide ---> http://perl.apache.org
> mailto:stas@stason.org http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com
>
>


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


Re: [mp2] Apache::Reload and touch files.

Posted by Stas Bekman <st...@stason.org>.
Dmitri Tikhonov wrote:
> This is a patch against Apache::Reload from 1.99_08:
> 
> --- Apache/Reload.pm.orig       Wed May  7 19:49:21 2003
> +++ Apache/Reload.pm    Wed May  7 19:49:24 2003
> @@ -62,7 +62,7 @@
>          $TouchTime = $touch_mtime;
>          my $sym = Apache->gensym;
>          open($sym, $TouchFile) || die "Can't open '$TouchFile': $!";
> -        $TouchModules = <$sym>;
> +        $TouchModules = (<$sym> || '');
>          chomp $TouchModules;
>      }

But this is not the code that we have in 1.99_09 (sorry I've missed the fact 
that you were talking about 1.99_08). Can you please try to install 1.99_09?

with this patch on top of it:

Index: lib/Apache/Reload.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/Apache/Reload.pm,v
retrieving revision 1.9
diff -u -r1.9 Reload.pm
--- lib/Apache/Reload.pm        17 Feb 2003 09:39:54 -0000      1.9
+++ lib/Apache/Reload.pm        8 May 2003 00:08:37 -0000
@@ -72,7 +72,7 @@
          $TouchTime = $touch_mtime;
          open my $fh, $TouchFile or die "Can't open '$TouchFile': $!";
          $TouchModules = <$fh>;
-        chomp $TouchModules;
+        chomp $TouchModules if $TouchModules;
      }

      if (ref($o) && (lc($o->dir_config("ReloadAll") || 'on') eq 'on')) {



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


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


Re: [mp2] Apache::Reload and touch files.

Posted by Dmitri Tikhonov <dm...@netilla.com>.
This is a patch against Apache::Reload from 1.99_08:

--- Apache/Reload.pm.orig       Wed May  7 19:49:21 2003
+++ Apache/Reload.pm    Wed May  7 19:49:24 2003
@@ -62,7 +62,7 @@
         $TouchTime = $touch_mtime;
         my $sym = Apache->gensym;
         open($sym, $TouchFile) || die "Can't open '$TouchFile': $!";
-        $TouchModules = <$sym>;
+        $TouchModules = (<$sym> || '');
         chomp $TouchModules;
     }


  - Dmitri.

On Thu, 8 May 2003, Stas Bekman wrote:

> Dmitri Tikhonov wrote:
>
> >>In any case, it's a pure perl code, so you should be able to easily debug it
> >>and send a fixing patch if it's really the problem.
> >
> >
> > This does the trick:
> >
> >     $TouchModules = (<$sym> || '');
>
> Can you please send a diff? I can't guess where this code should go to. Thanks.
>
>
>
> __________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
> http://stason.org/     mod_perl Guide ---> http://perl.apache.org
> mailto:stas@stason.org http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com
>
>


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


Re: [mp2] Apache::Reload and touch files.

Posted by Stas Bekman <st...@stason.org>.
Dmitri Tikhonov wrote:

>>In any case, it's a pure perl code, so you should be able to easily debug it
>>and send a fixing patch if it's really the problem.
> 
> 
> This does the trick:
> 
>     $TouchModules = (<$sym> || '');

Can you please send a diff? I can't guess where this code should go to. Thanks.



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


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


Re: [mp2] Apache::Reload and touch files.

Posted by Dmitri Tikhonov <dm...@netilla.com>.
On Thu, 8 May 2003, Stas Bekman wrote:

> Dmitri Tikhonov wrote:
> > In both 1.99_08 (the version I'm using) and in current version of
> > mod_perl, Apache::Reload contains these lines:
> >
> >         $TouchModules = <$sym>;
> >         chomp $TouchModules;
> >
> > The documentation on perl.apache.org states that 'touch /tmp/somefile'
> > will reload modules on next request.  However, if the file is touched
> > and is empty, the next request produces an internal server error and
> > this message in the log file:
> >
> > [Wed May 07 13:06:42 2003] [error] [client 192.168.1.105] Use of
> > uninitialized value in scalar chomp at
> > /usr/lib/perl5/site_perl/5.6.1/i386-linux/Apache/Reload.pm line 66.
> >
> > 'echo " " > /tmp/somefile' works fine.
> >
> > The question is, is this a bug in documentation or in implementation?
> >
> >   - Dmitri.
> >
> > P.S.  Linux 2.4.21pre5, Perl 5.6.1.
>
> Are you sure that this is Apache::Reload distributed from mp2? What's its
> version? the one comes with mp2 has its version 0.08

Yes.

> In any case, it's a pure perl code, so you should be able to easily debug it
> and send a fixing patch if it's really the problem.

This does the trick:

    $TouchModules = (<$sym> || '');

  - Dmitri.


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


Re: [mp2] Apache::Reload and touch files.

Posted by Stas Bekman <st...@stason.org>.
Dmitri Tikhonov wrote:
> In both 1.99_08 (the version I'm using) and in current version of
> mod_perl, Apache::Reload contains these lines:
>  
>         $TouchModules = <$sym>;
>         chomp $TouchModules;
> 
> The documentation on perl.apache.org states that 'touch /tmp/somefile'
> will reload modules on next request.  However, if the file is touched
> and is empty, the next request produces an internal server error and
> this message in the log file:
>  
> [Wed May 07 13:06:42 2003] [error] [client 192.168.1.105] Use of
> uninitialized value in scalar chomp at
> /usr/lib/perl5/site_perl/5.6.1/i386-linux/Apache/Reload.pm line 66.
> 
> 'echo " " > /tmp/somefile' works fine.
>  
> The question is, is this a bug in documentation or in implementation?
>  
>   - Dmitri.
>  
> P.S.  Linux 2.4.21pre5, Perl 5.6.1.

Are you sure that this is Apache::Reload distributed from mp2? What's its 
version? the one comes with mp2 has its version 0.08

In any case, it's a pure perl code, so you should be able to easily debug it 
and send a fixing patch if it's really the problem.

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


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