Drools should lock a KB **internally** when rules are added or removed.. So either there's a bug in the rebuilding process - which should be possible to isolate even in a single threaded environment, by finding the "right" sequence of modifications - or there's a lock issue in Drools, which allows two threads to modify the same KB at the same time.
In other words.. an application level lock could cause the KB to be modified as a batch of rules is being executed. This could disrupt the correctness of your results - as part of the data is processed using the old rules and part using the new ones - but should not affect the knowledge base integrity. I was initially inclined to think that two add/delete operations were attempted in parallel.. but since they're mutually exclusive, it's less likely.. I'd need to check the KB modification code and see if there's anything that can go wrong in case it's invoked when the KB is in an "unstable" state. An important side question - How many sessions do you have? Add and remove affect the KB, while exec would apply to any individual session generated from the same KB... so this may complicate the scenario.. Davide On 04/30/2013 06:03 PM, mohdejaz74 wrote: > There was indeed a leak in locking. > > I have three operations - add, del, exec rules. add and delete were atomic > but exec was not. Before getting reference to KB in exec rules, I made sure > add/del were not accessing KB ... but I need lock KB even when rules are > executing and release the lock when rules have executed (although I get a > stateful session from KB before executing rules) > > I suspect this error occurs when rules are executing and at the same time > add/delete rule is invoked. > > I've not seen any further errors ... but we are still testing it. > > Ejaz > > > > -- > View this message in context: > http://drools.46999.n3.nabble.com/threw-error-java-lang-ClassCastException-org-drools-reteoo-FromNode-FromMemory-cannot-be-cast-to-orgy-tp4023497p4023595.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users > _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
