Bug 115

Summary: ensure PostgreSQL client code is thread safe
Product: repro Reporter: Daniel Pocock <daniel>
Component: proxyAssignee: Owner of all unassigned bugs <unassigned>
Status: NEW ---    
Severity: major    
Priority: P1    
Version: unspecified   
Hardware: All   
OS: All   

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.