When a pooled connection is closed, the actual connection should not be made available after it has been closed internally
See original GitHub issueAfter scheduled upgrade of running postgres our application came to a strange state:
every request to db throw io.vertx.core.VertxException: Connection not open CLOSED
. After manually restarting every pod of our app it healed (during startup each instance was able to connect to db as usual).
We use connection pool like that:
PgClient.pool(vertx, PgPoolOptions().apply {
database = config.database
host = config.host
port = config.port
user = config.user
password = config.password
isSsl = true
isTrustAll = true
maxSize = 10
cachePreparedStatements = true
})
Unfortunately I don’t have reproducer for this situation. Maybe you will be able to figure out the cause by stacktrace.
Pg-client version: 0.8.0 Postgres version: PostgreSQL 10.4 (Ubuntu 10.4-2.pgdg18.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0, 64-bit
Full stacktrace:
io.vertx.core.VertxException: Connection not open CLOSED
at io.reactiverse.pgclient.impl.SocketConnection.bilto(SocketConnection.java:193)
at io.reactiverse.pgclient.impl.CommandBase.foo(CommandBase.java:54)
at io.reactiverse.pgclient.impl.SocketConnection.schedule(SocketConnection.java:181)
at io.reactiverse.pgclient.impl.ConnectionPool$PooledConnection.schedule(ConnectionPool.java:81)
at io.reactiverse.pgclient.impl.PgConnectionImpl.schedule(PgConnectionImpl.java:60)
at io.reactiverse.pgclient.impl.PgClientBase.lambda$preparedQuery$0(PgClientBase.java:41)
at io.reactiverse.pgclient.impl.SocketConnection$CachedPreparedStatement.get(SocketConnection.java:112)
at io.reactiverse.pgclient.impl.PrepareStatementCommand.foo(PrepareStatementCommand.java:60)
at io.reactiverse.pgclient.impl.SocketConnection.schedule(SocketConnection.java:181)
at io.reactiverse.pgclient.impl.ConnectionPool$PooledConnection.schedule(ConnectionPool.java:81)
at io.reactiverse.pgclient.impl.PgConnectionImpl.schedule(PgConnectionImpl.java:60)
at io.reactiverse.pgclient.impl.PgConnectionImpl.lambda$schedule$0(PgConnectionImpl.java:64)
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:339)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
Issue Analytics
- State:
- Created 5 years ago
- Comments:22 (13 by maintainers)
Top Results From Across the Web
How to deal with closed connections in database pool
This article explains how to overcome the "connection is closed" error that sometimes is seen on the mule logs when connecting to a...
Read more >c# - Connection pool with possible severed connections
The connection pooler satisfies requests for connections by reallocating connections as they are released back into the pool. If the maximum ...
Read more >Handling java.sql.SQLRecoverableException: Closed ...
Because the connection is no longer in the pool and is idle until the end of the transaction, it doesn't get evaluated with...
Read more >JDBC Connection Pooling in Java Tutorial - Progress Software
The cache module returns the PooledConnection object to the cache to be reused. The application does not have access to the PooledConnection.close() method....
Read more >Troubleshooting connection pooling (J2C) problems in ... - IBM
If the application does not call close(), the connection is leaked and never returns to the free pool. Eventually, the pool might become...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mkulak can you set an exception handler to know what is happening to the connection ?
so we know the reason that force all connection to be closed.
can you also upgrade the client version to 0.9.0 ?
@AlxGDev thanks I’ve been able to reproduce and fix multiple bugs