EC locking error when allowing Finalizer thread to dispose

David Moyer <[email protected]>
Newsgroups gmane.comp.web.webobjects.wonder-disc
Message-ID <[email protected]>
Hi all

I'm getting a few of the following EC locking errors in my log:

*** EOEditingContext: access with no lock: _eoForGID()!
java.lang.Exception: Stack trace
	at java.lang.Thread.dumpStack(Thread.java:1176)
	at com.webobjects.eocontrol.LockErrorScreamerEditingContext._EOAssertSafeMultiThreadedAccess(Unknown Source)
	at com.webobjects.eocontrol.EOEditingContext._EOAssertSafeMultiThreadedReadAccess(EOEditingContext.java:5058)
	at com.webobjects.eocontrol.EOEditingContext._eoForGID(EOEditingContext.java:2632)
	at com.webobjects.eocontrol.EOEditingContext.editingContextDidForgetObjectWithGlobalID(EOEditingContext.java:3864)
	at er.extensions.eof.ERXEC.editingContextDidForgetObjectWithGlobalID(Unknown Source)
	at com.webobjects.eocontrol.EOEditingContext._processReferenceQueue(EOEditingContext.java:4764)
	at com.webobjects.eocontrol.EOEditingContext._registeredObjects(EOEditingContext.java:2316)
	at com.webobjects.eocontrol.EOEditingContext._dispose(EOEditingContext.java:1122)
	at com.webobjects.eocontrol.EOEditingContext.finalize(EOEditingContext.java:1239)
	at com.webobjects.eocontrol.LockErrorScreamerEditingContext.finalize(Unknown Source)
	at er.extensions.eof.ERXEC.finalize(Unknown Source)
	at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
	at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
	at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
	at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)


Quite often the app will deadlock shortly after this error. I've noticed the following piece of code in the _dispose() method of EOEditingContext which I think explains it:

if( !duringFinalize )
{
	lock();
}
allObjects = _registeredObjects();

So if the EC is being disposed of during a finalize, it wont lock itself before accessing its registered objects, leading to my error. This error doesn't occur if I dispose of the EC manually using dispose()
Has anyone encountered this before?

Not sure if it's relevant, but I have ERX safe locking enabled (er.extensions.ERXEC.safeLocking=true)

Thanks,
David
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.