Hi Chuck,
Once you said it was transactional I suspected something was getting EOF in this state and I discovered an exception that once I took care of it seems to have taken care of this one as well.
I did not go into enough detail to fully understand the dynamics of what was going on though. We have a transaction extender attached to the main editing context which prevents EOF from committing the transaction. For example, we do this to generate a SELECT FOR UPDATE NOWAIT to lock a record and hold on to that lock until we do saveChanges() on that editing context which commits the transaction. While we are holding this lock we local instance EOs into a peer editing context. We do a lot of processing with our EOs in this peer editing context but changes here are not supposed to be saved to the database. However, some piece of code was trying to saveChanges() and generated an EOF error about unable to increment snapshot count. I simply corrected this code so it does not call saveChanges() in this editing context and the other problem magically went away.
Thanks for the help.
On Sep 20, 2016, at 8:35 PM, Chuck Hill < email@hidden> wrote:
Does this only happen sometimes? “the databaseContext's active editingContext” is referring to the active EC, which is transactional (e.g. set at the start of an EOF operation and cleared at the end). If the code is calling into EOF without locking, it might result in this. I followed the steps of the code and I noticed that the object containing the to-many relationship in question is being local instanced in a peer editing context. The to-many is still an array fault which has not been triggered. Then when the object in the original context has its to-many triggered, i.e. by calling: analysis.groupings().count(); Where analysis is the EO and groupings() is the to-many then the exception is generated. It appears to have that if I trigger the to-many early on then the exception is avoided. Anyways, I will experiment a little bit more with the problem and report back. I don't recall seeing something like this before and I local instance objects from one editing context to another all the time. On Sep 20, 2016, at 5:21 PM, Chuck Hill <email@hidden> wrote:
A full stack track would help. It sounds like your code is making a relationship between objects in different editing contexts. Did someone forget to add a “localInstance”? All of a sudden one of our apps started getting this. Does anybody know why this would happen? It did not seem to have a problem before until now. Cannot obtain globalId for an object which is registered in an other than the databaseContext's active editingContext, object: <UBAnalysis pk:"84106">, databaseContext: com.webobjects.eoaccess.EODatabaseContext@3935ae60, object's editingContext: er.extensions.eof.ERXEC@4247ac26, databaseContext's active editingContext: er.extensions.eof.ERXEC@c0fc23d’
|