Fixed
Details
Assignee
Chandra GorantlaChandra GorantlaReporter
Will KeaneyWill KeaneyComponents
Sprint
NoneFix versions
Affects versions
Priority
Major
Details
Details
Assignee
Chandra Gorantla
Chandra GorantlaReporter
Will Keaney
Will KeaneyComponents
Sprint
None
Fix versions
Affects versions
Priority
PagerDuty
PagerDuty
PagerDuty
Created March 11, 2020 at 4:27 PM
Updated March 12, 2025 at 9:34 PM
Resolved March 26, 2020 at 9:17 PM
If a Drools engine has facts in working memory when
reloadConfig
is called, those facts are collected in aList<Object> object
, and then re-inserted into the new session.This results in the restored objects having a different class signature than the "same" ones in the new session, since they belong to a different classloader.
When this happens, Drools queries cannot find these facts and attempting to cast them to the appropriate class using their fact handles fails with a ClassCastException.
Steps to reproduce:
Define a ruleset with a declared fact class, a query that searches for facts of that class, and a rule that executes that query and performs some operation on the matching facts.
Insert one of those facts into working memory
Call
DroolsCorrelationEngine#reloadConfig(true)
(optionally by sending a reloadDaemonConfig event)Insert another fact
Trigger the rule to execute the query and perform operations on matching facts
Expected behavior:
The query should find all inserted facts and perform the desired operation on them
Actual behavior:
The fact inserted before
reloadConfig
was called is not found by the query, but the one inserted into the current session is found.Drools offers
marshall
andunmarshall
methods that use protobuf for serializing and deserializing working memory safely.Test case attached.