Bug 1023204

Summary: java.io.UTFDataFormatException while building BRMS package
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Alessandro Lazarotti <alazarot>
Component: BRM (Guvnor)Assignee: Mario Fusco <mfusco>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: BRMS 5.3.1   
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-02-10 03:28:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
server log
none
repository containing a rule with many constraints none

Description Alessandro Lazarotti 2013-10-24 21:16:05 UTC
Created attachment 815930 [details]
server log

When a rule has thousands of constraints like:

~~~
when
          $frame: Frame($code :
code, (code == '0004422' || code == '0006439' ||
code == '0027203' || code == '0027214' || code ==
'0132077' || code == '0174002' || code == '0182704' ||
code == '0235761' || code == '0274720' || code ==
'0287580' || code == '0287580' || code == '0316581' ||
code == '0341710' || code == '0341895' || code ==
'0341969' || code == '0342218' || code == '0343501' ||
code == '0345035' || code == '0408284' || code ==
'0408284' || code == '0412490' || code == '0413158' ||
code == '0454492' || code == '0454492' || code ==
'0487948' || code == '0540528' || code == '0540528' || ... 
~~~


... its package can not be built by Guvnor:

~~~
java.io.UTFDataFormatException
       at java.io.ObjectOutputStream$BlockDataOutputStream.writeUTF(ObjectOutputStream.java:2134)
       at java.io.ObjectOutputStream$BlockDataOutputStream.writeUTF(ObjectOutputStream.java:1977)
       at java.io.ObjectOutputStream.writeUTF(ObjectOutputStream.java:849)
       at org.drools.base.mvel.MVELCompilationUnit.writeExternal(MVELCompilationUnit.java:172)
       at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1429)
       at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1398)
       at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
       at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
       at org.drools.base.mvel.MVELPredicateExpression.writeExternal(MVELPredicateExpression.java:65)
(full log attached)
~~~

Steps to Reproduce:
It is just reproducible compiling the package by Guvnor. A sample repository containing a rule with several constraints is attached

Actual results:
The package is not built throwing the exception: java.io.UTFDataFormatException

Expected results:
Package built

Comment 1 Alessandro Lazarotti 2013-10-24 21:17:40 UTC
Created attachment 815931 [details]
repository containing a rule with many constraints

Comment 2 Edson Tirelli 2013-10-24 23:07:58 UTC
The stack trace hints at an Drools/MVEL serialization issue/limitation. Mario, can you take a look please?

org.drools.base.mvel.MVELCompilationUnit.writeExternal(MVELCompilationUnit.java:172)

Alessandro, regarding your question, I do think having a constraint with 2000 "or" conditions like this is bad, specially performance wise. I doubt this was manually created, so I assume they are using some kind of template based rule generation.

The alternative I see is to use a data structure to hold the list of codes and then have the constraint check that list of codes. If that fits their current solution/architecture I don't know.

E.g.: 

global java.util.Set setOfCodes

rule X
when
    Frame( code memberof setOfCodes )
then
...

Comment 3 Mario Fusco 2013-10-29 16:33:15 UTC
I didn't investigate the serialization problem, but I found another issue with mvel while parsing an expression with a few thousands constraints like this. Indeed after a given point (around 5k constraints) it throws an StackOverflowError and is no longer able to parse the expression.

Comment 6 Red Hat Bugzilla 2025-02-10 03:28:50 UTC
This product has been discontinued or is no longer tracked in Red Hat Bugzilla.