Recently received an urgent work, with 5 days to do a website.
Due to tight time, a lot of work too late to do more fine, the main function of a hurry to finish the line. Because there is no time to do more testing, so the heart can not help but have some worry about the website system. The results of the Web site is less than half a day, the most worrying thing still happened-the system hangs, the problem is not connected.
The error in the background report is:
Cannot get a connection, pool error Timeout waiting for idle object
Timeout Waiting for idle object
Obviously, the connection pool overflowed. Because the system has been officially online, to check the program where the connection is not in time to close may be too late, there is no simple way to do it.
So I checked the internet, and sure enough.
is a word removeabandoned= "true" removeabandonedtimeout= "logabandoned=" true "
Add this sentence to the resource configuration.
<resource name= "Datasourcejndi" auth= "Container"
Type= "Javax.sql.DataSource"
Password= "11111111"
Username= "SA"
Driverclassname= "Net.sourceforge.jtds.jdbc.Driver"
Url= "Jdbc:jtds:sqlserver://127.0.0.1:1433;databasename=web" maxactive= "maxidle=" maxWait= "5000" Removeabandoned= "true" removeabandonedtimeout= "a" logabandoned= "true"/>
This means that when the connection in the connection pool reaches 500 of the maximum number of connections, the connection that is idle for 60 seconds without proper shutdown is automatically recycled and information about the reclaimed connection is exported to the console.
Is that the case? First Test:
First of all, "maxactive=" maxidle= "30" change a little bit, maxactive= "ten" maxidle= "5"
Second, write a small program, this program to get connected does not normally shut down.
The test results are predictable: the console outputs a large number of hints when it takes up about 10 connections. The information indicates where the connection is not closed, and the test page is displayed normally.
OK, first of all, the next step to take time to test the system in detail.