Tomcat connection pool leakage: cannot get a connection, pool exhausted

Source: Internet
Author: User

Reprinted:

 

1. Problem Description
WebProgramIt was very fast at the beginning of Tomcat, but after a while it was found that the speed became very slow.
Check log output and find exceptions as follows:
Org. Apache. commons. DBCP. sqlnestedexception: cannot get a connection, pool exhausted, cause:
Java. util. nosuchelementexception: timeout waiting for idle object
At the same time, in the sqlserver event probe, it is found that each SQL statement is executed to generate an audit login event. After the statement is executed
Audit logout event. It indicates that each Tomcat Request re-opens a new connection.
2. Problem Solving
The Data Source Definition of Tomcat provides three parameters:
A. if it is set to true, Tomcat will automatically check for recovery and reuse, and there is no normally closed connection. (the default value is false)
<Parameter>
<Name> removeabandoned </Name>
<Value> true </value>
</Parameter>
B. Set the number of seconds for a connection to be considered as a dropped connection.
<Parameter>
<Name> removeabandonedtimeout </Name>
<Value> 60 </value>
</Parameter>
C. output the collected logs. You can print out the exceptions in detail to find that there is a leak.
<Parameter>
<Name> logabandoned </Name>
<Value> true </value>
</Parameter>

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.