elk-tamer
elk-tamer

Reputation: 316

Optaplanner core dump @ ConditionEvaluator504f0cef2aeb46d49c660e07bfa907fd.evaluate

I'm getting a core dump from an Optaplanner web app using Spring Boot, with the message:

============== DEBUG MESSAGE: illegal bytecode sequence - method not verified ================

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_PRIV_INSTRUCTION (0xc0000096) at pc=0x00000251502459dd, pid=15424, tid=0x0000000000004250
#
# JRE version: Java(TM) SE Runtime Environment (8.0_261-b12) (build 1.8.0_261-b12)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.261-b12 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# j  ConditionEvaluator504f0cef2aeb46d49c660e07bfa907fd.evaluate(Lorg/drools/core/common/InternalFactHandle;Lorg/drools/core/common/InternalWorkingMemory;Lorg/drools/core/spi/Tuple;)Z+9
#

It looks like something to do with class loading, but I tried removing spring-boot-devtools from the pom file and it didn't help.

I'm using: Optaplanner version: 7.40.0.Final

Spring Boot: 2.2.7.RELEASE

Upvotes: 0

Views: 347

Answers (2)

elk-tamer
elk-tamer

Reputation: 316

The crash was happening only when I used certain rules in a drl for a NurseRostering type of planning problem.

This version of the rule causes the crash:

rule "selfScheduleOnly"
    when
        $assignment : ShiftAssignmentO(                                     
            employee != null, $employee : employee,  employee.isSelfScheduled(),
            $shift : shift)
        not $shiftOnRequest : ShiftRequestO(employee == $employee, shift == $shift )
    then
         scoreHolder.addHardConstraintMatch(kcontext,  -1);                  
end

This version does not:

rule "selfScheduleOnly"
    when
        $employee : EmployeeO(isSelfScheduled())
        $assignment : ShiftAssignmentO(                                      
            $employee == employee,  
            $shift : shift)
        not $shiftOnRequest : ShiftRequestO(employee == $employee, shift == $shift )
    then
         scoreHolder.addHardConstraintMatch(kcontext,  -1);                  
end

I recall reading that score corruption could be caused by referencing a property pointing to a fact instead of a direct reference to a fact, so it sort of makes sense. I haven't tried every combination, but it seemed to only be happening when the property being checked was a Boolean.

Upvotes: 1

Geoffrey De Smet
Geoffrey De Smet

Reputation: 27312

Try doing mvn dependency:tree or find another way to list all jars in your classpath.

All dependencies/jars starting with optaplanner, drools and kie should be the same version (7.40.0.Final in your case).

Upvotes: 1

Related Questions