You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Gustavo Delfino <gd...@mac.com> on 2005/07/07 23:40:27 UTC

Apache::Session / untie(%session)

I have been happly using mod_perl for more than a year. My  
application uses the Apache::Session package. One day, July 4 to be  
specific, my httpd_perl childs stated dying. The error log say:

[notice] child pid (...) exit signal Segmentation fault (11)

After putting a lot of prints to STDERR, I found that the processes  
were dying at the following line of code:

untie(%session)

Where %session is the Apache::Session hash.  This is very odd because  
I didn't change anything on my dedicated server that day. And it is  
also odd because sometimes work, sometimes fail. So far this is what  
I have tried to do to solve this:

1) Recompile apache+mod_perl
2) run under mod_cgi. This results in "premature end of script headers".

I store the sessions in a MySQL database.

I will now give you more details of my configuration:
mod_perl: 1.29
apache: 1.33
perl: 5.8.4
mysql: 4.1.10a
Apache::Session: 1.6
Apache::Session::MySQL 1.01
CGI::Application 3.31
RedHat Linux kernel 2.4.20-37.9.legacy

Just for completeness, this is part of the code I am using.

my %session;
my $id = $q->cookie( 'COOKIE-NAME' ) || undef;
eval
     {
       tie %session, 'Apache::Session::MySQL', $id,
         {
          Handle => $self->param('mydbh'),
          LockHandle => $self->param('mydbh')
         };
     };
   if ($@) # if an error occurred, old session is unavailable; create  
a new one
     {
       $id = undef;
       tie %session, 'Apache::Session::MySQL', $id,
         {
          Handle => $self->param('mydbh'),
          LockHandle => $self->param('mydbh')
         };
     }

I would really appreciate any help.

Regards,

Gustavo Delfino
Caracas, Venezuela.

Re: Apache::Session / untie(%session)

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Gustavo Delfino wrote:

> I have been happly using mod_perl for more than a year. My  
> application uses the Apache::Session package. One day, July 4 to be  
> specific, my httpd_perl childs stated dying. The error log say:
>
> [notice] child pid (...) exit signal Segmentation fault (11)

Can you submit a stack trace ?

gdb /path/to/httpd /path/to/corefile

you might also try using Apache::DB to trace it.

-- 
END 
---------------------------------------------------------
    What doesn't kill us can only make us stronger.
               Nothing is impossible.
				
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Developer / Liquidity Services, Inc.
     http://www.liquidityservicesinc.com
        http://www.liquidation.com
        http://www.uksurplus.com
        http://www.govliquidation.com
        http://www.gowholesale.com



Re: Apache::Session / untie(%session) (SOLVED!)

Posted by Gustavo Delfino <gd...@mac.com>.
On Jul 7, 2005, at 6:10 PM, Perrin Harkins wrote:


>> mysql: 4.1.10a
>>
>
> That doesn't sound very safe to me.  I'd either upgrade it to the  
> latest
> official release (4.1.12 I think) or downgrade to the latest 4.0.x
> release.  Make sure you have a recent DBI and DBD::mysql too.
>

I have just upgraded to mysql 4.1.11, and the problem continues. My  
DBI version is 1.48 and DBD::mysql is 3.0000 .... wait a minute....

ahaaa... that was the problem DBD::mysql was too new. The CPanel/WHM  
software had installed the updated version automatically.

I followed the directions at:
http://sniptools.com/tipstricks/mt-cpanel-issue-dbd-downgrade

and solved the problem.

Thank you Perrin and Phillip for the help.

Regards,

Gustavo Delfino


Re: Apache::Session / untie(%session)

Posted by "Ruslan U. Zakirov" <Ru...@miet.ru>.
Perrin Harkins wrote:
> On Thu, 2005-07-07 at 17:40 -0400, Gustavo Delfino wrote:
> 
>>untie(%session)
> 
> 
> That triggers a write to your database if you've modified the session
> data.
> 
> 
>>mysql: 4.1.10a
> 
> 
> That doesn't sound very safe to me.  I'd either upgrade it to the latest
> official release (4.1.12 I think) or downgrade to the latest 4.0.x
> release.  Make sure you have a recent DBI and DBD::mysql too.
People reports seg faults for DBD::mysql 3.0000, I think it could be a
reason too, because when you untie hash Apache::Session could update DB.

Downgrade to 2.9008 or try 3.0001 may be seg faults fixed there.

> 
> - Perrin
> 


Re: Apache::Session / untie(%session)

Posted by Perrin Harkins <pe...@elem.com>.
On Thu, 2005-07-07 at 17:40 -0400, Gustavo Delfino wrote:
> untie(%session)

That triggers a write to your database if you've modified the session
data.

> mysql: 4.1.10a

That doesn't sound very safe to me.  I'd either upgrade it to the latest
official release (4.1.12 I think) or downgrade to the latest 4.0.x
release.  Make sure you have a recent DBI and DBD::mysql too.

- Perrin