Statement leak detection and reclaim

Statement leak detection is a new feature to detect any statements that have not been closed by the applications for a specified time period.

Why is this important?

Applications might run out of cursors if the statement objects are not
closed and hence detecting them as leaks can help developers and
administrators to make sure that the statement objects are indeed closed after use.


How to know if there is a statement leak?

The stack trace of the caller that creates the statement is logged in the server.log when a statement leak is detected.


Enabling Statement leak detection

Statement leak timeout can be enabled by setting a connection pool configuration attribute statement-leak-timeout-in-seconds. Default value of this attribute is zero, indicating that the statement leak detection is turned off. Leak detection is enabled when set to a positive non-zero value. After this timeout, the statement object is considered to be leaked.


Enabling Statement leak reclaim

Statement leak reclaim can be enabled by setting a connection pool configuration attribute statement-leak-reclaim. By default, this attribute is set to false and the statement leak
reclaim is disabled. For statement reclaim to work, statement leak
timeout need to be enabled. Once a statement leak is detected, leaked
statement is reclaimed. During a statement reclaim, the leaked
statement(s) is closed.


Points to note



  • Connection leak timeout should be greater than the Statement leak
    timeout.

  • Statement Timeout should be lesser than the Statement leak
    timeout.

Monitoring Statement leaks
The total number of statement leaks for the jdbc connection pool at the sample time can be got using the command line interface. When monitoring is set to HIGH, this monitoring statistic is of the form

server.resources.testPool.numpotentialstatementleak-count = 6

The corresponding amx objectName for collecting this monitoring statistic programmatically is

amx:pp=/mon/server-mon[server],type=jdbcra-mon,name=resources/testPool 

Statement leak detection is done for all new connections got in an
application for an active pool. Similarly, the monitoring statistics are collected for these new connections from which statements are created.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

shalini_m

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today