From: "Jonathan" <[EMAIL PROTECTED]>
Subject: Re: Apache::Session::MySQL lock troubles


> looks like DBI stops talking to mysql
>
> when this happens, is apache hanging?
>
> or does it just crash on one page, and then continually crash on
> subsequent pages?

Yeah, apache freezes ( was freezing ) solid. No more entries in the
access_log for subequent requests.

> a few ideas:
> a
> are you using the same dh / $dbh for session as the rest of your site?
> if so, try creating a new mysql db for sessions only.
> there could be some locking issue caused by other queries.

Yes, the whole site is (supposed to be) using the same dh. I seemed to have
fixed it, though I didn't find the exact reason. Changing the way a $dbh was
built in an unrelated picece of mason code seemed to fix it. A $dbh was
being made via DBI->connect in a <% shared %> section and used in <% method
%>s in an autohandler. Switching to what seems to me to be a more sane
usage, I haven't had a hang yet, even with giving -n 5000 -c 10 ( a VERY
heavy usage for this site ) to ab.

I think Apache::Session was trying to release a lock that it didn't create.
Another guess is identical pieces of code with improperly scoped variables
were trying to work simultaneously after a redirect.

> b
> are you using Apache::DBI or another persistence provider?
> i'm thinking that *maybe* you're not, and mysql is unhappy that
> you're slamming it with constant connects.

Yeah, it does use Apache::DBI

> c
> if this is a dev box, try enabling the query log and slow log in
> mysql, and enable tracing in DBI
> if you can reproduce, see if mysql is logging it as a slow log, and
> see if mysql or DBI did something that didn't unlock a table
> be warned though - mysql query log can grow gigantic, and DBI
> tracing can be verbose


I've gotten it to hang on dev and staging, but of course it seems to do it
the most on production :-).

> d
> assuming you're on a nix/bsd ( there were some files in the root of
> that page that suggested such) tail the logs while you stresstest.
>

Help! I'm drowning in log entries :-)

Thank you so much for your very useful tips!

trwww

>
> On Feb 26, 2006, at 4:29 PM, Todd W wrote:
>
> > Apache::Session is occasionally hanging pages. If I stop the
> > server, I find
> > the following in the error log:
> >
> > http://waveright.homeip.net/~trwww/code/pmsi/4tp-bug.txt
> >
> > using pre and post statment warn()s, I found that the line that
> > causes the
> > hang is:
> >
> >       eval {
> >       tie %{$session}, 'Apache::Session::MySQL', $session_key,
> >        { Handle => $dbh, LockHandle => $dbh } ;
> >      } ;
> >
> > The only way I can "duplicate" it is by pounding the sever with ab.
> >
> > Once it hangs, it says hung ( can't make any other requests ). A
> > restart
> > always gets it going agian.
> >
> > Thanks in advance for any advice!
> >
> > Todd W.
> >
> >
> >
>
>



Reply via email to