Re: pgbench stuck with 100% cpu usage

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Subject: Re: pgbench stuck with 100% cpu usage
Date: 2017-09-28 18:52:45
Message-ID: alpine.DEB.2.20.1709282046440.12902@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> While running some tests, I encountered a situation where pgbench gets
> stuck in an infinite loop, consuming 100% cpu. The setup was:
>
> - Start postgres server from the master branch
> - Initialise pgbench
> - Run pgbench -c 10 -T 100
> - Stop postgres with -m immediate

That is a strange test to run, but it would be better if the behavior was
not that one.

> Now it seems that pgbench gets stuck and it's state machine does not
> advance. Attaching it to debugger, I saw that one of the clients remain
> stuck in this loop forever.
>
> if (!sendCommand(st, command))
> {
> /*
> * Failed. Stay in CSTATE_START_COMMAND state, to
> * retry. ??? What the point or retrying? Should
> * rather abort?
> */

As the comments indicate and your situation shows, probably stopping the
client would be a better much option when send fails, instead of
retrying... indefinitely.

> The commit that introduced this code is 12788ae49e1933f463bc. So I amn
> copying Heikki.

AFAICR the commit was mostly a heavy restructuring of previous
unmaintainable spaghetti code. I'm not sure the problem was not there
before under one form or another.

I agree that it should error out & stop the client in this case at least.

--
Fabien.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2017-09-28 18:58:00 Re: Domains and arrays and composites, oh my
Previous Message Andrew Dunstan 2017-09-28 18:45:44 Re: Arrays of domains