Re: Restarting Apache2.2 from PERL

2007-08-29 Thread Stephane GUIBOUD-RIBAUD

It's like a suicide ?
If you kill Apache, you kill yourself.

Probably, you can create a detached process from your script that will
be in charge of making the stuff.

Take care about OS you are running perl on to do this.

Regards

Matthieu FEREYRE a écrit :

Is it possible to restart Apache from a perl script (executed by Apache) ?

I tried to send a Kill system command with no success.

Any idea ?

FEREYRE Matthieu

 Ce courriel et les documents qui y sont attaches peuvent contenir des 
informations confidentielles. Si vous n'etes pas le destinataire 
escompte, merci d'en informer l'expediteur immediatement et de detruire 
ce courriel ainsi que tous les documents attaches de votre systeme 
informatique. Toute divulgation, distribution ou copie du present 
courriel et des documents attaches sans autorisation prealable de son 
emetteur est interdite.


 This e-mail and any attached documents may contain confidential or 
proprietary information. If you are not the intended recipient, please 
advise the sender immediately and delete this e-mail and all attached 
documents from your computer system. Any unauthorised disclosure, 
distribution or copying hereof is prohibited.




Re: JOB [CONTRACT] + Re: Windows + MP2 in a production environment

2006-11-21 Thread Stephane GUIBOUD-RIBAUD
I had a similar issue one year ago with mod_perl 2.0.0-RC4 and perl 
5.6.1 (same issue with perl 5.8).


The problem was due to the use of LibXML (which is the fastest xml 
parsing library I found to parse large XML files) with mod_perl and 
apache in a multi-threaded environment. I also had some issues with 
SOAP-Lite module in my environment.


I had to go back to a CGI application to solve this problem, but I don't 
have a highly loaded server at this time.


Stéphane

Issac Goldstand wrote:

We were originally using 5.8.3, but reproduced the problem with both
activeperl 5.8.8.819 with mod_perl-2.0.3-dev (from your PPM repository)
as well as our own built perl + mod_perl 2.0.3-rc2

Randy Kobes wrote:

On Sun, 19 Nov 2006, Foo JH wrote:


Issac Goldstand wrote:

YES!  While it's acceptable for light and smallish applications, I've
never found it to be really usable once you're serving concurrent
connections.

On that note, I have a contract (job) offer for anyone who knows
their way inside Perl (5.8) and mod_perl  (2) enough to help
troubleshoot a win32-related crash.  In short, once we put heavy load
on the server, we see a crash reported from inside libperl58.dll - my
theory is that it's thread-related, but I don't have the time to look
into it properly.  If anyone thinks that they are capable of
identifying and fixing the problem, please email me.

What version of perl are you using? There were some
threads-related fixes introduced in perl-5.8.8 that
solved some problems with earlier versions.





Re: SV: JOB [CONTRACT] + Re: Windows + MP2 in a production environment

2006-11-21 Thread Stephane GUIBOUD-RIBAUD

Philip M. Gollucci wrote:
Its been about 6 years since I've tried anything mod_perl windows 
related, but I recall that some of the startup.pl files of that time 
loaded LibXML and related by default. You might have been loading it and 
just not using it.


The related problem on windows is that mod_perl is running on a 
multi-threaded environment (not the case on unix in standard 
installation). The example of LibXML should not confused the real problem:


In the list of all modules you are using in your application, are you 
sure that all modules are thread-safe ? If only one is not thread-safe, 
you may encounter an error at a time while running your application ?


I'd never found a way to configure apache 2 + mod_perl 2 to work in a 
pre-forked environment on windows. Is there anyone who knows if it's 
possible ?


Stéphane


Re: Why does my MP2 crash intermittently?

2005-09-13 Thread Stephane GUIBOUD-RIBAUD
I had the same problem. The only way to solve it was to use the 
Apache2::Reload module. By using this module, the apache that crashed is 
killed and a new process is started immediately. However, this not solve 
the real problem but the popup is not displayed.


Moreover, I'm using Apache 2.0.54 and mod_perl 2.0.1 (precompiled 
version) on Windows XP and I had a lot of memory leak problem with the 
Apache::ASP module. This module causes also an internal server error 
when the cleanup_register handlers is called: it seems that Apache::ASP 
has detected mod_perl 2 at startup and went back to mod_perl 1 at 
sometime so he didn't call the right handler. Have you check your 
error_log ?


Foo Ji-Haw wrote:


Hello all,
 
I have set up my MP2 application, which in the course of development 
has been reasonably stable. But when I put it under reasonably load (I 
have a daemon with 5 threads that call it periodically, and I browse 
around the pages with 2 other collegues), sometimes I get this error 
(see attached for the actually screenshot):
The instruction at 0x280877f1 referenced memory at 0x515ee28. The 
memory coudl not be read.
 
The application basically freezes at this point. Clicking on the OK 
button seems to bring MP2 back to operations immediately. Looking at 
the log, Apache seems to have restarted.
 
This is very annoying, as my app is generally ready to go, but 
intermittent errors like this makes it otherwise. Nothing else is 
capture in the log, so I don't know where to go to discover the culprit.
 
Can anyone please advise me on this? Appreciate it!


--
Stéphane GUIBOUD-RIBAUDSTMicroelectronics
HPC/PMG/AP3  Grenoble
Tel.: +33 (4) 76 585 246   TINA: 041 5246



Re: Why does my MP2 crash intermittently?

2005-09-13 Thread Stephane GUIBOUD-RIBAUD

Foo Ji-Haw wrote:


Hello Nikolay,
 
