> 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