Bug 1278059

Summary: String.compareTo() in jitted constraint does not work correctly on Weblogic
Product: [Retired] JBoss BRMS Platform 6 Reporter: Hiroko Miura <hmiura>
Component: BREAssignee: Mario Fusco <mfusco>
Status: CLOSED EOL QA Contact: Marek Winkler <mwinkler>
Severity: medium Docs Contact:
Priority: high    
Version: 6.1.0CC: agiertli, etirelli, hmiura, mwinkler
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-27 19:04:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
reproducer of jit compilation problem on wls
none
reproducer:RuleTestServlet result on WLS
none
reproducer:JitCompileTest servlet result on WLS
none
reproducer:RuleTestServlet result on EAP (good)
none
reproducer:JitCompileTest servlet result on EAP (good) none

Description Hiroko Miura 2015-11-04 16:01:21 UTC
Created attachment 1089740 [details]
reproducer of jit compilation problem on wls

Description of problem:
When String.compareTO() is used in constraint of decision table(XLS), the result of it becomes wrong on weblogic once jit compilation takes  place.
It works on EAP.

Version-Release number of selected component (if applicable):
6.1.x


How reproducible:

reproducer is attached.


Steps to Reproduce:
1. deploy servlet application
2. fire rules more than 20 times with same fact(s)
3.

Actual results:
result of rule evaluation become wrong  


Expected results:
result of rule evaluation is same even after jit compilation


Additional info:

Comment 2 Edson Tirelli 2015-11-04 16:37:01 UTC
Is this Weblogic related or JVM related? By the description, I would guess it must be JVM, since the engine compiles down to bytecode without any "involvement" of weblogic in the process.

Can you please:

1. let us know which JVM is being used?

2. clarify what do you mean by "becomes wrong"?

Thank you

Comment 5 Hiroko Miura 2015-11-04 17:08:58 UTC
1. let us know which JVM is being used?

=> OracleJDK(HotSpot) 1.7.0_71 with both WLS and EAP.


2. clarify what do you mean by "becomes wrong"?

=> Please see screen shot attached.

Comment 6 Hiroko Miura 2015-11-05 01:05:41 UTC
Created attachment 1089927 [details]
reproducer:RuleTestServlet result on WLS

Comment 7 Hiroko Miura 2015-11-05 01:06:44 UTC
Created attachment 1089928 [details]
reproducer:JitCompileTest servlet result on WLS

Comment 8 Hiroko Miura 2015-11-05 01:07:34 UTC
Created attachment 1089929 [details]
reproducer:RuleTestServlet result on EAP (good)

Comment 9 Hiroko Miura 2015-11-05 01:08:22 UTC
Created attachment 1089930 [details]
reproducer:JitCompileTest servlet result on EAP (good)

Comment 10 Hiroko Miura 2015-11-06 08:05:19 UTC
Here is a workaround we confirmed so far.

- This does not happen if JIT is turned off like the following.

   kieBaseConfiguration.setProperty("drools.permgenThreshold", "0");
  
- This does not happen if the problematic constraint is changed 

  from  xxx.compareTo(yyy) <= 0
  to    xxx <= yyy

Comment 11 Mario Fusco 2015-11-06 09:48:43 UTC
In reality what is not working is a constraint in the form

  (xxx).compareTo(yyy) <= 0

If you change it in 

  xxx.compareTo(yyy) <= 0

it works as expected. 

This problem has been already reported here https://issues.jboss.org/browse/DROOLS-900 and fixed by this commit https://github.com/droolsjbpm/drools/commit/a2ab9d4b96641f042187a5b833dd3ae4ef8bde64 

I checked on eap that using Drools 6.2.0.Final the constraint "(xxx).compareTo(yyy) <= 0" generates the warning but "xxx.compareTo(yyy) <= 0" works correctly. Conversely on 6.3.0.Final, that contains that fix, also "(xxx).compareTo(yyy) <= 0" works without generating any warning.

Marek, can you please confirm that the same commit also fixes the issue under WebLogic?

Comment 13 Edson Tirelli 2015-11-06 15:41:14 UTC
Setting the ticket to MODIFIED as this is already fixed in 6.2 product as per Mario's comment. If the fix needs to be backported to 6.1 product, please open the appropriate BZ targeting the next update patch.