Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PGXPool - getting consistent error "closed pool" when calling pgxpool.Exec #2238

Closed
asher-zs opened this issue Jan 23, 2025 · 2 comments
Closed
Labels

Comments

@asher-zs
Copy link

asher-zs commented Jan 23, 2025

Describe the bug
seems like at some point when I call Exec or any other pooled method, I'm getting an error of "closed pool" consistently and I have to bounce the process to cleanup the mess

To Reproduce
Its inconsistent issue and happens once in a while, seems to be related to discussion #1842
the main thing is that i have 3 concurrent go routines which use the same PgPool.

Expected behavior
Getting fresh/new connection

Actual behavior
getting consistently error of "closed pool"
( puddle ErrClosedPool , see link https://github.com/jackc/puddle/blob/master/pool.go#L23)

Version

  • Go: go version go1.23.4 darwin/arm64
  • PostgreSQL: 16.3 - AWS RDS
  • pgx: 5.6.0

Additional context

@asher-zs asher-zs added the bug label Jan 23, 2025
@asher-zs asher-zs changed the title PGXPool - getting consistent "closed pool" when calling pgxpool.Exec PGXPool - getting consistent error "closed pool" when calling pgxpool.Exec Jan 23, 2025
@jackc
Copy link
Owner

jackc commented Jan 25, 2025

I'm pretty sure this has to be an application bug. A pgxpool.Pool should never close itself. Check your code for any calls to Close(). Also, as I recommended in the other referenced discussion:

I would suggest either running it locally with a debugger and breakpoint on Pool.Close or using a forked copy of pgx with a panic in Pool.Close to see when it is being triggered.

@asher-zs
Copy link
Author

yeah, I checked the code and logs again, and seems that we Close it during shutdown, while stiull having go routines that try to get connections.
thanks.

i'm closing it, since it seems to work as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants