It would appear despite the double lock for setting the observer:
<cffunction name="getAfterCreateObserverCollection" access="public" returntype="transfer.com.events.collections.AbstractBaseObserverCollection" output="false">
<cfargument name="class" hint="the class in question" type="string" required="Yes">
<cfif NOT hasAfterCreateObserverCollection(argumentCollection=arguments)>
<cflock name="transfer.facade.getAfterCreateObserverCollection.#getScopeIdentityHashCode()#" timeout="60" throwontimeout="true">
<cfif NOT hasAfterCreateObserverCollection(argumentCollection=arguments)>
<cfset setAfterCreateObserverCollection(createObservable("AfterCreateObserverCollection"), arguments.class)>
</cfif>
</cflock>
</cfif>
<cfreturn getScopePlace(argumentCollection=arguments).AfterCreateObserverCollection />
</cffunction>
That the AfterCreateObserverCollection is destroyed between the time the lock is released and the time it tries to access it?
I'm going to attempt to resolve this by returning the observer inside the lock:
<cffunction name="getAfterCreateObserverCollection" access="public" returntype="transfer.com.events.collections.AbstractBaseObserverCollection" output="false">
<cfargument name="class" hint="the class in question" type="string" required="Yes">
<cfif NOT hasAfterCreateObserverCollection(argumentCollection=arguments)>
<cflock name="transfer.facade.getAfterCreateObserverCollection.#getScopeIdentityHashCode()#" timeout="60" throwontimeout="true">
<cfif NOT hasAfterCreateObserverCollection(argumentCollection=arguments)>
<cfset setAfterCreateObserverCollection(createObservable("AfterCreateObserverCollection"), arguments.class)>
<!--- adding here because under load, we occasionally get errors between the time we release the lock and the time we run getScopePlace() at the end of the method --->
<cfreturn getScopePlace(argumentCollection=arguments).AfterCreateObserverCollection />
</cfif>
</cflock>
</cfif>
<cfreturn getScopePlace(argumentCollection=arguments).AfterCreateObserverCollection />
</cffunction>
I see the following sporadic errors (presumably under load):
The stack trace is roughly the same in AbstractBaseFacade.cfc:
It would appear despite the double lock for setting the observer:
That the AfterCreateObserverCollection is destroyed between the time the lock is released and the time it tries to access it?
I'm going to attempt to resolve this by returning the observer inside the lock: