pgbench: make verbose error messages thread-safe - Mailing list pgsql-hackers

From Fujii Masao
Subject pgbench: make verbose error messages thread-safe
Date
Msg-id CAHGQGwER1AjGXpkKB9t9820NBhMQ_Ghv7=HsKeodUr3=SZsF4g@mail.gmail.com
Whole thread
Responses Re: pgbench: make verbose error messages thread-safe
Re: pgbench: make verbose error messages thread-safe
List 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

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Bug: Missing check_stack_depth() in GRAPH_TABLE rewriter
Next
From: Peter Eisentraut
Date:
Subject: Re: Typo fixes in Graph table files