home clear 64x64
en blue 200x116 de orange 200x116 info letter User
suche 36x36
Latest versionsfixlist
11.1.0.7 FixList
10.5.0.9 FixList
10.1.0.6 FixList
9.8.0.5 FixList
9.7.0.11 FixList
9.5.0.10 FixList
9.1.0.12 FixList
Have problems? - contact us.
Register for free anmeldung-x26
Contact form kontakt-x26

DB2 - Problem description

Problem IT05486 Status: Closed

CURSOR VARIABLES REFERENCED EXTERNALLY CAN CAUSE MEMORY LEAK IN THE
APPLICATION HEAP.

product:
DB2 FOR LUW / DB2FORLUW / A10 - 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.1 FixPack 5 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.1 fixPack 5.
Workaround
not known / see Local fix
Timestamps
Date  - problem reported    :
Date  - problem closed      :
Date  - last modified       :
11.11.2014
15.07.2015
15.07.2015
Problem solved at the following versions (IBM BugInfos)
Problem solved according to the fixlist(s) of the following version(s)
10.1.0.5 FixList