Hi!

I have seen this behavior when I screwed up some locking stuff. Make sure:

1) All the contexts you are working with are locked, and locked by the proper thread.

2) Never, ever, share contexts between sessions. It might appear it's working fine. Well, it's not. It will fail. Really.

3) If you are doing low level stuff on the database context (like pre-fetching batch relationships, etc) make sure you lock the database context. All sorts of bad things will happen if you don't.

4) If you are using Wonder (and I see you are) make sure you follow all the rules, namely all your ECs are created using ERXEC.newEditingContext() instead of new EOEditingContext() and your app and sessions inherit from the ER classes.

  Good luck!

  Yours

Miguel Arroz

On 2009/02/18, at 22:19, Bill Gallop wrote:

Hello all,

We're seeing this really weird behaviour in our applications from time to time. At this point, we haven't found any way to reproduce it - it's intermittent, but when it happens, fetches from/saves to the database all bail and the application needs to be restarted. Our suspicion is some sort of a race condition, but from what I can see from poking around inside EOF this stuff is supposed to be single threaded. What's strange is that all of the objects involved are in the _same_ editing context.

This is a Wonder-ized application running as a servlet with concurrent request handling and auto-locking turned on.

[2/18/09 9:22:30:975 MST] 0000008d SystemOut O 3251000 [WebContainer : 5] INFO er.transaction.adaptor.Exceptions - Database Exception occured: java.lang.IllegalStateException: Cannot obtain globalId for an object which is registered in an other than the databaseContext's active editingContext, object: <com.xyz.zzyz.model.Page pk:"1">, databaseContext: er.extensions.eof.erxdatabasecont...@20212021, object's editingContext: er.extensions.eof.er...@77317731, databaseContext's active editingContext: er.extensions.eof.er...@62d162d1 [2/18/09 9:22:30:975 MST] 0000008d SystemOut O [2009-2-18 9:22:30 MST] <WebContainer : 5> Commit failed on data source of type class er.extensions.eof.ERXDatabaseContext [2/18/09 9:22:30:976 MST] 0000008d SystemOut O [2009-2-18 9:22:30 MST] <WebContainer : 5> java.lang.IllegalStateException: Cannot obtain globalId for an object which is registered in an other than the databaseContext's active editingContext, object: <com.xyz.zzyz.model.Page pk:"1">, databaseContext: er.extensions.eof.erxdatabasecont...@20212021, object's editingContext:er.extensions.eof.er...@77317731, databaseContext's active editingContext: er.extensions.eof.er...@62d162d1 at com .webobjects .eoaccess .EODatabaseContext._globalIDForObject(EODatabaseContext.java:4660) at com .webobjects .eoaccess .EODatabaseContext.databaseOperationForObject(EODatabaseContext.java: 4767) at com .webobjects .eoaccess.EODatabaseContext.valuesForKeys(EODatabaseContext.java:6535) at com .webobjects .eocontrol .EOObjectStoreCoordinator .valuesForKeys(EOObjectStoreCoordinator.java:326) at com.webobjects.eoaccess.EOQualifierSQLGeneration $ _KeyValueQualifierSupport .schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java:439) at er.extensions.ERXExtensions $ KeyValueQualifierSQLGenerationSupport .schemaBasedQualifierWithRootEntity(ERXExtensions.java:305) at com.webobjects.eoaccess.EOQualifierSQLGeneration $ Support ._schemaBasedQualifierWithRootEntity(EOQualifierSQLGeneration.java: 179) at com .webobjects .eoaccess .EODatabaseChannel .selectObjectsWithFetchSpecification(EODatabaseChannel.java:227) at com .webobjects .eoaccess .EODatabaseContext ._objectsWithFetchSpecificationEditingContext(EODatabaseContext.java: 3055) at er .extensions .eof .ERXDatabaseContext ._objectsWithFetchSpecificationEditingContext (ERXDatabaseContext.java:57) at com .webobjects .eoaccess .EODatabaseContext .objectsWithFetchSpecification(EODatabaseContext.java:3195) at com .webobjects .eocontrol .EOObjectStoreCoordinator .objectsWithFetchSpecification(EOObjectStoreCoordinator.java:488) at com .webobjects .eocontrol .EOEditingContext .objectsWithFetchSpecification(EOEditingContext.java:4069) at er.extensions.eof.ERXEC.objectsWithFetchSpecification(ERXEC.java:1114) at com .webobjects .eoaccess .EODatabaseContext.objectsForSourceGlobalID(EODatabaseContext.java: 4084) at er .extensions .eof .ERXDatabaseContext.objectsForSourceGlobalID(ERXDatabaseContext.java: 40) at com .webobjects .eocontrol .EOObjectStoreCoordinator .objectsForSourceGlobalID(EOObjectStoreCoordinator.java:634) at com .webobjects .eocontrol .EOEditingContext.objectsForSourceGlobalID(EOEditingContext.java:3923) at er.extensions.eof.ERXEC.objectsForSourceGlobalID(ERXEC.java: 1070) at com .webobjects .eoaccess.EODatabaseContext._fireArrayFault(EODatabaseContext.java: 4245) at com .webobjects .eoaccess .EOAccessArrayFaultHandler .completeInitializationOfObject(EOAccessArrayFaultHandler.java:77) at com .webobjects .eocontrol ._EOCheapCopyMutableArray.willRead(_EOCheapCopyMutableArray.java:45) at com .webobjects .eocontrol ._EOCheapCopyMutableArray.count(_EOCheapCopyMutableArray.java:103) at com.webobjects.foundation.NSArray.containsObject(NSArray.java:666) at com .webobjects .eocontrol .EOCustomObject.includeObjectIntoPropertyWithKey(EOCustomObject.java: 904) at er .extensions .eof .ERXGenericRecord .includeObjectIntoPropertyWithKey(ERXGenericRecord.java:1192) at com.xyz.zzyz.model._Page.addToClientPageCompletes(_Page.java:130)
      at sun.reflect.GeneratedMethodAccessor783.invoke(Unknown Source)
