quarkus icon indicating copy to clipboard operation
quarkus copied to clipboard

quarkus.datasource."datasource-name".jdbc.min-size not honored if max-lifetime is set

Open sschellh opened this issue 2 years ago • 6 comments

Describe the bug

If we set the parameter quarkus.datasource."datasource-name".jdbc.max-lifetime then the size of the jdbc connection pools falls below the minimum pool size.

Expected behavior

The jdbc connection pool contains at any time at least as many connections as stated in quarkus.datasource."datasource-name".jdbc.min-size

Actual behavior

If the parameter quarkus.datasource."datasource-name".jdbc.max-lifetime is set and there is no activity, then the size of the jdbc connection pool reduces to 0 after the max-lifetime has been reached.

How to Reproduce?

Step 1: Add following configuration quarkus.datasource."datasource-name".jdbc.max-lifetime=PT1M quarkus.datasource."datasource-name".jdbc.min-size=100 quarkus.datasource."datasource-name".jdbc.initial-size=100 quarkus.datasource."datasource-name".jdbc.max-size=100

Step 2: Start the application

Step 3: Verify the number of connections (for instance using the metrics endpoint q/metrics/vendor)

You will find 100 connections.

Step 4: Wait for 1 Minute Check the number of connections again. The pool is 0

sschellh avatar Sep 16 '22 10:09 sschellh

/cc @Sanne, @barreiro, @yrodiere

quarkus-bot[bot] avatar Sep 16 '22 12:09 quarkus-bot[bot]

@barreiro I suspect this is an issue with Agroal, not Quarkus.

gsmet avatar Sep 16 '22 12:09 gsmet

@barreiro any chance you can take a look at this?

geoand avatar Oct 19 '22 09:10 geoand

https://github.com/mfpc/reproducer27999

Reproducer created with @gastaldi help.

STEPS TO RUN 1 - mvn clean install 2- Wait for 1 minute the pool will be clear.

mfpc avatar Feb 10 '23 13:02 mfpc

@Sanne, @barreiro, @yrodiere any chance you look into it?

prashankjauhari avatar Apr 09 '23 17:04 prashankjauhari

@barreiro any chance you could have a look at this one? Thanks!

gsmet avatar Feb 15 '24 10:02 gsmet

@gsmet sure, I'll investigate.

barreiro avatar Feb 20 '24 01:02 barreiro

AG-197 fixed with #39072

barreiro avatar Mar 06 '24 14:03 barreiro