Rikkola opened a new pull request, #7296:
URL: https://github.com/apache/incubator-kie/pull/7296

   Closes: https://github.com/apache/incubator-kie/issues/7286
   
   A rule whose path through the rule network is split into more than 32 
segments was silently skipped by the engine: it never fired and no error was 
reported. A path is split into a new segment wherever rules share a prefix of 
their conditions and then diverge, so a set of rules with long common prefixes 
can reach this limit.
   
   Each segment gets a bit in a mask that records whether the segment is linked 
(ready to evaluate). The bit was calculated with a 32-bit int, while the mask 
it is merged into is a 64-bit long. From the 33rd segment on, the shift 
overflowed to 0, so these segments could never be marked as linked and the rule 
never became active.
   
   Calculate the segment position bits as long in BuildtimeSegmentUtilities, 
SegmentMemorySupportImpl and EagerPhreakBuilder (1L << i instead of 1 << i).
   
   Add SegmentPosMaskOverflowTest, which builds 40 rules sharing a common 
prefix (the longest has 39 segments) and checks that all of them fire. Before 
the fix, rules 33 to 39 did not fire. The test includes a 'not' pattern at the 
position of segment 32, because the int bit for segment 31 is negative and 
sign-extends into the upper 32 bits of the long, which hides the overflow for 
the segments after it.
   
   Assisted-by: IBM Bob


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to