Re: Error: Too many connections - Mozilla

This is a discussion on Re: Error: Too many connections - Mozilla ; On Tue, 17 Jun 2008 17:26:13 -0700 Bruce Nourish wrote: > It's not present. Should I post a copy of my mod_perl.pl? No, that's not necessary. I assume you're using 3.0.3 or later. If you do a MySQL query that ...

+ Reply to Thread
Results 1 to 13 of 13

Thread: Re: Error: Too many connections

  1. Re: Error: Too many connections

    On Tue, 17 Jun 2008 17:26:13 -0700 Bruce Nourish
    wrote:
    > It's not present. Should I post a copy of my mod_perl.pl?


    No, that's not necessary. I assume you're using 3.0.3 or later.

    If you do a MySQL query that takes longer to finish than your
    testing script runs for, MySQL may not (I don't know) actually
    terminate the query just because the Apache process stops serving that
    page. That is, queries could still be running, and tying up
    connections, because buglist.cgi can take a while to load if it's
    returning a lot of bugs.

    There could also be some problem in your tables, or a deadlock
    in your MySQL server that causes connections never to terminate. You
    could try doing a SHOW FULL PROCESSLIST as root in your MySQL install.

    -Max
    --
    http://www.everythingsolved.com/
    Competent, Friendly Bugzilla and Perl Services. Everything Else, too.

  2. Re: Error: Too many connections

    On Jun 18, 12:20*am, Max Kanat-Alexander wrote:
    > On Tue, 17 Jun 2008 17:26:13 -0700 Bruce Nourish
    >
    > wrote:
    > > It's not present. Should I post a copy of my mod_perl.pl?

    >
    > * * * * No, that's not necessary. I assume you're using 3.0.3 or later.
    >
    > * * * * If you do a MySQL query that takes longer to finish than your
    > testing script runs for, MySQL may not (I don't know) actually
    > terminate the query just because the Apache process stops serving that
    > page. That is, queries could still be running, and tying up
    > connections, because buglist.cgi can take a while to load if it's
    > returning a lot of bugs.
    >
    > * * * * There could also be some problem in your tables, or a deadlock
    > in your MySQL server that causes connections never to terminate. You
    > could try doing a SHOW FULL PROCESSLIST as root in your MySQL install.
    >
    > * * * * -Max
    > --http://www.everythingsolved.com/
    > Competent, Friendly Bugzilla and Perl Services. Everything Else, too.


    NOTE: I am working on this problem with the original poster.

    processlist just shows sleeping connections. The version of Bugzilla
    is 3.0.4. The query we are using to test is a very simple search
    which returns very quickly the first hundred or so times until so many
    sleeping connections accumulate that new requests fail. If we reduce
    the wait_timeout in MySQL the sleeping connections timeout and
    bugzilla continues to work. But that is really just treating the
    symptom.

    Clearly something is holding onto these DB connections. Apache:BI
    is not even installed.

    Austin

  3. Re: Error: Too many connections

    On Wed, 18 Jun 2008 08:50:52 -0700 (PDT) Austin Godber
    wrote:
    > Clearly something is holding onto these DB connections. Apache:BI
    > is not even installed.


    Strange. Bugzilla explicitly calls $dbh->disconnect in its
    CleanupHandler. If you modified the configuration some way so that the
    CleanupHandler never gets called, that could possibly do it.

    -Max
    --
    http://www.everythingsolved.com/
    Competent, Friendly Bugzilla and Perl Services. Everything Else, too.

  4. Re: Error: Too many connections

    On Jun 18, 8:23 pm, Max Kanat-Alexander wrote:
    > On Wed, 18 Jun 2008 08:50:52 -0700 (PDT) Austin Godber
    >
    > wrote:
    > > Clearly something is holding onto these DB connections. Apache:BI
    > > is not even installed.

    >
    > Strange. Bugzilla explicitly calls $dbh->disconnect in its
    > CleanupHandler. If you modified the configuration some way so that the
    > CleanupHandler never gets called, that could possibly do it.
    >
    > -Max
    > --http://www.everythingsolved.com/
    > Competent, Friendly Bugzilla and Perl Services. Everything Else, too.


    Where would I see this? I see a CleanupHandler in mod_perl.pl that
    appears to make no such call. This is in the 3.0.4 downloaded from
    the site just now (as well as our copy). In fact, grepping the entire
    source for disconnect returns four instances (excluding contrib/):

    Bugzilla.pm:
    # Per process cleanup
    sub _cleanup {

    # When we support transactions, need to ->rollback here
    my $main = request_cache()->{dbh_main};
    my $shadow = request_cache()->{dbh_shadow};
    $main->disconnect if $main;
    $shadow->disconnect if $shadow && Bugzilla->params->{"shadowdb"};
    undef $_request_cache;
    }

    which appears to be only called here:
    sub END {
    # Bugzilla.pm cannot compile in mod_perl.pl if this runs.
    _cleanup() unless $ENV{MOD_PERL};
    }


    Also in the following two functions that don't seem to be what you are
    talking about.

    Bugzilla/DB.pm:
    sub bz_check_requirements
    sub bz_create_database

    Austin

  5. Re: Error: Too many connections

    On Thu, 19 Jun 2008 09:37:36 -0700 (PDT) Austin Godber
    wrote:
    > Where would I see this? I see a CleanupHandler in mod_perl.pl that
    > appears to make no such call.


    The CleanupHandler calls Bugzilla::_cleanup(). If yours
    doesn't, then perhaps your mod_perl.pl was modified?

    -Max

  6. Re: Error: Too many connections

    Max Kanat-Alexander wrote:
    > On Thu, 19 Jun 2008 09:37:36 -0700 (PDT) Austin Godber
    > wrote:
    >> Where would I see this? I see a CleanupHandler in mod_perl.pl that
    >> appears to make no such call.

    >
    > The CleanupHandler calls Bugzilla::_cleanup(). If yours
    > doesn't, then perhaps your mod_perl.pl was modified?
    >
    > -Max


    I'm running a vanilla BZ install (3.0.4), and I'm seeing hundreds of
    sleeping connections on my master database as well ever since moving to
    mod_perl. I have a monitor that kills them off after a while, so I
    wasn't too concerned, but it makes 'show processlist' much more
    difficult to work with.

    My database slave doesn't have any sleeping Bugzilla connections, however.

  7. Re: Error: Too many connections

    On Fri, 20 Jun 2008 10:40:33 -0400 Denis Roy
    wrote:
    > I'm running a vanilla BZ install (3.0.4), and I'm seeing hundreds of
    > sleeping connections on my master database as well ever since moving
    > to mod_perl.


    Hmm, odd. What version of mod_perl are you using? It sounds
    like the CleanupHandler is never getting called, or something isn't
    working inside Bugzilla::_cleanup(), perhaps.

    -Max
    --
    http://www.everythingsolved.com/
    Competent, Friendly Bugzilla and Perl Services. Everything Else, too.

  8. Re: Error: Too many connections

    On Jun 20, 5:43*pm, Max Kanat-Alexander wrote:
    > On Fri, 20 Jun 2008 10:40:33 -0400 Denis Roy
    >
    > wrote:
    > > I'm running a vanilla BZ install (3.0.4), and I'm seeing hundreds of
    > > sleeping connections on my master database as well ever since moving
    > > to mod_perl.

    >
    > * * * * Hmm, odd. What version of mod_perl are you using? It sounds
    > like the CleanupHandler is never getting called, or something isn't
    > working inside Bugzilla::_cleanup(), perhaps.
    >
    > * * * * -Max
    > --http://www.everythingsolved.com/
    > Competent, Friendly Bugzilla and Perl Services. Everything Else, too.


    We are using mod_perl 2.0.3.

    In mod_perl.pl _cleanup seems to only be called on this line:
    _cleanup() unless $ENV{MOD_PERL};

    which suggests to me that _cleanup won't be called ever. But I am not
    sure since I guess I don't know if that is set all the time for
    mod_perl or something.

    Austin

  9. Re: Error: Too many connections

    On Jun 23, 7:19 am, Austin Godber wrote:
    > On Jun 20, 5:43 pm, Max Kanat-Alexander wrote:
    >
    > > On Fri, 20 Jun 2008 10:40:33 -0400 Denis Roy

    >
    > > wrote:
    > > > I'm running a vanilla BZ install (3.0.4), and I'm seeing hundreds of
    > > > sleeping connections on my master database as well ever since moving
    > > > to mod_perl.

    >
    > > Hmm, odd. What version of mod_perl are you using? It sounds
    > > like the CleanupHandler is never getting called, or something isn't
    > > working inside Bugzilla::_cleanup(), perhaps.

    >
    > > -Max
    > > --http://www.everythingsolved.com/
    > > Competent, Friendly Bugzilla and Perl Services. Everything Else, too.

    >
    > We are using mod_perl 2.0.3.
    >
    > In mod_perl.pl _cleanup seems to only be called on this line:
    > _cleanup() unless $ENV{MOD_PERL};
    >
    > which suggests to me that _cleanup won't be called ever. But I am not
    > sure since I guess I don't know if that is set all the time for
    > mod_perl or something.
    >
    > Austin


    Correction, the line
    _cleanup() unless $ENV{MOD_PERL};

    is in Bugzilla.pm rather than mod_perl.pl


  10. Re: Error: Too many connections

    On Mon, 23 Jun 2008 12:20:47 -0700 (PDT) Austin Godber
    wrote:
    > Correction, the line
    > _cleanup() unless $ENV{MOD_PERL};
    >
    > is in Bugzilla.pm rather than mod_perl.pl


    Yes, but there's a call to Bugzilla::_cleanup() in mod_perl.pl,
    in the CleanupHandler. If it's not there in yours, then it must have
    been removed manually by somebody from your installation.

    -Max
    --
    http://www.everythingsolved.com/
    Competent, Friendly Bugzilla and Perl Services. Everything Else, too.

  11. Re: Error: Too many connections

    Max Kanat-Alexander wrote:
    > On Fri, 20 Jun 2008 10:40:33 -0400 Denis Roy
    > wrote:
    >> I'm running a vanilla BZ install (3.0.4), and I'm seeing hundreds of
    >> sleeping connections on my master database as well ever since moving
    >> to mod_perl.

    >
    > Hmm, odd. What version of mod_perl are you using? It sounds
    > like the CleanupHandler is never getting called, or something isn't
    > working inside Bugzilla::_cleanup(), perhaps.
    >
    > -Max


    I found the problem.

    In CVS, mod_perl.pl with the rtag Bugzilla_Stable, BUGZILLA-3_0_4,
    BUGZILLA-3_0_3 and BUGZILLA-3_0-STABLE is 1.5.2.2, and here is the
    cleanup handler code:

    package Bugzilla::ModPerl::CleanupHandler;
    use strict;
    use Apache2::Const -compile => qw(OK);

    sub handler {
    my $r = shift;

    # Sometimes mod_perl doesn't properly call DESTROY on all
    # the objects in pnotes()
    foreach my $key (keys %{$r->pnotes}) {
    delete $r->pnotes->{$key};
    }

    return Apache2::Const::OK;
    }

    1;

    Bugzilla::_cleanup(); appears in mod_perl.pl 1.6, which is rtagged
    BUGZILLA-3_1_1 (and BUGZILLA-3_1_2).

  12. Re: Error: Too many connections

    On Tue, 24 Jun 2008 10:51:07 -0400 Denis Roy
    wrote:
    > I found the problem.
    >
    > In CVS, mod_perl.pl with the rtag Bugzilla_Stable, BUGZILLA-3_0_4,
    > BUGZILLA-3_0_3 and BUGZILLA-3_0-STABLE is 1.5.2.2, and here is the
    > cleanup handler code:
    > [snip]


    Wow, you're right!! File a bug on that and CC me!

    Turns out we only added Bugzilla::_cleanup() when we added
    transactions, because we were using Apache:BI before and didn't need
    Bugzilla::_cleanup(), but forgot to add it back in when we removed
    Apache:BI.

    -Max
    --
    http://www.everythingsolved.com/
    Competent, Friendly Bugzilla and Perl Services. Everything Else, too.

  13. Re: Error: Too many connections

    Max Kanat-Alexander wrote:
    > On Tue, 24 Jun 2008 10:51:07 -0400 Denis Roy
    > wrote:
    >> I found the problem.
    >>
    >> In CVS, mod_perl.pl with the rtag Bugzilla_Stable, BUGZILLA-3_0_4,
    >> BUGZILLA-3_0_3 and BUGZILLA-3_0-STABLE is 1.5.2.2, and here is the
    >> cleanup handler code:
    >> [snip]

    >
    > Wow, you're right!! File a bug on that and CC me!
    >
    > Turns out we only added Bugzilla::_cleanup() when we added
    > transactions, because we were using Apache:BI before and didn't need
    > Bugzilla::_cleanup(), but forgot to add it back in when we removed
    > Apache:BI.
    >
    > -Max


    https://bugzilla.mozilla.org/show_bug.cgi?id=441592 filed.

+ Reply to Thread