pgbench: make verbose error messages thread-safe
Fujii Masao <masao.fujii@gmail.com>
From: Fujii Masao <masao.fujii@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-24T06:26:03Z
Lists: pgsql-hackers
Attachments
- v1-0001-pg15-pgbench-fix-verbose-error-message-corruption-with.txt (text/plain)
- v1-0001-pgbench-fix-verbose-error-message-corruption-with.patch (application/octet-stream) patch v1-0001
Hi, While running pgbench with multiple threads and --verbose-errors, I found that some verbose error messages were corrupted. This issue happens because printVerboseErrorMessages() uses a function-local static PQExpBuffer for building those messages. Since that buffer is shared across threads, it is not thread-safe. Attached patch fixes this issue by changing printVerboseErrorMessages() to use a local PQExpBufferData instead of a static one. Thoughts? Since this issue was introduced in v15, the patch should be backpatched to v15 if accepted. Regards, -- Fujii Masao
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
pgbench: fix verbose error message corruption with multiple threads
- f18fcd9a450b 15 (unreleased) landed
- 6432a4cd68a3 16 (unreleased) landed
- 52b3e7001cb3 17 (unreleased) landed
- 98dd6c204696 18 (unreleased) landed
- 61f8a85a577f 19 (unreleased) landed