Connection Pool creates many connection attempts if all connection attempts fail
See original GitHub issue- Driver: io.r2dbc:r2dbc-postgresql:0.8.2.RELEASE and r2dbc-pool:0.8.2.RELEASE
- Database: POSTGRES
- Java: 11
- OS: Linux
Current Behavior
Because of a Vault error, credentials generated for Postgres will be wrong. What happens is that the application will try thousands of times to reconnect to the DB, filling the DB logs. I don’t know by what component this is cause, this happened several days ago and I don’t have full logs. What I have is just this stacktrace (only for the http part):
i.r.p.ExceptionFactory$PostgresqlAuthenticationFailure: password authentication failed for user \"v-approle-readwrit-3524s732v0xv72tqv0vx-1595235650\"\n\tat i.r.p.ExceptionFactory.createException(ExceptionFactory.java:74)\n\tat i.r.p.ExceptionFactory.handleErrorResponse(ExceptionFactory.java:110)\n\tat r.c.p.FluxHandle$HandleSubscriber.onNext(FluxHandle.java:96)\n\tat r.c.p.FluxHandle$HandleConditionalSubscriber.onNext(FluxHandle.java:319)\n\tat r.c.p.FluxCreate$BufferAsyncSink.drain(FluxCreate.java:793)\n\tat r.c.p.FluxCreate$BufferAsyncSink.next(FluxCreate.java:718)\n\tat r.c.p.FluxCreate$SerializedSink.next(FluxCreate.java:153)\n\tat i.r.p.c.ReactorNettyClient$Conversation.emit(ReactorNettyClient.java:679)\n\tat i.r.p.c.ReactorNettyClient$BackendMessageSubscriber.emit(ReactorNettyClient.java:867)\n\tat i.r.p.c.ReactorNettyClient$BackendMessageSubscriber.onNext(ReactorNettyClient.java:801)\n\tat i.r.p.c.ReactorNettyClient$BackendMessageSubscriber.onNext(ReactorNettyClient.java:710)\n\tat r.c.p.FluxHandle$HandleSubscriber.onNext(FluxHandle.java:112)\n\tat r.c.p.FluxPeekFuseable$PeekConditionalSubscriber.onNext(FluxPeekFuseable.java:845)\n\tat r.c.p.FluxMap$MapConditionalSubscriber.onNext(FluxMap.java:213)\n\tat r.c.p.FluxMap$MapConditionalSubscriber.onNext(FluxMap.java:213)\n\tat r.n.c.FluxReceive.drainReceiver(FluxReceive.java:218)\n\tat r.n.c.FluxReceive.onInboundNext(FluxReceive.java:351)\n\tat r.n.c.ChannelOperations.onInboundNext(ChannelOperations.java:348)\n\tat r.n.c.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:90)\n\tat i.n.c.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)\n\tat i.n.c.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)\n\tat i.n.c.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)\n\tat i.n.h.c.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:321)\n\tat i.n.h.c.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:295)\n\tat i.n.c.AbstractChannelHandlerContext.invokeChannelRead(Abstract...
the result of continous retries was to fill up RDS instances disks with the Logs.
I had a peek in the code but can’t really find the issue, would be great to have some help.
config is:
public ConnectionFactory connectionFactory() {
var postgresqlConnectionConfiguration = getPostgresConfiguration();
var postgresqlConnectionFactory = new PostgresqlConnectionFactory(postgresqlConnectionConfiguration);
var poolFactoryConfiguration = ConnectionPoolConfiguration.builder(postgresqlConnectionFactory)
.maxIdleTime(Duration.ofMillis(1000))
.maxSize(20)
.build();
var pooledConnectionFactory = new ConnectionPool(poolFactoryConfiguration);
return pooledConnectionFactory;
}
protected PostgresqlConnectionConfiguration getPostgresConfiguration() {
return PostgresqlConnectionConfiguration.builder()
.host(dbProperties.getHost())
.port(dbProperties.getPort())
.username(dbProperties.getUsername())
.password(dbProperties.getPassword())
.database(dbProperties.getDatabase())
.build();
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
FIX: A connection failure may be reported even though the ...
The SqlClient connection pool may internally throttle the number of new connection attempts to the server. This process is intended to occur for...
Read more >What causes the error "too many simultaneous non-pooled ...
This may have occurred because of too many simultaneous non-pooled connection attempts. I have a list of database URL (hundreds) that we manage....
Read more >MySQL Error: Too many connections - Percona
MySQL uses one thread per client connection and many active threads are performance killer. Usually, a high number of concurrent connections ...
Read more >What is Connection Pooling, and Why Should You Care
Database connection pooling is a way to reduce the cost of opening and closing connections by maintaining a “pool” of open connections that...
Read more >Improve database performance with connection pooling
We can resolve this problem by pooling connections from clients. Instead of creating a new connection with every request, connection poolers ...
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
I’d close this ticket now unless there’s an objection to keeping it open.
I think your analysis is correct @mp911de. the pool tries to enforce the minimum size by warming up each time there is an attempt at acquiring which detects the pool is undersized.