Oracle EXDI finalization problems with OracleLobProxy in vw 7.4.1

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Oracle EXDI finalization problems with OracleLobProxy in vw 7.4.1

Mark Plas

Hi,

 

A while ago I posted a problem on this list concerning a memory leak in the Oracle EXDI in vw7.4.1. It seemed that the cause was a #session instance variable that had been added to OracleBuffer. It resulted in the executor of an OracleSession having strong references to its ‘real’ OracleSession. That way it couldn’t get garbage collected anymore. There was an AR for it (AR #51246) and we got a patch from Cincom which I’ve attached to this mail (Resolution 90644.st). The bug got fixed by putting the reference from an OracleBuffer to its OracleSession in a WeakArray.

 

Recently we started experimenting with OracleLobProxy and have gotten into a new problem.

 

Take a clean image

File in the ‘Resolution 90644.st’ file

File in ‘Test.st’

 

Then you’ll see there’s a class called ‘Test’. If you perform the method #test_plsql_clob on it (there’s a do-it expression in the method comment), you should get a lot of exception windows popping up. I’ve added the stack traces at the end of this mail.

 

The problem seems to be this:

 

An OracleSession has a WeakDictionary called #dependentLobs which contains instances of OracleLobProxy

OracleLobProxy has a WeakArray called #session that contains a single element which is an OracleSession

When garbage collection occurs, both the OracleSession and the OracleLobProxy get gc-ed and are replaced with zeroes in their respective WeakArrays.

Then the finalization mechanism starts to run and finalizes in a random order either the OracleSession and/or the OracleLobProxy. In the finalization process they seem to both require some information of the other to properly free allocated memory. But, since the references to the other object are stored in a WeakArray/WeakDictionary, they no longer exist. They’ve become 0. The finalization code doesn’t expect this and crashes, as you can see in the stack traces below.

 

Has anyone encountered this?

 

Thanks,

Mark

 

 

Unhandled exception: Message not understood: #dependentLobs

SmallInteger(Object)>>doesNotUnderstand:

OracleLobProxy>>free

OracleLobProxy>>finalize

optimized [] in WeakDictionary>>finalizeElements

OrderedCollection>>do:

WeakDictionary>>finalizeElements

WeakDictionary>>update:with:from:

WeakArray(Object)>>changed:with:

WeakArray(Object)>>changed:

WeakArray>>mourn

optimized [] in WeakArray class>>innerFinalizationLoopWith:

BlockClosure>>on:do:

WeakArray class>>innerFinalizationLoopWith:

optimized [] in WeakArray class>>outerFinalizationLoop

BlockClosure>>on:do:

optimized [] in Process class>>forBlock:priority:

 

----------------------------------------------------------------------

 

Unhandled exception: Message not understood: #session:

SmallInteger(Object)>>doesNotUnderstand:

optimized [] in OracleSession>>releaseDependentLobs

WeakDictionary(IdentityDictionary)>>associationsDo:

optimized [] in WeakDictionary>>associationsDo:

BlockClosure>>ensure:

optimized [] in RecursionLock>>critical:

BlockClosure>>ensure:

Semaphore>>critical:

RecursionLock>>critical:

WeakDictionary>>associationsDo:

OracleSession>>releaseDependentLobs

OracleSession>>releaseBuffersAndAdaptors

OracleSession>>finalizeExternal

optimized [] in ExternalDatabaseFramework>>finalize

BlockClosure>>on:do:

OracleSession(ExternalDatabaseFramework)>>finalize

optimized [] in WeakDictionary>>finalizeElements

OrderedCollection>>do:

HandleRegistry(WeakDictionary)>>finalizeElements

HandleRegistry(WeakDictionary)>>update:with:from:

WeakArray(Object)>>changed:with:

WeakArray(Object)>>changed:

WeakArray>>mourn

optimized [] in WeakArray class>>innerFinalizationLoopWith:

BlockClosure>>on:do:

WeakArray class>>innerFinalizationLoopWith:

optimized [] in WeakArray class>>outerFinalizationLoop

BlockClosure>>on:do:

optimized [] in Process class>>forBlock:priority:

 

 


