[jboss-jira] [JBoss JIRA] (DROOLS-1362) accumulate and over window:time usage will stuck drools for a while (from minutes to hours according to number of facts)
Mario Fusco (Jira)
issues at jboss.org
Fri Oct 19 06:02:00 EDT 2018
[ https://issues.jboss.org/browse/DROOLS-1362?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mario Fusco resolved DROOLS-1362.
---------------------------------
Resolution: Incomplete Description
I tried different scenario (see the test cases I'm pasting below) but couldn't find any relevant problem.
Please try with a newer version of drools and if you think that the problem is still there feel free to reopen this ticket attaching a more complete reproducer.
{code}
@Test
public void testManyInsertWithAccumulate() throws InterruptedException {
final String drl = "package org.drools.compiler\n" +
"import " + StockTick.class.getCanonicalName() + ";\n" +
"global java.util.List results;\n" +
"\n" +
"declare StockTick \n" +
" @role( event )\n" +
" @expires( 1m )\n" +
"end\n" +
"\n" +
"rule R when\n" +
" accumulate( StockTick( company == \"ACME\", $price : price ) over window:time( 30s ); $avg : average($price) )\n" +
"then\n" +
" results.add( $avg );\n" +
"end\n";
final KieBase kbase = KieBaseUtil.getKieBaseFromKieModuleFromDrl("cep-esp-test", kieBaseTestConfiguration, drl);
final KieSession ksession = kbase.newKieSession(); // KieSessionTestConfiguration.STATEFUL_PSEUDO.getKieSessionConfiguration(), null);
try {
List<Number> results = new ArrayList<>();
ksession.setGlobal( "results", results );
long counter = 0;
long start = System.currentTimeMillis();
while (System.currentTimeMillis() - start < 30_000L) {
ksession.insert( new StockTick( counter, "ACME", counter++ ) );
Thread.sleep( 1L );
}
long beforeFire = System.currentTimeMillis();
ksession.fireAllRules();
System.out.println("firing took " + (System.currentTimeMillis() - beforeFire) + " msecs");
System.out.println(results);
} finally {
ksession.dispose();
}
}
@Test
public void testManyInsertWithAccumulate2() throws InterruptedException {
final String drl = "package org.drools.compiler\n" +
"import " + StockTick.class.getCanonicalName() + ";\n" +
"global java.util.List results;\n" +
"\n" +
"declare StockTick \n" +
" @role( event )\n" +
" @expires( 1m )\n" +
"end\n" +
"\n" +
"rule R when\n" +
" accumulate( StockTick( company == \"ACME\", $price : price ) over window:time( 30s ); $avg : average($price) )\n" +
"then\n" +
" results.add( $avg );\n" +
"end\n";
final KieBase kbase = KieBaseUtil.getKieBaseFromKieModuleFromDrl( "some-test", KieBaseTestConfiguration.STREAM_IDENTITY, drl );
final KieSession ksession = kbase.newKieSession(); // KieSessionTestConfiguration.STATEFUL_PSEUDO.getKieSessionConfiguration(), null);
try {
final List<Number> results = new ArrayList<>();
ksession.setGlobal( "results", results );
final ExecutorService executorService = Executors.newSingleThreadExecutor();
// executorService.submit((Runnable) ksession::fireUntilHalt);
try {
long counter = 0;
final long start = System.currentTimeMillis();
while (System.currentTimeMillis() - start < 50_000L) {
final long beforeInsert = System.currentTimeMillis();
ksession.insert( new StockTick( counter, "ACME", counter++ ) );
Thread.sleep( 1L );
final long insertTime = System.currentTimeMillis() - beforeInsert;
if ( insertTime > 2 ) {
System.out.println( "insert took " + insertTime + " msecs" );
}
}
} finally {
// ksession.halt();
executorService.shutdownNow();
}
} finally {
ksession.dispose();
}
}
{code}
> accumulate and over window:time usage will stuck drools for a while (from minutes to hours according to number of facts)
> ------------------------------------------------------------------------------------------------------------------------
>
> Key: DROOLS-1362
> URL: https://issues.jboss.org/browse/DROOLS-1362
> Project: Drools
> Issue Type: Bug
> Affects Versions: 6.5.0.Final
> Reporter: Ertugrul Akbas
> Assignee: Mario Fusco
> Priority: Major
> Attachments: Droolslog.zip
>
>
> We are testing a simple rule. The rule is:
> import com.anet.correlation.*;
> import java.util.*;
> import com.anet.ntLog.collector.*;
> import com.anet.alarm.*;
> import com.anet.util.*;
> import com.anet.correlation.operators.*;
> import com.anet.correlation.utils.*;
> declare EPSObject
> @role(event)
>
> end
> rule "test"
> when
> Number( ) from accumulate(
> generalcorrelationobject1:EPSObject(name=='ert', $temp :avg_snmptrapeps) over window:time( 3m ),
> average( $temp ) )
> then
> end
> we are inserting facts continuously and after 3 minutes - the time which is given as "over window:time( 3m )" -
> drools stuck and then after minutes , starts to conitinue.
> Not: When we test with "over window:time( 30m )" stuck 30 minutes later or When we test with "over window:time( 10m )" stuck 10 minutes later
> Any comment?
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
More information about the jboss-jira
mailing list