Re: [JDBC] Could pgsql jdbc support pool reauthentication? - Mailing list pgsql-jdbc

From Vladimir Sitnikov
Subject Re: [JDBC] Could pgsql jdbc support pool reauthentication?
Date
Msg-id CAB=Je-F1rFGM+-DFHgGWdBxQ_R3=Ptqf9iUyEBndE3pDiYGyaA@mail.gmail.com
Whole thread Raw
In response to Re: [JDBC] Could pgsql jdbc support pool reauthentication?  (Achilleas Mantzios <achill@matrix.gatewaynet.com>)
Responses Re: [JDBC] Could pgsql jdbc support pool reauthentication?
List pgsql-jdbc
Achilleas>I know, but we still risk having our max_connections exceeded.

You should limit the work at thread pool level, not at connection pool level.
That is you should not accept new tasks for execution if they might block on a "getConnection" call.

Imagine a case:
1) Thread A starts a transaction, it calls the DB
2) Thread B starts processing another request, it locks some Java lock and calls .getConnection. Unfortunately, there's not enough connections, sot it just waits.
3) Thread A completes the DB call, it continues and tries to take the same Java lock.

Now we have a deadlock: A is waiting for the Java lock and it holds a DB connection (with uncommitted transaction), while B is holding a Java lock and it is trying to get a connection.

That is, it is not connection pool's task to limit the number of concurrent requests.

Achilleas>And this is not scaleable.

Can you elaborate?

Vladimir

pgsql-jdbc by date:

Previous
From: Achilleas Mantzios
Date:
Subject: Re: [JDBC] Could pgsql jdbc support pool reauthentication?
Next
From: Achilleas Mantzios
Date:
Subject: Re: [JDBC] Could pgsql jdbc support pool reauthentication?