Resolution_90644.st (21K) Download Attachment
Test.st (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Oracle EXDI finalization problems with OracleLobProxy in vw 7.4.1

Alan Knight-2
Thanks. I've created AR 52185 for this.

At 09:34 AM 4/18/2007, Mark Plas wrote:
Hi,
 
A while ago I posted a problem on this list concerning a memory leak in the Oracle EXDI in vw7.4.1. It seemed that the cause was a #session instance variable that had been added to OracleBuffer. It resulted in the executor of an OracleSession having strong references to its ‘real’ OracleSession. That way it couldn’t get garbage collected anymore. There was an AR for it (AR #51246) and we got a patch from Cincom which I’ve attached to this mail (Resolution 90644.st). The bug got fixed by putting the reference from an OracleBuffer to its OracleSession in a WeakArray.
 
Recently we started experimenting with OracleLobProxy and have gotten into a new problem.
 
Take a clean image
File in the ‘Resolution 90644.st’ file
File in ‘Test.st’
 
Then you’ll see there’s a class called ‘Test’. If you perform the method #test_plsql_clob on it (there’s a do-it expression in the method comment), you should get a lot of exception windows popping up. I’ve added the stack traces at the end of this mail.
 
The problem seems to be this:
 
An OracleSession has a WeakDictionary called #dependentLobs which contains instances of OracleLobProxy
OracleLobProxy has a WeakArray called #session that contains a single element which is an OracleSession
When garbage collection occurs, both the OracleSession and the OracleLobProxy get gc-ed and are replaced with zeroes in their respective WeakArrays.
Then the finalization mechanism starts to run and finalizes in a random order either the OracleSession and/or the OracleLobProxy. In the finalization process they seem to both require some information of the other to properly free allocated memory. But, since the references to the other object are stored in a WeakArray/WeakDictionary, they no longer exist. They’ve become 0. The finalization code doesn’t expect this and crashes, as you can see in the stack traces below.
 
Has anyone encountered this?
 
Thanks,
Mark
 
 
Unhandled exception: Message not understood: #dependentLobs
SmallInteger(Object)>>doesNotUnderstand:
OracleLobProxy>>free
OracleLobProxy>>finalize
optimized [] in WeakDictionary>>finalizeElements
OrderedCollection>>do:
WeakDictionary>>finalizeElements
WeakDictionary>>update:with:from:
WeakArray(Object)>>changed:with:
WeakArray(Object)>>changed:
WeakArray>>mourn
optimized [] in WeakArray class>>innerFinalizationLoopWith:
BlockClosure>>on:do:
WeakArray class>>innerFinalizationLoopWith:
optimized [] in WeakArray class>>outerFinalizationLoop
BlockClosure>>on:do:
optimized [] in Process class>>forBlock:priority:
 
----------------------------------------------------------------------
 
Unhandled exception: Message not understood: #session:
SmallInteger(Object)>>doesNotUnderstand:
optimized [] in OracleSession>>releaseDependentLobs
WeakDictionary(IdentityDictionary)>>associationsDo:
optimized [] in WeakDictionary>>associationsDo:
BlockClosure>>ensure:
optimized [] in RecursionLock>>critical:
BlockClosure>>ensure:
Semaphore>>critical:
RecursionLock>>critical:
WeakDictionary>>associationsDo:
OracleSession>>releaseDependentLobs
OracleSession>>releaseBuffersAndAdaptors
OracleSession>>finalizeExternal
optimized [] in ExternalDatabaseFramework>>finalize
BlockClosure>>on:do:
OracleSession(ExternalDatabaseFramework)>>finalize
optimized [] in WeakDictionary>>finalizeElements
OrderedCollection>>do:
HandleRegistry(WeakDictionary)>>finalizeElements
HandleRegistry(WeakDictionary)>>update:with:from:
WeakArray(Object)>>changed:with:
WeakArray(Object)>>changed:
WeakArray>>mourn
optimized [] in WeakArray class>>innerFinalizationLoopWith:
BlockClosure>>on:do:
WeakArray class>>innerFinalizationLoopWith:
optimized [] in WeakArray class>>outerFinalizationLoop
BlockClosure>>on:do:
optimized [] in Process class>>forBlock:priority:
 
 


--
Alan Knight [|], Cincom Smalltalk Development

"The Static Typing Philosophy: Make it fast. Make it right. Make it run." - Niall Ross