Bug 1023204 - java.io.UTFDataFormatException while building BRMS package
Summary: java.io.UTFDataFormatException while building BRMS package
Keywords:
Status: ASSIGNED
Alias: None
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: BRM (Guvnor)
Version: BRMS 5.3.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Mario Fusco
QA Contact: Lukáš Petrovický
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-10-24 21:16 UTC by Alessandro Lazarotti
Modified: 2022-08-12 04:38 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)
server log (339.13 KB, text/x-log)
2013-10-24 21:16 UTC, Alessandro Lazarotti
no flags Details
repository containing a rule with many constraints (16.18 KB, application/zip)
2013-10-24 21:17 UTC, Alessandro Lazarotti
no flags Details

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.


Note You need to log in before you can comment on or make changes to this bug.