Re: pgbench error: (setshell) of script 0; execution of meta-command failed
Andy Fan <zhihuifan1213@163.com>
From: Andy Fan <zhihuifan1213@163.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-01-10T07:09:52Z
Lists: pgsql-hackers
Attachments
Andy Fan <zhihuifan1213@163.com> writes:
> Hi:
>
> I run into the {subject} issue with the below setup.
>
> cat foo.sql
>
> \setshell txn_mode echo ${TXN_MODE}
> \setshell speed echo ${SPEED}
> \setshell sleep_ms echo ${SLEEP_MS}
> \setshell subtxn_mode echo ${SUBTXN_MODE}
>
> select 1;
>
> $ TXN_MODE=-1 SPEED=1 SLEEP_MS=0 SUBTXN_MODE=-1 pgbench -n -ffoo.sql postgres -T5 -c4 --exit-on-abort
>
> I *randomly*(7/8) get errors like:
>
> pgbench (18devel)
> pgbench: error: client 2 aborted in command 0 (setshell) of script 0; execution of meta-command failed
> pgbench: error: Run was aborted due to an error in thread 0
I think I have figured out the issue, if you want reproduce it quicker,
you can change the '-T5' to '-T1' in the pgbench command and run many times.
Here is the patch to fix it, would someone take a look at?
pgbench: Avoid misleading error for \[set]shell when timer_exceeded.
fgets in executeMetaCommand may return NULL if it receives a signal
during the shell command is executing. Before this commit, pgbench
client raises ERROR like below.
pgbench: error: client 3 aborted in command 3 (setshell) of script 0;
execution of meta-command failed
This behavior is misleading since people may think something is
wrong. In this commit, we just ignore fgets return NULL when
timer_exceeded.
--
Best Regards
Andy Fan
Commits
-
Avoid symbol collisions between pqsignal.c and legacy-pqsignal.c.
- cfd7aadebea1 13.19 landed
- b935691b8b2f 16.7 landed
- a3b709cf73e0 15.11 landed
- a0dfeae0dc9a 17.3 landed
- 9a45a89c38f3 18.0 landed
- 02e69313ad0c 14.16 landed
-
Suppress macOS warnings about duplicate libraries in link commands.
- 06843df4abc5 17.0 cited