jackc / jackc/pgx

Is pgx.pool.Acquire() multithread-ready?

Open
#1,055 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
14.3k
Forks
1.1k
Avg merge
6d 9h
Merged PRs (30d)
11

Description

During debugging I have found that one of my go-routines got sutck on `pgx.pool.Acquire()` function. The thing is, I have multiple go-routines using single pool. So, the question is, is `pgx.pool` safe against deadlocks ???

I am using the pool with `CopyFrom` and `Exec`, so, `Acquire` should release any resouces if those were allocated and free the connection. But I am seening that on request number 26 I am getting blocked inside the `pool.Acquire()` function

Contributor guide

Open the contributing guide

Research direction

Start with pgx.pool.Acquire() and reproduce the reported block using multiple goroutines sharing one pool with CopyFrom and Exec. Trace whether resources are released after those operations and determine why Acquire blocks around request 26. Done means documenting the concurrency behavior and, if confirmed, identifying the required fix or usage constraint.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.