Bug 1017474 - Baseline calculation attempts to bind NaN, Overflow Exception for Oracle
Summary: Baseline calculation attempts to bind NaN, Overflow Exception for Oracle
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Core Server
Version: 4.9
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: GA
: RHQ 4.10
Assignee: Stefan Negrea
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks: 1028173
TreeView+ depends on / blocked
 
Reported: 2013-10-10 01:10 UTC by Elias Ross
Modified: 2014-03-25 21:01 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
: 1028173 (view as bug list)
Environment:
Last Closed: 2014-03-25 21:01:09 UTC
Embargoed:


Attachments (Terms of Use)

Description Elias Ross 2013-10-10 01:10:55 UTC
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:11.2.0.2.0]
	at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:216) [ojdbc6.jar:11.2.0.2.0]
....

Comment 1 Elias Ross 2013-11-07 15:00:33 UTC
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();
             baseline.setMax(max);

^^ Not tested but maybe will work

Comment 2 Stefan Negrea 2013-11-07 15:33:32 UTC
Elias,

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 16:05:47 UTC
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 20:52:10 UTC
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:
https://git.fedorahosted.org/cgit/rhq/rhq.git/commit/?id=71881da03946bcd19253b743bfbfac7a578db245


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