You mean you didn't use the ActivePerl distribution? You do this to 
avoid the OEM licensing issue?
I am using the standard ActivePerl 5.8.7, with MP2.0.1 and Apache 
2.0.52. I hope this is not the cause of the problem.


Did you try to upgrade to 2.0.54 ?
I have a pretty similar configuration as you except that I'm running 
apache on Windows XP (SP1) and apache 2.0.53 (not upgraded now to 2.0.54).


Stephane

--
Stéphane GUIBOUD-RIBAUDSTMicroelectronics
HPC/PMG/AP3  Grenoble
Tel.: +33 (4) 76 585 246   TINA: 041 5246



Re: Apache2::Reload problems

2005-05-25 Thread Stephane GUIBOUD-RIBAUD

Hi Mark,

I had the same problem as you when installed the 2.0.0-RC6.
I patched the Apache/Reload.pm (version 0.07) as follow:

1/ Changed the string ${package}::FIELDS by 
${package}::APACHE_RELOAD_FIELDS (line 43, 44, 90, 92)
2/ Changed the return value of the 'handler' function to return 0 
(instead of 1) [line 139].


You will find in attachment the version I used.

I don't know if the first modification has a real impact on the error, 
but it works like this for me.


Stephane

Mark wrote:


I have a typical situation, with a Registry script that use's
a bunch of modules.  After Apache::Reload reloads the first module,
I get errors suggesting that the other loaded modules have been lost.

To illustrate, it is like this (fake example):

Script:

   #!/usr/bin/perl

  use Fubar;
  use Snafu;

  $f = Fubar-new()
  $s = Snafu-new()


I run once, then 'touch /path/to/Fubar.pm'

Then I run from client, and I get error:

   Can't locate object method new via package Snafu at ...


Makes no sense to me?  Any ideas?Same code on Apache 1.3 no problem.
My Reload config is:

PerlModule Apache2::Reload
PerlInitHandler Apache2::Reload
PerlSetVar ReloadAll Off
PerlSetVar ReloadModules Fubar
PerlSetVar ReloadDebug On

And I also have both Fubar and Snafu in my Apache PerlRequire file.

Thanks.







--
Stéphane GUIBOUD-RIBAUDSTMicroelectronics
HPC/PMG/AP3  Grenoble
Tel.: +33 (4) 76 585 246   TINA: 041 5246

# $Id: Reload.pm,v 1.16 2001/04/22 18:09:59 matt Exp $

package Apache::Reload;

use strict;

$Apache::Reload::VERSION = '0.07.1';

use vars qw(%INCS %Stat $TouchTime %UndefFields);

%Stat = ($INC{Apache/Reload.pm} = time);

$TouchTime = time;

sub import {
my $class = shift;
my ($package,$file) = (caller)[0,1];

$class-register_module($package, $file);
}

sub package_to_module {
my $package = shift;
$package =~ s/::/\//g;
$package .= .pm;
return $package;
}

sub register_module {
my ($class, $package, $file) = @_;
my $module = package_to_module($package);

if ($file) {
$INCS{$module} = $file;
}
else {
$file = $INC{$module};
return unless $file;
$INCS{$module} = $file;
}

no strict 'refs';
if (%{${package}::APACHE_RELOAD_FIELDS}) {
$UndefFields{$module} = ${package}::APACHE_RELOAD_FIELDS;
}
}

sub handler {
my $r = shift;

my $DEBUG = ref($r)  (lc($r-dir_config(ReloadDebug) || '') eq 'on');

my $TouchFile = ref($r)  $r-dir_config(ReloadTouchFile);

my $TouchModules;

if ($TouchFile) {
warn Checking mtime of $TouchFile\n if $DEBUG;
my $touch_mtime = (stat($TouchFile))[9] || return 1;
return 1 unless $touch_mtime  $TouchTime;
$TouchTime = $touch_mtime;
my $sym = Apache-gensym;
open($sym, $TouchFile) || die Can't open '$TouchFile': $!;
$TouchModules = $sym;
chomp $TouchModules;
}

if (ref($r)  (lc($r-dir_config(ReloadAll) || 'on') eq 'on')) {
*Apache::Reload::INCS = \%INC;
}
else {
*Apache::Reload::INCS = \%INCS;
my $ExtraList = 
$TouchModules || 
(ref($r)  $r-dir_config(ReloadModules)) || 
'';
my @extra = split(/\s+/, $ExtraList);
foreach (@extra) {
if (/(.*)::\*$/) {
my $prefix = $1;
$prefix =~ s/::/\//g;
foreach my $match (keys %INC) {
if ($match =~ /^\Q$prefix\E/) {
$Apache::Reload::INCS{$match} = $INC{$match};
my $package = $match;
$package =~ s/\//::/g;
$package =~ s/\.pm$//;
no strict 'refs';
#warn checking for FIELDS on $package\n;
if (%{${package}::APACHE_RELOAD_FIELDS}) {
#warn found fields in $package\n;
$UndefFields{$match} = 
${package}::APACHE_RELOAD_FIELDS;
}
}
}
}
else {
Apache::Reload-register_module($_);
}
}
}


while (my($key, $file) = each %Apache::Reload::INCS) {
local $^W;
warn Apache::Reload: Checking mtime of $key\n if $DEBUG;

my $mtime = (stat $file)[9];

unless (defined($mtime)  $mtime) {
for (@INC) {
$mtime = (stat $_/$file)[9];
last if defined($mtime)  $mtime;
}
}

warn(Apache::Reload: Can't locate $file\n),next 
unless defined $mtime and $mtime;

unless (defined $Stat{$file}) {
$Stat{$file} = $^T;
}

if ($mtime  $Stat{$file}) {
delete