| From: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | pgbench: make verbose error messages thread-safe |
| Date: | 2026-04-24 06:26:03 |
| Message-ID: | CAHGQGwER1AjGXpkKB9t9820NBhMQ_Ghv7=HsKeodUr3=SZsF4g@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-pg15-pgbench-fix-verbose-error-message-corruption-with.txt | text/plain | 2.5 KB |
| v1-0001-pgbench-fix-verbose-error-message-corruption-with.patch | application/octet-stream | 2.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2026-04-24 06:32:36 | Re: Typo fixes in Graph table files |
| Previous Message | Peter Eisentraut | 2026-04-24 06:24:13 | Re: Bug: Missing check_stack_depth() in GRAPH_TABLE rewriter |