Bug 115 - ensure PostgreSQL client code is thread safe
Summary: ensure PostgreSQL client code is thread safe
Status: NEW
Alias: None
Product: reSIProcate
Classification: Unclassified
Component: repro (core) (show other bugs)
Version: unspecified
Hardware: All All
: P1 major
Assignee: Owner of all unassigned bugs
Depends on:
Reported: 2015-11-18 10:49 CST by Daniel Pocock
Modified: 2021-04-09 02:37 CDT (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Pocock 2015-11-18 10:49:24 CST

"One thread restriction is that no two threads attempt to manipulate the same PGconn object at the same time. In particular, you cannot issue concurrent commands from different threads through the same connection object. (If you need to run concurrent commands, use multiple connections.)"

Need to either create a different connection in each thread, maybe using a thread local variable to encapsulate it.

As a workaround, users can set

  NumAuthGrabberWorkerThreads = 1

in repro.config

"PGresult objects are normally read-only after creation, and so can be passed around freely between threads. However, if you use any of the PGresult-modifying functions described in Section 31.11 or Section 31.13, it's up to you to avoid concurrent operations on the same PGresult, too."

I don't think that means anything for us because the PGresult objects are processed and released within the worker thread.