spring-projects / spring-boot

Spring Boot
https://spring.io/projects/spring-boot
Apache License 2.0
74.56k stars 40.55k forks source link

about the default pool settings #34845

Closed lmx1989219 closed 1 year ago

lmx1989219 commented 1 year ago

hi,recently i found our application appear “the mongo client connect will be closed” alarm and lead crud operation error. so i check the pool settings and found no customize setting but use the default pool settings. the follow code :

public static final class Builder {
        private List<ConnectionPoolListener> connectionPoolListeners = new ArrayList<ConnectionPoolListener>();
        private int maxSize = 100;
        private int minSize;
        private int maxWaitQueueSize = 500;
        private long maxWaitTimeMS = 1000 * 60 * 2;
        private long maxConnectionLifeTimeMS;
        private long maxConnectionIdleTimeMS;
        private long maintenanceInitialDelayMS;
        private long maintenanceFrequencyMS = MILLISECONDS.convert(1, MINUTES);

        Builder() {
        }

maxConnectionLifeTimeMS and maxConnectionIdleTimeMS default=0 ,A zero value indicates no limit to the life time i guess that once the connect is bad the pool did not destroy it ,so appear the above problem. whether set a reasonable none zero value is a good idea? thanks.

snicoll commented 1 year ago

whether set a reasonable none zero value is a good idea?

I don't know but that code is from MongoDB so that's a question you should be asking them. I am going to close this now but we can reopen if it turns out some work in Spring Boot is necessary.

lmx1989219 commented 1 year ago

whether set a reasonable none zero value is a good idea?

I don't know but that code is from MongoDB so that's a question you should be asking them. I am going to close this now but we can reopen if it turns out some work in Spring Boot is necessary.

thanks for your help