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.

Here is a probable "fix", which does was the comment said should be done.

I could not trigger an infinite loop with various kill -9 and other quick stops. Could you try it on your side?

--
Fabien.
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index e37496c..f039413 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -2194,12 +2194,8 @@ doCustom(TState *thread, CState *st, StatsData *agg)
 				{
 					if (!sendCommand(st, command))
 					{
-						/*
-						 * Failed. Stay in CSTATE_START_COMMAND state, to
-						 * retry. ??? What the point or retrying? Should
-						 * rather abort?
-						 */
-						return;
+						commandFailed(st, "SQL command send failed");
+						st->state = CSTATE_ABORTED;
 					}
 					else
 						st->state = CSTATE_WAIT_RESULT;
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to