Make pgbench exit on SIGINT more reliably - Mailing list pgsql-hackers

From Tristan Partin
Subject Make pgbench exit on SIGINT more reliably
Date
Msg-id CSSWBAX56CVY.291H6ZNNHK7EO@c3po
Whole thread Raw
Responses Re: Make pgbench exit on SIGINT more reliably
Re: Make pgbench exit on SIGINT more reliably
List pgsql-hackers
Hello,

The way that pgbench handled SIGINT changed in
1d468b9ad81b9139b4a0b16b416c3597925af4b0. Unfortunately this had a
couple of unintended consequences, at least from what I can tell[1].

- CTRL-C no longer stops the program unless the right point in pgbench
  execution is hit
- pgbench no longer exits with a non-zero exit code

An easy reproduction of these problems is to run with a large scale
factor like: pgbench -i -s 500000. Then try to CTRL-C the program.

The attached set of patches fixes this problem by allowing callers of
setup_cancel_handler() to attach a post-PQcancel callback. In this case,
we just call _exit(2). In addition, I noticed that psql had an EXIT_USER
constant, so I moved the common exit codes from src/bin/psql/settings.h
to src/include/fe_utils/exit_codes.h and made pgbench exit with
EXIT_USER.

[1]: https://www.postgresql.org/message-id/alpine.DEB.2.21.1910311939430.27369@lancre
--
Tristan Partin
Neon (https://neon.tech)

Attachment

pgsql-hackers by date:

Previous
From: Aleksander Alekseev
Date:
Subject: Re: "38.10.10. Shared Memory and LWLocks" may require a clarification
Next
From: Abhijit Menon-Sen
Date:
Subject: Re: Naming of gss_accept_deleg