Re: Pg stuck at 100% cpu, for multiple days

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Hubert Lubaczewski <depesz(at)depesz(dot)com>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, pgsql-hackers mailing list <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Pg stuck at 100% cpu, for multiple days
Date: 2021-08-31 10:30:14
Message-ID: CAA4eK1+6J6+hWCkbVfRe2VoN4L9rOnd0Jfb57r67WD-ApbfMGA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 31, 2021 at 11:41 AM hubert depesz lubaczewski
<depesz(at)depesz(dot)com> wrote:
>
> On Mon, Aug 30, 2021 at 09:09:20PM +0200, Laurenz Albe wrote:
> > On Mon, 2021-08-30 at 17:18 +0200, hubert depesz lubaczewski wrote:
> > > The thing is - I can't close it with pg_terminate_backend(), and I'd
> > > rather not kill -9, as it will, I think, close all other connections,
> > > and this is prod server.
> >
> > Of course the cause should be fixed, but to serve your immediate need:
> >
> > After calling pg_terminate_backend(), you can attach gdb to the backend and then run
> >
> > print ProcessInterrupts()
> >
> > That will cause the backend to exit normally without crashing the server.
>
> I got this mail too late, and the decision was made to restart Pg. After
> restart all cleaned up nicely.
>
> So, while I can't help more with diagnosing the problem, I think it
> might be good to try to figure out what could have happened.
>

One possibility could be there are quite a few DDLs happening in this
application at some particular point in time which can lead to high
CPU usage. Prior to commit d7eb52d718 in PG-14, we use to execute all
invalidations at each command end during logical decoding which might
lead to such behavior temporarily. I think a bit of debugging when it
shows this symptom could help us to identify if it is the problem I am
speculating here.

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-08-31 10:57:16 Re: Added schema level support for publication.
Previous Message Dagfinn Ilmari Mannsåker 2021-08-31 09:55:59 Re: perlcritic: prohibit map and grep in void conext