Concurrent stateful knowledge session
by ismaximum
Hi
I have one question and one problem.
The question is, is multiple instances of stateful session, thread safe?
The problem is, we have a bunch of test cases. Each test class extends from
an abstract class in which drools session will be created. Previously we had
stateless session so therefore for each test method we had to create a new
session and call execute() method.
Now because of the huge number of test methods this runs for about 20
minutes. So we decided to change the the session to stateful to make it
faster.
After this change, many of test cases have ended with assertion failure
which doesn't make sense. I don't know what's wrong here, before each test
method, we retract any previous fact and we insert new objects.
Since jnuit runs tests in multiple threads I thought maybe there is an issue
with concurrency.
Can anyone please help me on this.
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/Concurrent-stateful-knowledge-session-t...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years
constraints lacking and in excess
by Michiel Vermandel
Hi,
I have written a custom move implementation.
At first I got the exception:
java.lang.IllegalStateException: The moveClass (class my.planner.solver.MoveGroupToPeriod)'s move (PROJECT Period GroupChange:{T= Inspect 55871.I#0 [4->4] Bart DE BIE IV XI} => (P5) [i1]) probably has a corrupted undoMove (my.planner.solver.util.TaskChangeListMove@35e8df37). Or maybe there are corrupted score rules.
...
I found out that I did not undo all changes that I made in the move.
After fixing this, I now often get Score corruption as below.
I checked and all changes are preceded with director.beforeVariableChanged(...) and followed by director.afterVariableChanged(...);
What could cause this corruption?
java.lang.IllegalStateException: Score corruption: the workingScore (-286hard/-30601soft) is not the uncorruptedScore (-286hard/-30401soft):
The workingMemory has 3 ConstraintOccurrence(s) in excess:
preferedRegion/NEGATIVE_SOFT:[{T= Inspect 115519.I#0 [8->8] Dirk JANSSENS IV V}, Johan LAMOTE, 99, V]=99
taskSpreading/NEGATIVE_HARD:[(P7) , 77]=100
preferedRegion/NEGATIVE_SOFT:[{T= Inspect 115519.I#1 [8->8] Erik VERHOEVEN TL V}, Dirk JANSSENS, 99, V]=99
The workingMemory has 6 ConstraintOccurrence(s) lacking:
preferedRegion/NEGATIVE_SOFT:[{T= Inspect 115519.I#0 [8->8] Dirk JANSSENS IV V}, Dirk JANSSENS, 99, V]=99
taskSpreading/NEGATIVE_HARD:[(P7) , 75]=36
preferedRegion/NEGATIVE_SOFT:[{T= Inspect 115519.I#1 [8->8] Erik VERHOEVEN TL V}, Erik VERHOEVEN, 99, V]=99
preferedRegion/NEGATIVE_SOFT:[{T= Inspect 4747.I#0 [10->10] Johan LAMOTE IV V}, Johan LAMOTE, 99, V]=99
taskSpreading/NEGATIVE_HARD:[(P8) , 74]=16
preferedRegion/NEGATIVE_SOFT:[{T= Inspect 4747.I#1 [10->10] Dirk JANSSENS TL V}, Dirk JANSSENS, 99, V]=99
Check the score rules who created those ConstraintOccurrences. Verify that each ConstraintOccurrence's causes and weight is correct.
at org.drools.planner.core.score.director.AbstractScoreDirector.assertWorkingScore(AbstractScoreDirector.java:249)
at org.drools.planner.core.solver.scope.DefaultSolverScope.assertWorkingScore(DefaultSolverScope.java:96)
at org.drools.planner.core.phase.AbstractSolverPhaseScope.assertWorkingScore(AbstractSolverPhaseScope.java:124)
at org.drools.planner.core.localsearch.DefaultLocalSearchSolverPhase.solve(DefaultLocalSearchSolverPhase.java:86)
at org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:190)
at org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:155)
at my.planner.app.InspectionSchedule.solve(InspectionSchedule.java:275)
at my.planner.testcore.AbstractPlanningTestClass.solve(AbstractPlanningTestClass.java:444)
at my.planner.testcore.AbstractPlanningTestClass.solve(AbstractPlanningTestClass.java:469)
at my.planner.RealBaoTest.datasetBAO20122013(RealBaoTest.java:226)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Thanks,
Michiel
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
13 years
Change in eval mvel syntax from 5.1 to 5.3
by Chris Selwyn
I have been using 5.1 for some time and am looking to upgrade.
I have found that, where in 5.1, I used to be able to write
$jd: JobDetails(
eval ( $t = ["MTSURVEY", "MTINSTALL", "MTEXCHANGE", "MTMAINT"];
!($t contains getJobType(businessArea, templateJobId) )) )
However, in 5.3.1 this now produces a syntax error as follows:-
[CheckJobType] [ERR 101] Line 9:9 no viable alternative at input '$t' in rule "CheckJobType"
[CheckJobType] Parser returned a null Package
I have found that I have to now code the condition as follows:-
$jd: JobDetails(
eval (!(["MTSURVEY", "MTINSTALL", "MTEXCHANGE", "MTMAINT"] contains getJobType(businessArea, templateJobId) )) )
It is a relatively minor thing but I am curious as to why I should have to recode this.
What has changed to cause me to do this? What other incompatibilities exist?
Chris
13 years
Potential memory leak in package analysis tool in Guvnor 5.3
by Chris Selwyn
I have recently been looking at upgrading our installation from 5.1 to 5.3 (latest supported by RedHat).
As part of this I noticed the Package Analysis tool so I started experimenting with it.
All that happens is that I get an exceptio message in the JBoss AS server.log file and an apparent memory leak.
The exception relates to a SerializationException thrown by VerificationService.analysePackage and contains many (many) Verifier Errors saying
<quote>
[ERR 107] Line 2:0 mismatched input 'when' expecting one of the following tokens: '[package, import, global, declare, function, rule, query]'.
</quote>
Using jvisualvm, I can see that the memory usage takes a step jump each time I use the analysis tool and eventually (actually after only 2 usages) I get OutOfMemoryErrors.
The package compiles just fine.
Is there a known problem with the analysis tool?
Chris Selwyn
13 years
add guvnor-webapp-core as a dependency to project
by kooper
Hi,I'm trying to add guvnor-webapp-core as a dependency to my project, but
after when deploying app to JBOSS 7(tried 7.1.1 and 7.0.2), I have following
exception:
11:19:50,138 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8)
MSC00001: Failed to start service
jboss.deployment.unit."my_app-1.0-SNAPSHOT.war".WeldService:
org.jboss.msc.service.StartException in service
jboss.deployment.unit."my_app-1.0-SNAPSHOT.war".WeldService:
org.jboss.weld.exceptions.DeploymentException: Exception List with 3
exceptions:Exception 0 :org.jboss.weld.exceptions.DeploymentException:
WELD-001408 Unsatisfied dependencies for type [RepositoryStartupService]
with qualifiers [@Default] at injection point [[field] @Inject private
org.drools.guvnor.server.repository.RulesRepositoryManager.repositoryStartupService]
at
org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:275)
at
org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:244)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:107) at
org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:127) at
org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:346) at
org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:331) at
org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:366)
at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:83) at
org.jboss.as.weld.services.WeldService.start(WeldService.java:76) at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:636)Exception 0
:org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied
dependencies for type [RepositoryStartupService] with qualifiers [@Default]
at injection point [[field] @Inject private
org.drools.guvnor.server.repository.MailboxService.repositoryStartupService]
at
org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:275)
at
org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:244)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:107) at
org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:127) at
org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:346) at
org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:331) at
org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:366)
at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:83) at
org.jboss.as.weld.services.WeldService.start(WeldService.java:76) at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:636)Exception 0
:org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied
dependencies for type [ConversionService] with qualifiers [@Default] at
injection point [[field] @Inject private
org.drools.guvnor.server.RepositoryAssetService.conversionService] at
org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:275)
at
org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:244)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:107) at
org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:127) at
org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:346) at
org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:331) at
org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:366)
at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:83) at
org.jboss.as.weld.services.WeldService.start(WeldService.java:76) at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:636) at
org.jboss.as.weld.services.WeldService.start(WeldService.java:83) at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
[jboss-msc-1.0.2.GA.jar:1.0.2.GA] at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
[jboss-msc-1.0.2.GA.jar:1.0.2.GA] at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
[rt.jar:1.6.0_18] at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
[rt.jar:1.6.0_18] at java.lang.Thread.run(Thread.java:636)
[rt.jar:1.6.0_18]Caused by: org.jboss.weld.exceptions.DeploymentException:
Exception List with 3 exceptions:....
Do I need to add anything to project configuration to be able to add guvnor
as dependency?Thanks.
--
View this message in context: http://drools.46999.n3.nabble.com/add-guvnor-webapp-core-as-a-dependency-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years
deadlock
by Smita S. Deshpande
Hi,
We are currently using drools 5.0.1 for processing business rules. But we are currently facing an issue where if we invoke the rule using 10 concurrent requests , thread gets locked . The error is as below .
Deadlock/Blocked
Monitor
Owns Monitor Lock on org/drools/rule/JavaDialectRuntimeData$PackageClassLoader@0E99F9B8/0E99F9C4
Waiting for Monitor Lock on org/drools/rule/CompositeClassLoader@0DB50DC0/0DB50DCC
Java Stack
at java/lang/ClassLoader.loadClass(ClassLoader.java:606(Compiled Code))
at java/lang/Class.forNameImpl(Native Method)
at java/lang/Class.forName(Class.java:163(Compiled Code))
at org/drools/rule/JavaDialectRuntimeData$PackageClassLoader.loadClass(JavaDialectRuntimeData.java:458(Compiled Code))
at java/lang/ClassLoader.loadClass(ClassLoader.java:606(Compiled Code))
at /Rule_AutoUW_Rule_BR12Constants_153_0ConsequenceInvoker.evaluate(Rule_AutoUW_Rule_BR12Constants_153_0ConsequenceInvoker.java:16)
at org/drools/common/DefaultAgenda.fireActivation(DefaultAgenda.java:934(Compiled Code))
at org/drools/common/DefaultAgenda.fireNextItem(DefaultAgenda.java:885(Compiled Code))
at org/drools/common/DefaultAgenda.fireAllRules(DefaultAgenda.java:1086(Compiled Code))
at org/drools/common/AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:661(Compiled Code))
at org/drools/common/AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:637(Compiled Code))
at org/drools/reteoo/ReteooStatelessSession.execute(ReteooStatelessSession.java:203(Compiled Code))
Can you please advice .This has been occurring on Production systems and causing failures
Thanks & Regards,
Smita Deshpande
Technical Specialist - DU UK Insurance
Mastek Ltd | Cerebrum,2nd Floor, KalyaniNagar, Pune, Maharashtra, INDIA
(M)(0)9823041314 | (T) 91 20 66072000 Extn - 2256 | VOIP: 729 | www.mastek.com<http://www.mastek.com/>
Email:- smita.deshpande(a)mastek.com<mailto:smita.deshpande@mastek.com>
MASTEK LTD.
In the US, we're called MAJESCOMASTEK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13 years
Retrieving timestamps from default Drools Fusion event
by Wan Jing Loh
Hi,
First time posting in the mailing list, so I apologise if I make any silly
mistakes.
I have two classes MachineOnline and MachineOffline, which denote when a
machine is online and offline respectively
public class MachineOnline {
int machineId
}
These are declared in the drl file as events, so Drools Fusion
automatically generates the timestamp for me (I am running in STREAM mode,
so i get real time updates on the machine status)
declare MachineOnline
@role(event)
end
I then have a rule to generate the duration when the machine is online, but
I cannot seem to extract the timestamp that drools automatically inserts. A
thread a few years ago suggested using .startTimestamp, but Drools does not
seem to recognise it as a field. I believe that needs an EventFactHandle,
but I'm not sure how to retrieve that inside the drl file.
rule "Find duration machine is online"
when $message1 : MachineOnline()
$message2: MachineOffline(machineId == $message1.machineId &&
this after $message1) // + more rules to handle edge cases
then
//processing
duration = $message2.startTimestamp - $message1.startTimestamp ?
end
The eventual aim is to allow for a query that allows me to find how long
the machine is online for during a specified time interval, so if there is
a way to do this without needing to retrieve the actual timestamp of each
event, that will be great too. Or would it be better to manually define a
timeStamp field for each event? I've been using the default one as that
together with the pseudo allows for easy unit testing.
Thanks a lot!
Regards
Jing
13 years