Bug 1269420 - Uninformative SQL error on insert on RHQ_CONFIG_DEF table when agent plug-in has a property name defined that exceeds 100 characters in length
Uninformative SQL error on insert on RHQ_CONFIG_DEF table when agent plug-in ...
Status: CLOSED ERRATA
Product: JBoss Operations Network
Classification: JBoss
Component: Database, Core Server (Show other bugs)
JON 3.3.0
Unspecified Unspecified
medium Severity medium
: ER01
: JON 3.3.5
Assigned To: Michael Burman
Jeeva Kandasamy
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-07 05:59 EDT by Harshada
Modified: 2016-02-03 10:03 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-02-03 10:03:25 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
CustomPlugin (2.96 KB, application/zip)
2015-10-07 05:59 EDT, Harshada
no flags Details

  None (edit)
Description Harshada 2015-10-07 05:59:55 EDT
Created attachment 1080588 [details]
CustomPlugin

Description of problem:
Trying to delpoy a custom plugin(see attachment). The plugin deployment fails due to the length of the value for the "name " column in RHQ_CONFIG_DEF table exceeds 100 characters. The actual length of the column "name" in RHQ_CONFIG_DEF table is 100 character whereas 
here "CustomerServiceCommunicatorImpl$Proxy$_$$_WeldSubclass getCustomerInformationByProductionNumber Errors" which is 102 characters long is being inserted in the "name" column and therefore the deplpoyment fails.


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.In the GUI, Upload the plugin attached or keep the plugin at the JON_HOME/plugins folder.
2.Click on "Scan for Updates".
3.

Actual results: Following error is seen with postgres : 

---------------------------------------------------------------
14:30:14,311 ERROR [org.rhq.enterprise.server.core.plugin.ProductPluginDeployer] (EJB default - 2) Failed to register RHQ plugin file [file:/NotBackedUp/harshada/Cases/MyCases/JON/test1/jon-server-3.3.0.GA/modules/org/rhq/server-startup/main/deployments/rhq.ear/rhq-downloads/rhq-plugins/simq-jon-agent-1.0.1-SNAPSHOT.jar]: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
	.....
        .....
Caused by: javax.transaction.RollbackException: ARJUNA016053: Could not commit transaction.
        .....
        .....
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not execute batch
       
       ......
Caused by: org.hibernate.exception.DataException: could not execute batch
       ......
Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into RHQ_CONFIG_DEF (config_format, description, name, id) values ('STRUCTURED', NULL, 'CustomerServiceCommunicatorImpl$Proxy$_$$_WeldSubclass getCustomerInformationByProductionNumber Errors', 12162) was aborted.  Call getNextException to see the cause.
        at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2746)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1887)
        ....
        ....
--------------------------------------------------------------------------------



Expected results: The insert query should be successfully executed and the plugin sould be deployed


Additional info: With Oracle database, following log is seen:
-----------------------------------------------------------------------------
...
11:43:39,173 INFO  [org.rhq.enterprise.server.core.plugin.ProductPluginDeployer] (http-/0.0.0.0:7080-2) Discovered agent plugin [SimQ-JMX]
11:43:39,182 INFO  [org.rhq.enterprise.server.core.plugin.ProductPluginDeployer] (http-/0.0.0.0:7080-2) Deploying [1] new or updated agent plugins: [SimQ-JMX]
11:43:39,248 INFO  [org.rhq.enterprise.server.resource.metadata.ResourceMetadataManagerBean] (http-/0.0.0.0:7080-2) Updating resource type [SimQ-JMX:CustomerServiceCommunicatorImpl$Proxy$_$$_WeldSubclass getCustomerInformationByProductionNumber Errors(id=0)]...
11:43:39,267 INFO  [org.rhq.enterprise.server.resource.metadata.ResourceMetadataManagerBean] (http-/0.0.0.0:7080-2) Persisting new ResourceType [SimQ-JMX:CustomerServiceCommunicatorImpl$Proxy$_$$_WeldSubclass getCustomerInformationByProductionNumber Errors(id=0)]...
11:43:39,316 INFO  [org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl] (http-/0.0.0.0:7080-2) HHH000010: On release of batch it still contained JDBC statements
11:43:39,316 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-/0.0.0.0:7080-2) SQL Error: 12899, SQLState: 72000
11:43:39,316 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-/0.0.0.0:7080-2) ORA-12899: value too large for column "JON333"."RHQ_CONFIG_DEF"."NAME" (actual: 102, maximum: 100)

