Bug 755129 - PackageBuilder fails with StackOverflowError if declared model contains recursive data types
Summary: PackageBuilder fails with StackOverflowError if declared model contains recur...
Keywords:
Status: ASSIGNED
Alias: None
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: BRE (Expert, Fusion)
Version: BRMS 5.3.0.GA
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Mario Fusco
QA Contact: Jiri Locker
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-11-18 22:55 UTC by Jiri Locker
Modified: 2020-04-27 01:12 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
PackageBuilder fails with the StackOverflowError if the declared model contains recursive data types.
Clone Of:
Environment:
Last Closed:
Type: ---


Attachments (Terms of Use)
model-recursive.drl (72 bytes, text/plain)
2011-11-18 22:59 UTC, Jiri Locker
no flags Details
model-circular.drl (93 bytes, text/plain)
2011-11-18 22:59 UTC, Jiri Locker
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 724331 0 low VERIFIED declarative model doesn't allow to use a fact as a field type when that fact was created later 2021-02-22 00:41:40 UTC
Red Hat Issue Tracker JBRULES-3229 0 Major Resolved Stack overflow using recursive types 2020-09-15 11:52:46 UTC

Internal Links: 724331

Description Jiri Locker 2011-11-18 22:55:23 UTC
Description of problem:

See attached drl files for sample models. When adding these resources to a KnowledgeBuilder, the compilation fails with java.lang.StackOverflowError.


Version-Release number of selected component (if applicable):
BRMS 5.3.0.DEV5


How reproducible:
always


Steps to Reproduce:
run something like

> Resource res = ResourceFactory.newClassPathResource("model-recursive.drl", getClass());
> KnowledgeBuilderFactory.newKnowledgeBuilder().add(res, ResourceType.DRL);
  

Actual results:
Exception in thread "main" java.lang.StackOverflowError
        at java.util.LinkedList$Entry.<init>(LinkedList.java:787)
        at java.util.LinkedList.addBefore(LinkedList.java:795)
        at java.util.LinkedList.add(LinkedList.java:215)
        at org.drools.compiler.PackageBuilder$Node.accept(PackageBuilder.java:2801)
        at org.drools.compiler.PackageBuilder$Node.accept(PackageBuilder.java:2805)
        ...


Expected results:
PackageBuilder should be able to compile packages with attached models or it should throw an exception if such models are not supported.


Additional info:

Comment 1 Jiri Locker 2011-11-18 22:59:33 UTC
Created attachment 534514 [details]
model-recursive.drl

Comment 2 Jiri Locker 2011-11-18 22:59:56 UTC
Created attachment 534515 [details]
model-circular.drl

Comment 3 JBoss JIRA Server 2012-01-27 20:02:06 UTC
Mario Fusco <mario.fusco> updated the status of jira JBRULES-3229 to Resolved

Comment 4 JBoss JIRA Server 2012-01-27 20:02:06 UTC
Mario Fusco <mario.fusco> made a comment on jira JBRULES-3229

Fixed also for circular type declarations like in:

declare FactA
    fieldB: FactB
end
declare FactB
    fieldA: FactA
end

Comment 5 Ryan Zhang 2012-05-11 01:29:48 UTC
The fix only get in master branch in project  and is not merged in 5.3.x branch, so it is not picked in  the BRMS 5.3 product  branch  as well. 

So Assign back to developer.

Comment 6 Ryan Zhang 2012-05-11 03:43:17 UTC
This issue also has no block+ flag. 
Need PM to decide wanted or not.

Comment 7 Mario Fusco 2012-05-11 06:43:28 UTC
This fix is tightly related with the CompositeKnowledgeBuilder, a brand new feature added in Drools 5.4 that allows to build more cross referencing DRL files at once. I don't think it will be easy to decouple the two, so my advice is to avoid to try to backport this fix unless strictly necessary.

Comment 8 Ryan Zhang 2012-05-11 07:03:18 UTC
In that case, then we can move this to future release.

Comment 9 lcarlon 2012-06-13 03:55:42 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
PackageBuilder fails with StackOverflowError if declared model contains recursive data types.


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