[jboss-jira] [JBoss JIRA] (JBRULES-3439) NPE in AbstractTabuAcceptor.stepTaken
Chris Dolan (JIRA)
jira-events at lists.jboss.org
Mon Apr 9 16:18:47 EDT 2012
[ https://issues.jboss.org/browse/JBRULES-3439?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12682521#comment-12682521 ]
Chris Dolan commented on JBRULES-3439:
--------------------------------------
Yes, that's the exact spot in the code.
I put a breakpoint in the code with condition "oldTabuStepIndexInteger == null". I found that oldTabu is an instance of my planning entity class. That instance also appears in the tabuToStepIndexMap, but the map has cached the **wrong hashCode**! So, it appears that my planning entity instance was mutated after it was added to the map. That should be impossible, right? My cloneSolution() method in my solution class carefully deep-clones the planning entity instances so they can't propagate to other solutions.
Either I need to change my .hashCode() and .equals() of my planning entity class to ignore the planning variable (is that the point of the .solutionHashCode()? I've been wondering what that's all about...) or else there's a bug in the tabu code?
> NPE in AbstractTabuAcceptor.stepTaken
> -------------------------------------
>
> Key: JBRULES-3439
> URL: https://issues.jboss.org/browse/JBRULES-3439
> Project: Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: drools-planner
> Affects Versions: 5.4.0.Beta2
> Environment: drools-planner-example 5.4.0-SNAPSHOT pulled via Maven on March 29. I believe this corresponds to https://github.com/droolsjbpm/drools-planner/commit/ba38344b7563830eb2a725f78c03be043b1c1f65
> Reporter: Chris Dolan
> Assignee: Geoffrey De Smet
> Priority: Critical
>
> I know this is a weak bug report and I apologize in advance for that...
> I'm writing integration tests for my solver configuration. My code seems to work in my GUI (subclass of CommonApp) but it fails under my junit test. I'm quite new to Drools and Planner so I wouldn't be surprised if the root cause is my fault, but I think a NPE is bad news.
> {noformat}
> 2012-03-30 15:26:05,743 INFO [DefaultSolver.java:172] Solving started: time spend (25), score (-2hard/-26soft), new best score (-2hard/-26soft), random seed (0). - o.d.p.c.s.DefaultSolver
> 2012-03-30 15:26:05,786 DEBUG [DefaultLocalSearchSolverPhase.java:109] Step index (0), time spend (68), score (-1hard/-22soft), new best score (-1hard/-22soft), accepted move size (8) for picked step (JobSlot(s2,0) => Job(j1)). - o.d.p.c.l.DefaultLocalSearchSolverPhase
> 2012-03-30 15:26:05,815 DEBUG [DefaultLocalSearchSolverPhase.java:109] Step index (1), time spend (97), score (0hard/-8soft), new best score (0hard/-8soft), accepted move size (11) for picked step (JobSlot(s1,0) => Job(j2)). - o.d.p.c.l.DefaultLocalSearchSolverPhase
> 2012-03-30 15:26:05,831 DEBUG [DefaultLocalSearchSolverPhase.java:109] Step index (2), time spend (113), score (0hard/-4soft), new best score (0hard/-4soft), accepted move size (13) for picked step (JobSlot(s1,1) => Job(j1)). - o.d.p.c.l.DefaultLocalSearchSolverPhase
> 2012-03-30 15:26:05,845 DEBUG [DefaultLocalSearchSolverPhase.java:109] Step index (3), time spend (127), score (0hard/-2soft), new best score (0hard/-2soft), accepted move size (13) for picked step (JobSlot(s2,1) => Job(j2)). - o.d.p.c.l.DefaultLocalSearchSolverPhase
> java.lang.NullPointerException
> at org.drools.planner.core.localsearch.decider.acceptor.tabu.AbstractTabuAcceptor.stepTaken(AbstractTabuAcceptor.java:163)
> at org.drools.planner.core.localsearch.decider.DefaultDecider.stepTaken(DefaultDecider.java:167)
> at org.drools.planner.core.localsearch.DefaultLocalSearchSolverPhase.stepTaken(DefaultLocalSearchSolverPhase.java:107)
> at org.drools.planner.core.localsearch.DefaultLocalSearchSolverPhase.solve(DefaultLocalSearchSolverPhase.java:71)
> at org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:181)
> at org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:150)
> {noformat}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list