ArrayIndexOutOfBoundsException under high events load in drools CEP
by ters
Hi, drools users/developers. As mentioned in subject, I often faced
ArrayIndexOutOfBoundsException under high events load in drools during
marshaling.
Conditions: drools CEP (5.4.0.Final), Stream mode, fireUntilHalt mode,
during very active marshaling process (in several threads) I often have such
trace:
java.lang.ArrayIndexOutOfBoundsException: 2773
at
org.drools.marshalling.impl.ProtobufOutputMarshaller.orderFacts(ProtobufOutputMarshaller.java:592)
at
org.drools.marshalling.impl.ProtobufOutputMarshaller.writeFactHandles(ProtobufOutputMarshaller.java:533)
at
org.drools.marshalling.impl.ProtobufOutputMarshaller.serializeSession(ProtobufOutputMarshaller.java:139)
at
org.drools.marshalling.impl.ProtobufOutputMarshaller.writeSession(ProtobufOutputMarshaller.java:100)
at
org.drools.marshalling.impl.ProtobufMarshaller.marshall(ProtobufMarshaller.java:169)
at
org.drools.marshalling.impl.ProtobufMarshaller.marshall(ProtobufMarshaller.java:151)
at
com.blablabla.cep.CEPEventProcessor.marshalWorkingMemory(CEPEventProcessor.java:332)
This exception occurs really often.
I googled fresh tracked bug
https://bugzilla.redhat.com/show_bug.cgi?id=1044577. As I understand, this
bug is fixed in drool 5.3.x branch, but we using drools-core 5.4.0.Final.
So could you please help me what to do with this exeption?
Thanks in advance.
--
View this message in context: http://drools.46999.n3.nabble.com/ArrayIndexOutOfBoundsException-under-hi...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 months
Drools 6.0.1 CEP stucks during marshaling in fireUntilHalt mode
by ters
Hi drools experts.
We use drools fusion complex event processor (CEP). After migration from
5.4.0 to 6.0.1 I encountered a problem - CEP stucks during marshaling in
fireUntilHalt mode. Below self-contained reproducer.
--------------------------------
/*Event class:*
/public class Test1 {
private Date timestamp;
private String id;
}/
/*Rule drl:*
/package bpmn;
import com.test.event.*;
dialect "mvel"
declare BusinessProcessName
name : String;
end
declare com.test.event.Test1
@role( event )
end
rule "Insert Business Process Name"
salience 10
when
not BusinessProcessName(name == "SomeName")
then
System.out.println("Insert Business Process Name");
insert(new BusinessProcessName("SomeName"));
end
rule "Start event1"
when
$event1 : Test1()
then
System.out.println("Start event1 fired.");
end/
/*Test with whole initialization*
/public class TestDrools6CEPDeadLock implements RuleRuntimeEventListener {
private KieSession ksession;
private Marshaller marshaller;
@Test
public void test1() throws Exception {
initSession();
runFireUntilHaltThread();
System.out.println("-= 1 =-");
ksession.insert(new Test1());
System.out.println("-= 2 =-");
ksession.insert(new Test1());
}
private void runFireUntilHaltThread() {
new Thread(new Runnable() {
public void run() {
ksession.fireUntilHalt();
}
}).start();
}
private void initSession() {
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("TestDrools6CEPDeadLock.drl"),
ResourceType.DRL);
if (kbuilder.hasErrors()) throw new RuntimeException("Unable to
compile drl\".");
KieBaseConfiguration config =
KieServices.Factory.get().newKieBaseConfiguration();
config.setOption(EventProcessingOption.STREAM);
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(config);
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
ksession = kbase.newKieSession();
ksession.addEventListener((RuleRuntimeEventListener) this);
marshaller = MarshallerFactory.newMarshaller(kbase);
}
@Override
public void objectInserted(ObjectInsertedEvent event) {
System.out.println("------------------objectInserted---------------");
marshallSession();
}
@Override
public void objectUpdated(ObjectUpdatedEvent event) {
System.out.println("------------------objectUpdated---------------");
marshallSession();
}
@Override
public void objectDeleted(ObjectDeletedEvent event) {
System.out.println("------------------objectDeleted---------------");
marshallSession();
}
private void marshallSession() {
try {
marshaller.marshall(new ByteArrayOutputStream(), ksession);
System.out.println("------------------marshalled---------------");
} catch (IOException e) {
e.printStackTrace();
}
}
}/
*Output *of test I see only:
>-= 1 =-
>------------------objectInserted---------------
>Insert Business Process Name
Further engine hangs up, looks like dead lock on
ProtobufOutputMarshaller.evaluateRuleActivations() (line 256) >
RuleExecutor.reEvaluateNetwork().
Notes:
1) It worked fine on 5.4.0.Final version
2) Current problem not occurs if I run fireAllRules in second thread instad
of filreUntilHalt
private void runFireAllRulesInThread() {
new Thread(new Runnable() {
public void run() {
while(true){
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
LOG.error(e);
}
synchronized (ksLock){
ksession.fireAllRules();
}
}
}
}).start();
}
I need this thread to ensure firing timing rules such like:
$event1 : Test1();
not Test2(this after[0s, 10s ] $event1 );
I hope this can help to resolve either my or drools bug.
Thanks in advance.
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-6-0-1-CEP-stucks-during-marshali...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 10 months
Do events have to be unique in terms of their field values?
by Brecht De Rooms
Dear drools users,
when using a rule to add events such as the rule below, I noticed that
they are not inserted if the event has identical field values. When I
change one of the values to another number they are inserted. Is this
normal behavior? I assumed that the timestamp would determine them to be
unique.
rule "insertevents0"
when
then
insert(new (TestFloatEvent(0));
insert(new (TestFloatEvent(0));
end
I figured it might be that the timestamp is equal since they are inserted
in the same rule. To be sure I waited and entered a second rule to be
picked up by the scanner.
rule "insertevents1"
when
then
insert(new (TestFloatEvent(0));
insert(new (TestFloatEvent(0));
end
Yet, the amount of events when I query the factbase is still 1 where I
thought it would ahave been 4.
Is the best way to fix this to add an explicit time attribute?
The TestFloatEvents are declared as:
package dynamictypesnetworktest
declare TestFloatEvent
@role(event)
value : float @key
end
---
Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus-bescherming actief is.
http://www.avast.com
11 years, 10 months
How to set a the Kiebase generated by a scanner to streaming modus?
by Brecht De Rooms
Dear Drools Users,
When you create you own KieBase you can set the KieBase to streaming
as follows:
KieBaseConfiguration config =
KieServices.Factory.get().newKieBaseConfiguration();
config.setOption( EventProcessingOption.STREAM );
However, when you use a scanner you would create a session as follows:
KieServices ks = KieServices.Factory.get();
KieContainer kieContainer = ks.newKieContainer(releaseId);
scanner = ks.newKieScanner(kieContainer);
You can't set the Streaming option directly on the session and I assume
the KieBases will change from the moment a change is detected in the Maven
package. Then how would you set the KieBases that are 'generated' by teh
scanner to streaming modus?
Kind Regards,
-------------------------------------------------------------
Brecht De Rooms
Phd Student @ WISE
Department of Computer Science
Vrije Universiteit Brussel
Pleinlaan 2, B-1050 Brussels, Belgium
office: 10 G 731f
phone: +32 2 629 37 49
email: bderooms(a)vub.ac.be
-------------------------------------------------------------
---
Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus-bescherming actief is.
http://www.avast.com
11 years, 10 months
Simple aggregation problem
by Raja Sekhar
Hi,
I am using the following rule
package com.demo;
import com.sample.model.Product;
import com.sample.model.Products;
import java.util.List;
import java.util.Set;
dialect "mvel"
rule "Product_0"
no-loop
when
Product(id: hlId) accumulate (e :Product(hlId == id), $sum1 : sum(e.t1) )
then
insertLogical("hid=" + id +",T1=" + $sum1);
end
I am inserting facts (Product objects) into it and firing the rules.
When i took performance stats from visual vm with JMX. got a time of
3832ms. I can you suggest if i am doing any thing wrong with this.
Regards,
Raja Sekhar
--
Raja Sekhar Amirapu
------------------------------------------------------
"If any anyone can do it, i can do it. If no one else can do it, i must do
it"
11 years, 10 months
Embedding Workbench Docs Updated
by Alexandre Porcelli
For those interested on embedding workbench editors/perspectives into your own applications, here is the doc related to it that I just pushed to our docs github repository:
Embedding Workbench In Your Application
As we already know, Workbench provides a set of editors to author assets in different formats. According to asset’s format a specialized editor is used.
One additional feature provided by Workbench is the ability to embed it in your own (Web) Applications thru it'sstandalone mode. So, if you want to edit rules, processes, decision tables, etc... in your own applications without switch to Workbench, you can.
In order to embed Workbench in your application all you'll need is the Workbench application deployed and running in a web/application server and, from within your own web applications, an iframe with proper HTTP query parameters as described in the following table.
Table HTTP query parameters for standalone mode
Parameter Name Explanation Allow multiple values Example
standalone With just the presence of this parameter workbench will switch to standalone mode. no (none)
path Path to the asset to be edited. Note that asset should already exists. no git://master@uf-playground/todo.md
perspective Reference to an existing perspective name. no org.guvnor.m2repo.client.perspectives.GuvnorM2RepoPerspective
header Defines the name of the header that should be displayed (useful for context menu headers). yes ComplementNavArea
Note
Path and Perspective parameters are mutual exclusive, so can't be used together.
Regards,
---
Alexandre Porcelli
Principal Software Engineer
Red Hat Business Systems and Intelligence Group
11 years, 10 months
accumulate Map()
by Gopu Shrestha
This accumulate is not working.. any advice?
$headers : Map() from accumulate(RulesHeader($headerName : name in (
"some_ErrorInfo"), $headerValue : valueAsString not in (null, "")),
init(Map headers = new HashMap();)
action(headers.put($headerName, $headerValue);)
result(headers))
11 years, 10 months