Bug 1017474 - Baseline calculation attempts to bind NaN, Overflow Exception for Oracle
Baseline calculation attempts to bind NaN, Overflow Exception for Oracle
Product: RHQ Project
Classification: Other
Component: Core Server (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified (vote)
: GA
: RHQ 4.10
Assigned To: Stefan Negrea
Mike Foley
Depends On:
Blocks: 1028173
  Show dependency treegraph
Reported: 2013-10-09 21:10 EDT by Elias Ross
Modified: 2014-03-25 17:01 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1028173 (view as bug list)
Last Closed: 2014-03-25 17:01:09 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Elias Ross 2013-10-09 21:10:55 EDT
See Bug 993513

This is RHQ 4.9, however.

01:05:17,366 ERROR [org.jboss.as.ejb3.invocation] (RHQScheduler_Worker-4) JBAS014134: EJB Invocation failed on component MeasurementBaselineManagerBean for method public abstract void org.rhq.enterprise.server.measurement.MeasurementBaselineManagerLocal.calculateAutoBaselines(): javax.ejb.EJBException: java.lang.RuntimeException: Auto-calculation failure
	at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInNoTx(CMTTxInterceptor.java:191) [jboss-as-ejb3-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
	at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInNoTx(CMTTxInterceptor.java:237) [jboss-as-ejb3-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]
	at org.jboss.as.ejb3.tx.CMTTxInterceptor.never(CMTTxInterceptor.java:285) [jboss-as-ejb3-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]

	at org.rhq.enterprise.server.measurement.MeasurementBaselineManagerLocal$$$view12.saveNewBaselines(Unknown Source) [rhq-server.jar:4.9.0]
	at org.rhq.enterprise.server.measurement.MeasurementBaselineManagerBean.calculateBaselines(MeasurementBaselineManagerBean.java:280) [rhq-server.jar:4.9.0]


Caused by: java.sql.BatchUpdateException: Internal Error: Overflow Exception trying to bind NaN
	at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10296) [ojdbc6.jar:]
	at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:216) [ojdbc6.jar:]
Comment 1 Elias Ross 2013-11-07 10:00:33 EST
diff --git a/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/MetricsBaselineCalculator.java b/modules/enterprise/server/server-metrics/src/main/java
index ef7d092..f132135 100644
--- a/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/MetricsBaselineCalculator.java
+++ b/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/MetricsBaselineCalculator.java
@@ -98,6 +98,9 @@ private MeasurementBaseline calculateBaseline(Integer schedule, long startTime,
+            if (Double.isNaN(max) || Double.isNaN(min)) {
+                return null; // do not record this
+            }
             MeasurementBaseline baseline = new MeasurementBaseline();

^^ Not tested but maybe will work
Comment 2 Stefan Negrea 2013-11-07 10:33:32 EST

Your proposed fix would address something that is not possible. All aggregates have min, max and average; so adding that statement there only prevents cases where data was deleted maliciously from the storage nodes by users and not RHQ.

Do you have any other logs or data on how this is happening? Sample data or reproductions steps would greatly helps us fix the root cause of the issue.

Also, is this an upgrade from a prior version of RHQ or it is a fresh install?
Comment 3 Elias Ross 2013-11-07 11:05:47 EST
Not possible?

The original bug was after an upgrade of a test cluster, so maybe some old data is a problem. I've recently seen the problem after my main server upgrade today, which was nearly a week ago.

I've had problems with my Cassandra cluster, where data has been coming up empty. Meaning, you query it and the expected data is not there. Could this cause an issue? I've seen 0 avg, NaN on min/max in the UI, for the metrics table. So there are NaNs someplace.

Even if my fix fixes something that is not possible, it fixes something I've seen on two servers. I've had to disable baseline calculation.
Comment 4 Stefan Negrea 2013-11-07 15:52:10 EST
Elias, thanks for reporting the issue and a fix. There are two scenario that could lead to the problem you've reported; the data for a schedule is not completely persisted when the query for baselines runs or the data is not complete (delete or missing entries). I applied your proposed fix along with a comment. By returning null, the baseline calculation for the particular schedule will be postponed until the next data purge run.

master branch commit:

Note You need to log in before you can comment on or make changes to this bug.