DB2 - Problem description
| Problem IT07662 | Status: Closed |
CURSOR VARIABLES REFERENCED EXTERNALLY CAN CAUSE MEMORY LEAK IN THE APPLICATION HEAP. | |
| product: | |
DB2 FOR LUW / DB2FORLUW / A50 - DB2 | |
| Problem description: | |
Memory blocks in the application heap might keep growing if an
application calls a procedure which returns cursor variable(s).
The db2pd shows the following 4 kinds of memory blocks keep
increasing if users is hitting this problem.
$ db2pd -db <dbname> -memblock appl 1 sort
Memory blocks sorted by size for apph pool:
PoolID PoolName TotalSize(Bytes) TotalCount LOC File
1 apph 216000 1000 1159 1043897861
1 apph 120000 1000 11229 4262186386
1 apph 64000 1000 1216 1043897861
1 apph 24000 1000 10832 4262186386
The steps below illustrates a scenario to hit the issue.
1. Create a procedure which returns an open cursor.
db2 connect to <dbname>
db2 -td@ -vf p1.sql
----------------------------
CREATE OR REPLACE PROCEDURE PROC1(OUT CUR1 CURSOR)
MODIFIES SQL DATA
LANGUAGE SQL
BEGIN
SET CUR1 = CURSOR WITH HOLD FOR VALUES CURRENT TIMESTAMP;
OPEN CUR1;
END @
----------------------------
2. Call the procedure like as below, and keep the database
connection.
try{
cstmt = conn.prepareCall("CALL PROC1(?)");
cstmt.registerOutParameter(1, DB2Types.CURSOR);
cstmt.execute();
rs = (ResultSet)cstmt.getObject(1);
System.out.println( rs.getString(1));
} catch (Exception e){
e.printStackTrace();
} finally{
rs.close();
cstmt.close();
} | |
| Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * ALL * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * Please upgrade to DB2 V10.5 fixPack 7 or later. * **************************************************************** | |
| Local Fix: | |
Please disconnect the application from the database to free up the application heap. | |
| Solution | |
This problem was first fixed in DB2 V10.5 FixPack 7. | |
| Workaround | |
not known / see Local fix | |
| Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 12.03.2015 03.02.2016 03.02.2016 |
| Problem solved at the following versions (IBM BugInfos) | |
| Problem solved according to the fixlist(s) of the following version(s) | |
| 10.5.0.7 |
|