Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

connection pooling What are removeAbandoned?

What are abandoned connections? What will happen if I will set removeAbandoned = false?

Thank You!

like image 496
firstontheworld Avatar asked Mar 06 '17 21:03

firstontheworld


1 Answers

Abandoned connections are the connection used by application to do some task but application missed to close them or there was some exception in the process that they weren't closed.

Setting removeAbandoned = false might result in out of connections error because there are so many connections in abandoned state then your application will run out of connection. There won't be any connection available to perform the task.

Setting removeAbandoned = true will close the connection after the time limit set for removeAbandonedTimeout.

This issue arises because of connection leaks in the application.

As per Tomcat page:

(boolean) Flag to remove abandoned connections if they exceed the removeAbandonedTimeout. If set to true a connection is considered abandoned and eligible for removal if it has been in use longer than the removeAbandonedTimeout Setting this to true can recover db connections from applications that fail to close a connection. See also logAbandoned The default value is false.

like image 185
Atul Avatar answered Sep 21 '22 12:09

Atul