|
|
|
Forum Member
      
Group: Forum Members
Last Login: Today @ 11:59:26
Posts: 34,
Visits: 919
|
|
Hello,
A few clients reported a strange problem when an OCL query like this (Eco 4):
Ocl.Evaluate("HumanClientsRole.allInstances.AllObjects")
fails randomly on program startup with an exception "System.InvalidOperationException - Can only end subscription for active context". In all other places this query works fine. 'AllObjects' is a derived association.
Below is a stack trace:
Eco.Services.Impl.AutoSubscriptionServiceImpl EndSubscribe(AutoSubscriptionContextImpl context)
Eco.Services.Impl.AutoSubscriptionContextImpl Dispose()
Eco.Internal.TBoldOclService BaseEvaluateAndSubscribe(IElement root, IClassifier Context, IExternalVariableList vars, String expression, ISubscriber reevaluateSubscriber, ISubscriber resubscribeSubscriber)
Eco.Internal.TBoldOclService EvaluateAndSubscribe(IElement root, String expression, ISubscriber reevaluateSubscriber, ISubscriber resubscribeSubscriber)
Eco.Framework.OclDerivedMember DoDeriveAndSubscribe(Boolean subscribe)
Eco.Support.Deriver.AbstractDeriver set_DeriverState(State value)
Eco.Support.Deriver.AbstractDeriver Derive()
Eco.Support.Deriver.AbstractDeriver EnsureCurrent()
Eco.Framework.DerivedMember get_Value()
Eco.Framework.DerivedMemberManager GetMemberValue(IProperty prop)
Eco.Internal.DerivedMemberFrontsidePolicy GetDerivedValue(Locator locator)
Eco.Internal.FrontsideDerivedMultilinkAdapter`1 get_Count()
Eco.ObjectImplementation.ObjectListAdapter get_Count()
If you have any ideas how to fix this, please share.
Regards,
Dmitry
|
|
|
|
|
Supreme Being
      
Group: Administrators
Last Login: 2010-07-21 00:21:24
Posts: 1 228,
Visits: 1 373
|
|
Random bugs, my absolute favourite 
It looks like an autosubscribe block has been lost somewhere, but without a reproducible case, it is hard to tell. If this is the case, it still sounds odd that it shouldn't behave the same all the time...
/Jonas Hogstrom [CapableObjects]
|
|
|
|
|
Forum Member
      
Group: Forum Members
Last Login: Today @ 11:59:26
Posts: 34,
Visits: 919
|
|
Can this bug be avoided by switching from a derived association to another method of fetching required objects?
Regards,
Dmitry
|
|
|
|
|
Forum Member
      
Group: Forum Members
Last Login: Today @ 11:59:26
Posts: 34,
Visits: 919
|
|
I suddenly got the same problem in a completely different place with this call stack:
Eco.Services.Impl.AutoSubscriptionServiceImpl|EndSubscribe(AutoSubscriptionContextImpl context) Eco.Services.Impl.AutoSubscriptionContextImpl|Dispose() Eco.Internal.DefaultFrontsideLocator |InvokeQuery(IMethod method, IElement[] parameters, ISubscriber reevaluateSubscriber, ISubscriber resubscribeSubscriber) Eco.Ocl.Support.OclMethodBase |Evaluate(IOclOperationParameters oclParameters) Eco.Internal.TBoldOclEvaluatorVisitor |VisitTBoldOclOperation(TBoldOclOperation N) Eco.Internal.TBoldOclOperation |AcceptVisitor(TBoldOclVisitor V) Eco.Internal.TBoldOcl |InternalEvaluate(String Ocl, IElement RootElement, IClassifier Context, SubscriberPair SubscriberBlock, IExternalVariableList VariableList)
Eco.Internal.TBoldOclService |BaseEvaluateAndSubscribe(IElement root, IClassifier Context, IExternalVariableList vars, String expression, ISubscriber reevaluateSubscriber, ISubscriber resubscribeSubscriber)|859[0] |
Eco.Internal.TBoldOclService |EvaluateAndSubscribe(IElement root, String expression, ISubscriber reevaluateSubscriber, ISubscriber resubscribeSubscriber) Eco.Framework.OclDerivedMember |DoDeriveAndSubscribe(Boolean subscribe) Eco.Support.Deriver.AbstractDeriver |set_DeriverState(State value) Eco.Support.Deriver.AbstractDeriver |Derive() Eco.Support.Deriver.AbstractDeriver |EnsureCurrent() Eco.Framework.DerivedMember |get_Value() Eco.Framework.DerivedMemberManager |GetMemberValue(IProperty prop) Eco.Internal.DerivedMemberFrontsidePolicy |GetDerivedValue(Locator locator) Eco.Internal.DerivedMemberFrontsidePolicy |RetrieveMemberValue(Locator locator) Eco.Internal.TBoldMemberPropertyAdapter |GetAsObject() Eco.Internal.TBoldMemberPropertyAdapter |get_AsObject() Eco.Internal.TBoldAttributePropertyAdapter |get_AsObject() Eco.Framework.OclDerivedMember |DoDeriveAndSubscribe(Boolean subscribe) Eco.Support.Deriver.AbstractDeriver |set_DeriverState(State value) Eco.Support.Deriver.AbstractDeriver |Derive() Eco.Support.Deriver.AbstractDeriver |EnsureCurrent() Eco.Framework.DerivedMember |get_Value() Eco.Framework.DerivedMemberManager |GetMemberValue(IProperty prop) Eco.Internal.DerivedMemberFrontsidePolicy |GetDerivedValue(Locator locator) Eco.Internal.DerivedMemberFrontsidePolicy |RetrieveMemberValue(Locator locator) Eco.Internal.DefaultFrontsideLocator |get_MemberByIndex(Int32 index)
This time it happened on calculating a simple derived (r/o) attribute through OCL.
This problem really becomes a showstopper... We cannot deliver to our clients an application which fails once every 5 or 10 runs...
Regards,
Dmitry
|
|
|
|
|
Supreme Being
      
Group: Administrators
Last Login: 2010-07-21 00:21:24
Posts: 1 228,
Visits: 1 373
|
|
It sounds like there is some bug in the autosubscription mechanism that leaves an unterminated undoblock that causes problems later on. Do you use the AutoSubscriptionService anywhere in your own code?
If you are, you need to make sure that you use the following pattern:
using (AutoSubscriptionService.StartSubscribe(aSubscriber))
{
// do your stuff
}
this ensures that the result from the StartSubscribe-method is properly disposed and that will terminate the autosubscription.
I double checked the code in ECO4 and ECO5 and as far as I can see, the calls in the ECO source are all correct.
Do you get any exceptions in your app prior to this exception?
/Jonas Hogstrom [CapableObjects]
|
|
|
|
|
Forum Member
      
Group: Forum Members
Last Login: Today @ 11:59:26
Posts: 34,
Visits: 919
|
|
Hello,
We are not using the AutoSubscriptionService anywhere explicitly. Though for the last report I should tell that what was causing this exception was a typo in OCL expression in the derived attribute which led to self-recurrence. Regarding the first problem, though, there is nothing new - it usually works in that place (FormLoad event of the main form), and always works in other places. What we did, though, is we changed the line from
Ocl.Evaluate(...).GetAsIList
to merely Ocl.Evaluate. After that we did not (yet) observe any problems.
Regards,
Dmitry
|
|
|
|
|
Supreme Being
      
Group: Administrators
Last Login: 2010-07-21 00:21:24
Posts: 1 228,
Visits: 1 373
|
|
Recursively calculated derived attributes can probably lead to stack overflows, and that has a nasty habit of showing up with all kinds of weird sideeffects. In ECO5, we detect recursively derived attributes and throw an exception directly.
It is strange that this error is so intermittent, I would have expected it to occur always or never. I'm sure there is a perfectly good explanation for this once we figure it out, but until then... Without a sample project that shows the problem, I'm afraid there is not much more I can do. I have checked the ECO code for incorrect usages of the autosubscription service, and there was none (that I could find)
/Jonas Hogstrom [CapableObjects]
|
|
|
|