at sun .reflect .DelegatingMethodAccessorImpl .invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:618)
at com .webobjects.foundation.NSSelector._safeInvokeMethod(NSSelector.java: 122) at com .webobjects .eocontrol .EOCustomObject.addObjectToPropertyWithKey(EOCustomObject.java:940) at com .webobjects .eocontrol.EOEditingContext._mergeValueForKey(EOEditingContext.java: 660) at com .webobjects .eocontrol .EOEditingContext._mergeObjectWithChanges(EOEditingContext.java:3457) at com .webobjects .eocontrol .EOEditingContext._processObjectStoreChanges(EOEditingContext.java: 3546)
      at sun.reflect.GeneratedMethodAccessor219.invoke(Unknown Source)
at sun .reflect .DelegatingMethodAccessorImpl .invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:618)
at com.webobjects.foundation.NSSelector.invoke(NSSelector.java: 358) at com .webobjects .foundation.NSSelector._safeInvokeSelector(NSSelector.java:110) at com .webobjects .eocontrol .EOEditingContext._processNotificationQueue(EOEditingContext.java: 4741) at com.webobjects.eocontrol.EOEditingContext.lock(EOEditingContext.java: 4620)
      at er.extensions.eof.ERXEC.lock(ERXEC.java:480)
at com .webobjects.eocontrol.EOEditingContext.tryLock(EOEditingContext.java: 4632) at com .webobjects .eocontrol .EOEditingContext._sendOrEnqueueNotification(EOEditingContext.java: 4705) at com .webobjects .eocontrol.EOEditingContext._globalIDChanged(EOEditingContext.java: 2038)
      at sun.reflect.GeneratedMethodAccessor292.invoke(Unknown Source)
at sun .reflect .DelegatingMethodAccessorImpl .invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:618)
at com .webobjects.foundation.NSSelector._safeInvokeMethod(NSSelector.java: 122) at com.webobjects.foundation.NSNotificationCenter $_Entry.invokeMethod(NSNotificationCenter.java:588) at com .webobjects .foundation .NSNotificationCenter.postNotification(NSNotificationCenter.java:532) at com .webobjects .foundation .NSNotificationCenter.postNotification(NSNotificationCenter.java:562) at com .webobjects .eocontrol .EOObjectStoreCoordinator ._globalIDsChangedInSubStore(EOObjectStoreCoordinator.java:698)
      at sun.reflect.GeneratedMethodAccessor618.invoke(Unknown Source)
at sun .reflect .DelegatingMethodAccessorImpl .invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:618)
at com .webobjects.foundation.NSSelector._safeInvokeMethod(NSSelector.java: 122) at com.webobjects.foundation.NSNotificationCenter $_Entry.invokeMethod(NSNotificationCenter.java:588) at com .webobjects .foundation .NSNotificationCenter.postNotification(NSNotificationCenter.java:532) at com .webobjects .foundation .NSNotificationCenter.postNotification(NSNotificationCenter.java:562) at com .webobjects .eoaccess.EODatabaseContext.commitChanges(EODatabaseContext.java:6377) at com .webobjects .eocontrol .EOObjectStoreCoordinator .saveChangesInEditingContext(EOObjectStoreCoordinator.java:386) at com .webobjects .eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3192)
      at er.extensions.eof.ERXEC._saveChanges(ERXEC.java:981)
      at er.extensions.eof.ERXEC.saveChanges(ERXEC.java:903)
...

cheers

Bill


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/arroz%40guiamac.com

This email sent to [email protected]

...........................
http://www.survs.com

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to