Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1113090

Summary: NPE when ParallelBenchmarkCount is higher than availableProcessorCount.
Product: [Retired] JBoss BRMS Platform 6 Reporter: jvahala
Component: OptaPlannerAssignee: Geoffrey De Smet <gdesmet>
Status: CLOSED EOL QA Contact: Lukáš Petrovický <lpetrovi>
Severity: low Docs Contact:
Priority: low    
Version: 6.0.2CC: kverlaen, lpetrovi
Target Milestone: DR2   
Target Release: 6.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-27 19:08:30 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
failConfig none

Description jvahala 2014-06-25 12:25:09 UTC
Description of problem:
In PlannerBenchmarkConfig is logger null if config is created by XMLConfigFactory. That causes NPE when parallelBenchmarkCount is higher than availableProcessorCount.

How reproducible:
1. Take any benchmark XML config and set parallelBenchmarkCount higher than your CPU threads count.
2. parse it by XmlConfigFactory.
3. build Benchmark.

Actual results:
NPE

Expected results:
initialized logger

Comment 2 jvahala 2014-06-30 12:35:16 UTC
Created attachment 913396 [details]
failConfig

my CPU have 2(4) cores, so <parallelBenchmarkCount>10</parallelBenchmarkCount> is enough for throwing NPE

Comment 3 jvahala 2014-06-30 12:36:35 UTC
as addition: 
java.lang.NullPointerException: null
	at org.optaplanner.benchmark.config.PlannerBenchmarkConfig.resolveParallelBenchmarkCount(PlannerBenchmarkConfig.java:379)
	at org.optaplanner.benchmark.config.PlannerBenchmarkConfig.buildPlannerBenchmark(PlannerBenchmarkConfig.java:210)

Comment 4 Geoffrey De Smet 2014-07-22 15:59:19 UTC
Nice catch!

Fixed on master for community 6.2.0.Beta2 (and production tags are coming from master currently, so you should get it with the next tag).
  https://github.com/droolsjbpm/optaplanner/commit/1ea94837b13c2402d748c50a7d2366b6d528b1fa


Similar issue for the score config was fixed in the same commit.

Comment 5 Geoffrey De Smet 2014-07-22 16:00:53 UTC
The log now nicely warns and the benchmark continues:
  2014-07-22 17:55:06,660 [main] WARN  Because the resolvedParallelBenchmarkCount (9) is higher than the availableProcessorCount (4), it is reduced to availableProcessorCount.
  ...

Comment 6 jvahala 2014-09-19 11:40:05 UTC
Verified.