Bug 1316743 - [GSS] (6.2.z) "NotSerializableException: org.drools.core.common.DefaultFactHandle" on EvaluatorWrapper while deepClone
[GSS] (6.2.z) "NotSerializableException: org.drools.core.common.DefaultFactHa...
Status: VERIFIED
Product: JBoss BRMS Platform 6
Classification: JBoss
Component: BRE (Show other bugs)
6.2.0
Unspecified Unspecified
urgent Severity high
: CR1
: 6.2.3
Assigned To: Mario Fusco
Ivo Bek
:
Depends On: 1315143
Blocks: 1327763 1327765
  Show dependency treegraph
 
Reported: 2016-03-10 19:41 EST by Toshiya Kobayashi
Modified: 2016-05-04 09:11 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1315143
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Toshiya Kobayashi 2016-03-10 19:41:59 EST
+++ This bug was initially created as a clone of Bug #1315143 +++

Description of problem:

org.drools.core.definitions.impl.KnowledgePackageImpl.deepCloneIfAlreadyInUse() failed because of "java.io.NotSerializableException: org.drools.core.common.DefaultFactHandle"

=====
Caused By: java.io.NotSerializableException: org.drools.core.common.DefaultFactHandle
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183)
        at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
        at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1377)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1173)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
        at org.drools.core.base.mvel.MVELCompilationUnit.writeExternal(MVELCompilationUnit.java:173)
        at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1458)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1429)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
        at org.drools.core.rule.constraint.MvelConstraint.writeExternal(MvelConstraint.java:495)
        at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1458)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1429)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
        at java.util.ArrayList.writeObject(ArrayList.java:742)
        at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
        at org.drools.core.rule.Pattern.writeExternal(Pattern.java:155)
        at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1458)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1429)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
        at java.util.ArrayList.writeObject(ArrayList.java:742)
        at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
        at org.drools.core.rule.GroupElement.writeExternal(GroupElement.java:72)
        at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1458)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1429)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
        at java.util.ArrayList.writeObject(ArrayList.java:742)
        at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
        at org.drools.core.rule.GroupElement.writeExternal(GroupElement.java:72)
        at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1458)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1429)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
        at org.drools.core.definitions.rule.impl.RuleImpl.writeExternal(RuleImpl.java:195)
        at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1458)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1429)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
        at java.util.IdentityHashMap.writeObject(IdentityHashMap.java:1193)
        at sun.reflect.GeneratedMethodAccessor284.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
        at org.drools.core.rule.MVELDialectRuntimeData.writeExternal(MVELDialectRuntimeData.java:86)
        at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1458)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1429)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
        at java.util.HashMap.writeObject(HashMap.java:1129)
        at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
        at org.drools.core.rule.DialectRuntimeRegistry.writeExternal(DialectRuntimeRegistry.java:48)
        at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1458)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1429)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
        at org.drools.core.definitions.impl.KnowledgePackageImpl.writeExternal(KnowledgePackageImpl.java:245)
        at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1458)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1429)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
        at org.drools.core.util.ClassUtils.deepClone(ClassUtils.java:592)
        at org.drools.core.definitions.impl.KnowledgePackageImpl.deepCloneIfAlreadyInUse(KnowledgePackageImpl.java:804)
        at org.drools.core.definitions.impl.KnowledgePackageImpl.deepCloneIfAlreadyInUse(KnowledgePackageImpl.java:66)
        at org.drools.core.impl.KnowledgeBaseImpl.addPackages(KnowledgeBaseImpl.java:733)
        at org.drools.core.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:277)
        at org.drools.compiler.kie.builder.impl.KieContainerImpl.createKieBase(KieContainerImpl.java:503)
        at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:440)
        at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:597)
        at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:542)
        at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:524)
        at com.example.MyBean.initializeKieSession(MyBean.java:108)
        at com.example.MyBean.<init>(MyBean.java:88)
...
====

Here MVELCompilationUnit serializes "EvaluatorWrapper[] operators".

https://github.com/droolsjbpm/drools/blob/6.3.x/drools-core/src/main/java/org/drools/core/base/mvel/MVELCompilationUnit.java#L173

EvaluatorWrapper has InternalFactHandle fields and serializes them with a standard Java serialization.

https://github.com/droolsjbpm/drools/blob/6.3.x/drools-core/src/main/java/org/drools/core/base/EvaluatorWrapper.java#L54-L55

Steps to Reproduce:

A unit test exists in the commit (https://github.com/droolsjbpm/drools/commit/7d7312408)

--- Additional comment from Mario Fusco on 2016-03-09 13:46:14 EST ---

Fixed by https://github.com/droolsjbpm/drools/commit/7d7312408
Comment 2 Mario Fusco 2016-04-18 03:19:54 EDT
Cherry-picked to 6.3.x with https://github.com/droolsjbpm/drools/commit/89981c0b9
Comment 3 Ivo Bek 2016-05-04 09:11:48 EDT
Verified in BPM Suite 6.2.3.CR1

The test testNonSerializableInEvaluatorWrapper passed.

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