11:43:39,316 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-/0.0.0.0:7080-2) SQL Error: 12899, SQLState: 72000
11:43:39,317 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-/0.0.0.0:7080-2) ORA-12899: value too large for column "JON333"."RHQ_CONFIG_DEF"."NAME" (actual: 102, maximum: 100)

11:43:39,318 ERROR [org.hibernate.engine.jdbc.batch.internal.BatchingBatch] (http-/0.0.0.0:7080-2) HHH000315: Exception executing batch [could not execute batch]
11:43:39,319 WARN  [com.arjuna.ats.arjuna] (http-/0.0.0.0:7080-2) ARJUNA012125: TwoPhaseCoordinator.beforeCompletion - failed for SynchronizationImple< 0:ffff0a210137:2887e216:560d0d1f:2393, org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization@76b2447f >: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute batch
...
-------------------------------------------------------------------------
Comment 1 Larry O'Leary 2015-11-02 12:05:00 EST
It is understandable that the database schema imposes this column value limit of 100 characters. Although it would be nice that a longer value be allowed, that is not a realistic expectation for a bug report. 

However, for the bug report, we should be performing data validation and reporting a meaningful/usable error to the user. When an attempt to install the plug-in is made, the error should clearly indicate which value/property from the plug-in is the offending one and what needs to be done to resolve it.
Comment 2 Michael Burman 2015-11-13 07:21:42 EST
Fixed in the master (note, sort of. I can only see this exception being logged in the 3.3.x, not on the master as there it just fails silently.. but there's no clear difference between the two so most likely some logging issue).

commit 42fc37f7301a994df95dbd5f59bdf9742fb27dad
Author: Michael Burman <miburman@redhat.com>
Date:   Fri Nov 13 14:20:09 2015 +0200

    [BZ 1269420] Validate the resourceType names lengths to be less or equal to 100 characters
Comment 3 Simeon Pinder 2015-11-23 10:33:54 EST
 branch: release/jon3.3.x
 commit: a1010a0bb76f9d679bcd382c5afa2f7c3257a9fd
 Author:     Michael Burman <miburman@redhat.com>
 AuthorDate: Fri Nov 13 14:20:09 2015 +0200
 Commit:     Simeon Pinder <spinder@fulliautomatix.conchfritter.com>
 CommitDate: Mon Nov 23 10:24:40 2015 -0500
     [BZ 1269420] Validate the resourceType names lengths to be less or equal to 100 characters
Comment 4 Simeon Pinder 2015-12-09 01:29:24 EST
Moving to ON_QA as available to test with the following brew build:

JON Cumulative patch build: https://brewweb.devel.redhat.com/buildinfo?buildID=469635
  *Note: jon-server-patch-3.3.0.GA.zip maps to DR01 build of jon-server-3.3.0.GA-update-05.zip.
Comment 8 Larry O'Leary 2016-01-07 09:37:39 EST
For clarity, as described in comment 1, the 100 character limit is correct and cannot be changed.

What this fix addresses is the confusing database specific error message that makes its way to the user/logs. The updated behavior should indicate that the 100 character limit for the name value has been exceeded and therefore the plug-in is not allowed/valid.
Comment 9 Jeeva Kandasamy 2016-01-22 11:19:29 EST
JBoss ON: JON 3.3.5 ER1
Version : 3.3.0.GA Update 05
Build Number : 4242930:1c9f74b

As mentioned in the comment #8 user can understand what went wrong.

Error message:
----------------
11:15:01,765 INFO  [org.rhq.enterprise.server.core.plugin.ProductPluginDeployer] (EJB default - 5) Deploying [1] new or updated agent plugins: [SimQ-JMX]
11:15:01,833 ERROR [org.rhq.core.clientapi.agent.metadata.PluginMetadataManager] (EJB default - 5) Error transforming plugin descriptor [SimQ-JMX].: org.rhq.core.clientapi.agent.metadata.InvalidPluginDescriptorException: Type [ResourceType[id=0, name=CustomerServiceCommunicatorImpl$Proxy$_$$_WeldSubclass getCustomerInformationByProductionNumber Errors, plugin=SimQ-JMX, category=Service]] has longer name than allowed 100 characters.
	at org.rhq.core.clientapi.agent.metadata.PluginMetadataManager.loadPlugin(PluginMetadataManager.java:209) [rhq-core-client-api-4.12.0.JON330GA-redhat-1.jar:4.12.0.JON330GA-redhat-1]
	at org.rhq.enterprise.server.resource.metadata.PluginManagerBean.registerPluginTypes(PluginManagerBean.java:574) [rhq-server.jar:4.12.0.JON330GA-redhat-5]
Comment 11 errata-xmlrpc 2016-02-03 10:03:25 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2016-0118.html

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