Re: [HACKERS] pgbench stuck with 100% cpu usage - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: [HACKERS] pgbench stuck with 100% cpu usage
Date
Msg-id alpine.DEB.2.20.1709282046440.12902@lancre
Whole thread Raw
In response to [HACKERS] pgbench stuck with 100% cpu usage  (Pavan Deolasee <pavan.deolasee@gmail.com>)
Responses Re: [HACKERS] pgbench stuck with 100% cpu usage
Re: [HACKERS] pgbench stuck with 100% cpu usage
List 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.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: [HACKERS] Arrays of domains
Next
From: Andrew Dunstan
Date:
Subject: Re: [HACKERS] Domains and arrays and composites, oh my