Bug 748448 - Purged plugin in RHQ Server fail
Summary: Purged plugin in RHQ Server fail
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Plugins
Version: 4.0.1
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: ---
: RHQ 4.3.0
Assignee: RHQ Project Maintainer
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-10-24 14:00 UTC by Bruno Leite Alves
Modified: 2013-09-12 21:22 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-09-12 21:22:25 UTC
Embargoed:


Attachments (Terms of Use)
Log of RHQ Server (3.81 MB, application/octet-stream)
2011-10-24 14:14 UTC, Bruno Leite Alves
no flags Details
XML do plugin rhq (2.51 KB, text/xml)
2011-10-24 19:27 UTC, Bruno Leite Alves
no flags Details

Description Bruno Leite Alves 2011-10-24 14:00:37 UTC
Description of problem: Purged plugin in RHQ Server fail


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


How reproducible:


Steps to Reproduce:
1. Disabled plugin
2. Deleted plugin
3. Purged plugin
  
Actual results:
The RHQ Server return "NoResultException" when click in the plugin in the list to see the detail. When click in purged again, the system show the message that the plugin will purge, but doesn't purge.

Expected results:
Plugin purged.

Additional info:
In the database (postgre) the status of plugin was just "deleted". I deleted the plugin "by hand" in the database and then the plugin left of the list.

Comment 1 Bruno Leite Alves 2011-10-24 14:14:01 UTC
Created attachment 529880 [details]
Log of RHQ Server

Log of RHQ Server

Comment 2 John Mazzitelli 2011-10-24 14:29:53 UTC
This is the error that causes the problem:

2011-10-24 10:27:35,443 INFO  [org.rhq.enterprise.server.core.plugin.AgentPluginScanner] Plugin file [C:\rhq-server-4.0.1\jbossas\server\default\deploy\rhq.ear\rhq-downloads\rhq-plugins\pdvexpert-rhqplugin-0.9.2-SNAPSHOT.jar] has been deleted from the file system.

2011-10-24 10:28:02,081 INFO  [org.rhq.enterprise.server.resource.metadata.PluginManagerBean] Scheduling plugin [AgentPlugin [id=10051, name=PdvExpertJmxPlugin, md5=d23db50eb155f223291d835fd470a7f3]] to be purged from the database.

2011-10-24 10:30:04,355 WARN  [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: 22025

2011-10-24 10:30:04,355 ERROR [org.hibernate.util.JDBCExceptionReporter] ERRO: cadeia de caracteres de escape inválida
  Hint: Cadeia de caracteres de escape deve ser vazia ou ter um caracter.

2011-10-24 10:30:04,357 ERROR [org.rhq.enterprise.server.scheduler.jobs.AbstractStatefulJob] Failed to execute job [PurgePluginsJob]

javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.DataException: could not execute query


Unknown why this happened. Postgres error 22025: Invalid escape sequence: HINT: Escape string must be empty or one character.

I wonder if it had something to do with the filename being a Windows path that has backslashes??? That's the only thing I can think of that would be "escaped" in the query. But this is just a wild guess, because I know this worked on Windows before.

Comment 3 John Mazzitelli 2011-10-24 14:39:58 UTC
looking closer at the stack trace, I see this is where it technically failed:

Caused by: javax.persistence.PersistenceException:
org.hibernate.exception.DataException: could not execute query
 at
org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
 at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:99)
 at
org.rhq.enterprise.server.util.CriteriaQueryRunner.getCount(CriteriaQueryRunner.java:124)
 at
org.rhq.enterprise.server.util.CriteriaQueryRunner.execute(CriteriaQueryRunner.java:76)
 at
org.rhq.enterprise.server.resource.ResourceTypeManagerBean.findResourceTypesByCriteria(ResourceTypeManagerBean.java:474)
...
 at $Proxy214.findResourceTypesByCriteria(Unknown Source)
 at org.rhq.enterprise.server.resource.metadata.PluginManagerBean.isReadyForPurge(PluginManagerBean.java:108)

Here's the code building the criteria that gets the types:

    public boolean isReadyForPurge(Plugin plugin) {
        ResourceTypeCriteria criteria = new ResourceTypeCriteria();
        criteria.addFilterPluginName(plugin.getName());
        criteria.setRestriction(Criteria.Restriction.COUNT_ONLY);
        PageList results =
resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(),
criteria);
        return results.getTotalSize() == 0;
    }

Is it possible for you to attach the plugin jar to this BZ, or at least attach
the plugin descriptor .xml?

Comment 4 Bruno Leite Alves 2011-10-24 19:27:59 UTC
Created attachment 529952 [details]
XML do plugin rhq

XML do plugin rhq

Comment 5 Charles Crouch 2011-10-31 15:59:01 UTC
(10:53:14 AM) mazz: I never figured out what the issue there was. Looks like it 
was happening when doing development of a plugin and doing the delete/purge 
cycle somehow screwed up.
(10:53:33 AM) mazz: we'd need to replicate over here to get a good sense of 
what the problem is
(10:54:07 AM) mazz: Postgres error 22025: Invalid escape sequence: HINT: Escape 
string must be empty or one character.
(10:54:19 AM) mazz: that's the cause - I have a sense it might be an i18n'ish 
issue
(10:54:42 AM) mazz: but I really don't know. need to replicate
(10:55:05 AM) ccrouch: mazz: did the rhq-plugin.xml he added help?
(10:56:01 AM) mazz: not by visual inspection. I was actually looking to see 
what his plugin name was - perhaps it had some non-English/ASCII characters in 
it.
(10:56:03 AM) mazz: it doesn't
(10:56:16 AM) mazz: the description had some spanish chars in it
(10:56:31 AM) mazz: but I never actually ran a test with this to see if that 
really would cause problems
(10:56:35 AM) mazz: we only query on the plugin name

Comment 6 John Mazzitelli 2011-10-31 18:51:51 UTC
what version of Postgres are you using? If its 9.1, this sounds like bug #741855 - it too mentions:

   Caused by: org.postgresql.util.PSQLException: ERROR: invalid escape string
     Escape string must be empty or one character.

Please read that issue and see if its suggestion corrects the problem. I suspect that is the cause for your issue (since the error looks to be the same).

Comment 7 Jay Shaughnessy 2013-09-12 21:22:25 UTC
There has been a lot of work in this area and I believe the issue has been resolved.  Never received any requested info.  Closing as CURRENTRELEASE.  Please open a new BZ if the issue is rediscovered.


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