-
Bug
-
Resolution: Done
-
Major
-
5.3.0.CR1
-
None
-
None
A marshalled ReteooStatefulSession can not be unmarshalled if it contains an InitialFactHandle node and if the knowledge base has been reinitialized.
This bug started appearing because of this change:
https://github.com/droolsjbpm/drools/commit/0a3575e8073f2abc035b13e11381464e5ac17306#diff-4
- public static final ClassObjectType InitialFact_ObjectType = new ClassObjectType( InitialFact.class ); + public static final ClassObjectType InitialFact_ObjectType = new ClassObjectType( InitialFactImpl.class );
As far as I can tell, the above change caused the following:
1. The OutputMarshaller now marshalls the InitialFactnode: the following line now returns a non-null object, which causes the subsequent if clause to run (which wasn't happening before).
Approximately here:
- https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/java/org/drools/marshalling/impl/OutputMarshaller.java#L475
ObjectTypeNode initialFactNode = ruleBase.getRete().getEntryPointNode( EntryPoint.DEFAULT ).getObjectTypeNodes().get( ClassObjectType.InitialFact_ObjectType );
2. When the InputMarshaller tries to unmarshall a marshalled session and it's using a (new) ruleBase that doesn't contain an ObjectTypeNode that descibes the InitialFact_ObjectType, then a NPE is thrown.
- This is caused because the sinks that are given to the MarshallerReaderContext (used in InputMarshaller.readSession) do not contain the InitialFact_ObjectType.
- These sinks:
- come from KnowledgeBaseImpl.ruleBase which
- contains a .rete attribute which
- contains .entrypoints (Map<EntryPoint, EntryPointNode> which
- contains EntryPointNode's which
- contains objectTypeNodes (Map<ObjectType, ObjectTypeNode>) which
- contain objectTypeNodes
- which should contain a ObjectTypeNode describing the InitialFactNode.
- contain objectTypeNodes
- contains objectTypeNodes (Map<ObjectType, ObjectTypeNode>) which
- contains EntryPointNode's which
- contains .entrypoints (Map<EntryPoint, EntryPointNode> which
- contains a .rete attribute which
- come from KnowledgeBaseImpl.ruleBase which
I can't figure out where to add this information when initializing the KnowledgeSession or KnowledgeBase for unmarshalling – or whether the unmarshalling process should take care of this.
The NPE is thrown here (the node variable at line 65 is null):
ConcurrentNodeMemories.getNodeMemory(NodeMemory) line: 65 ReteooStatefulSession(AbstractWorkingMemory).getNodeMemory(NodeMemory) line: 1018 InputMarshaller.readSession(ReteooStatefulSession, DefaultAgenda, long, boolean, MarshallerReaderContext) line: 237 InputMarshaller.readSession(MarshallerReaderContext, int, ExecutorService, Environment, SessionConfiguration) line: 209
- blocks
-
JBPM-3384 Implement marshalling backwards compatibility test framework in jBPM
-
- Resolved
-
-
JBRULES-3206 Framework to test marshalling in Drools and jBPM
-
- Resolved
-
- is related to
-
JBPM-3383 Can't reload persistent StatefulKnowledgeSession
-
- Resolved
-
- relates to
-
JBRULES-3209 ReloadSessionTest fails when trying to unmarshall the session
-
- Resolved
-