Skip to content

Memory Leak in Oracle LOB Reading?? [SPR-5998] #10666

Closed
@spring-projects-issues

Description

@spring-projects-issues

Mohan opened SPR-5998 and commented

As per the advise, we have carried out few testings.

Finally found that BLOB reading causes the problem (not the writing as mentioned here, that was a wrong assumption).

Oracle uses the so called 'outBuffer of oracle.jdbc.driver.T4C8TTIBlob' when we read blob data from the db, that is not cleared ever after closing the connection object.
The connection is cached by the Connection pool provider(Unable to reproduce the bug with Spring Driver manager data source, because that doesn't cache the connection object.),
so the outbuffer also stays with it. I got the same results with all the connection pool providers like DBCP,C3P0 and WebSphere.

When is it populated??


There is a call 'blob.getBytes(1, (int) blob.length())' in 'OracleLobHandler.getBlobAsBytes', which uses the outbuffer.

How to clear the buffer??


Wrapping the getBytes call with open and close methods (like blob writing) make sure the buffer is cleared once the job is done.

oracle.sql.BLOB oraBlob = (oracle.sql.BLOB)blob;
oraBlob.open(BLOB.MODE_READONLY);
data = oraBlob.getBytes(1, (int)b.length());
oraBlob.close();

I am not sure about this solution. I posted the same in Oracle forum and waiting for a reply.

More info available here, http://forums.oracle.com/forums/thread.jspa?messageID=3672154#3672154

As a temporary work around, i have overridden the 'OracleLobHandler.getBlobAsBytes' in our custom oracle lob handler class and applied these changes
in to it.

Is our understanding correct?? If correct then Should Spring OracleLobHandler be modified??


Affects: 2.5 final

Reference URL: http://forum.springsource.org/showthread.php?p=242802

Issue Links:

Referenced from: commits 5a158fb

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: dataIssues in data modules (jdbc, orm, oxm, tx)type: taskA general task

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions