You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
6.3.0 throws exception on AIX from AixCentralProcessor.java:113 #2228
After upgrading oshi-core from 6.2.2 to 6.3.0 I started getting errors when running on AIX:
java.lang.ArithmeticException: divide by zero
at oshi.hardware.platform.unix.aix.AixCentralProcessor.initProcessorCounts(AixCentralProcessor.java:113)
at oshi.hardware.common.AbstractCentralProcessor.<init>(AbstractCentralProcessor.java:65)
at oshi.hardware.platform.unix.aix.AixCentralProcessor.<init>(AixCentralProcessor.java:38)
at oshi.hardware.platform.unix.aix.AixHardwareAbstractionLayer.createProcessor(AixHardwareAbstractionLayer.java:55)
at oshi.util.Memoizer$1.get(Memoizer.java:61)
at oshi.hardware.common.AbstractHardwareAbstractionLayer.getProcessor(AbstractHardwareAbstractionLayer.java:48)
at sysmon.plugins.os_base.BaseProcessorExtension.getMetrics(BaseProcessorExtension.java:84)
Not really, as it should never be a fraction. The root cause appears to be that not all physical processors were in use, leading to a case where (current) logical processors was less than the (max) physical processors:
Quick fix (and should go in anyway) would be ensuring that the lpPerPp value is at least 1, but I'm not sure that's the complete solution. Other options in addition to this:
ensure physical processor count is never higher than logical processor count
use a different structure element than max to define physical proecessor count (probably online).
@mnellemann thanks for this bug report, do you have any suggestions on proper counting of physical processors in your particular configuration?
But here's a situation that would have resulted in the bug, stripped to what I think is relevant:
$ lparstat -i
Type : Shared-SMT
Entitled Capacity : 27.00
Online Virtual CPUs : 56
Maximum Virtual CPUs : 64
Minimum Virtual CPUs : 1
Maximum Physical CPUs in system : 64
Active Physical CPUs in system : 57
Active CPUs in Pool : 57
Physical CPU Percentage : 48.21%
This would give OSHI an lp count of 56 on 64 (max) physical processors, so max is wrong, but active would also be wrong. But it's also in a pool that provides an "entitlement" to the user, e.g., they are allotted processing on 27 of the 56 vCPUs (48.21%) although it is labeled "physical CPU percentage" which would imply 27 of 57 (47.37%).
It gets more complicated when you consider that the logical processor count (and list of LPs) is supposed to align with the per-processor metrics such as CPU ticks. Those are fetched by the perfstat_cpu() function, but the result there is variable:
This number represents the number of logical processors for which statistics are available. In a dynamic logical partitioning (DLPAR) environment, this number is the highest logical index of an online processor since the last reboot.
I'm thinking it may be best to just have OSHI report the max number of logical processors. Currently it reports from:
classperfstat_cpu_total_textendsStructure {
publicintncpus; // number of active logical processors
Perhaps it should come from the same structure (and use .max) as the physical processors:
classperfstat_partition_config_textendsStructure {
publicperfstat_value_tnumProcessors; // Number of Configured Physical Processors in frame/* Virtual CPU related Configuration */publicperfstat_value_tvcpus; // Min, Max and Online Virtual CPUs
Activity
mprins commentedon Oct 29, 2022
that seems to be a regression from #2198 see my comment: https://github.com/oshi/oshi/pull/2198/files#r1008699766
I think
lpPerPpshould be a float or doubledbwiddis commentedon Oct 29, 2022
Not really, as it should never be a fraction. The root cause appears to be that not all physical processors were in use, leading to a case where (current) logical processors was less than the (max) physical processors:
where
config.numProcessorshas these options:Quick fix (and should go in anyway) would be ensuring that the
lpPerPpvalue is at least 1, but I'm not sure that's the complete solution. Other options in addition to this:maxto define physical proecessor count (probablyonline).@mnellemann thanks for this bug report, do you have any suggestions on proper counting of physical processors in your particular configuration?
dbwiddis commentedon Oct 29, 2022
Here's a thread with some potential output.
I rather identify with this comment:
But here's a situation that would have resulted in the bug, stripped to what I think is relevant:
This would give OSHI an lp count of 56 on 64 (max) physical processors, so max is wrong, but active would also be wrong. But it's also in a pool that provides an "entitlement" to the user, e.g., they are allotted processing on 27 of the 56 vCPUs (48.21%) although it is labeled "physical CPU percentage" which would imply 27 of 57 (47.37%).
It gets more complicated when you consider that the logical processor count (and list of LPs) is supposed to align with the per-processor metrics such as CPU ticks. Those are fetched by the
perfstat_cpu()function, but the result there is variable:I'm thinking it may be best to just have OSHI report the max number of logical processors. Currently it reports from:
Perhaps it should come from the same structure (and use
.max) as the physical processors: