Bug 648784 - JON241: "java.lang.IllegalStateException" on custom Linux kernel (caused by platform Resource version returned by platform discovery being more than 50 chars in length)
JON241: "java.lang.IllegalStateException" on custom Linux kernel (caused by p...
Product: RHQ Project
Classification: Other
Component: No Component (Show other bugs)
All Linux
medium Severity medium (vote)
: ---
: ---
Assigned To: Ian Springer
Corey Welton
Depends On:
Blocks: jon241-bugs
  Show dependency treegraph
Reported: 2010-11-02 01:31 EDT by Charles Crouch
Modified: 2015-02-01 18:26 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 634306
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
a modified platform plugin to allow testing of the fix for this issue (96.40 KB, application/x-java-archive)
2011-01-05 16:18 EST, Ian Springer
no flags Details

  None (edit)
Description Charles Crouch 2010-11-02 01:31:55 EDT
+++ This bug was initially created as a clone of Bug #634306 +++

Description of problem:

I get a "java.lang.IllegalStateException: Neither a native nor a Java platform was discovered - this should never happen." error when trying to access the JBoss application server 6.0 management console on my machine.  This is probably because I have a custom Linux kernel.

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

My kernel info is:

uname -a
Linux smarlowpc.localdomain #1 SMP Thu Jun 17 01:49:34 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

The error from the AS server.log is here http://pastebin.com/N1ydwq76

--- Additional comment from ian.springer@redhat.com on 2010-09-16 11:32:21 EDT ---

The root cause of this is that the Resource version returned by the platform discovery component is longer than the max length allowed for the version field in the Resource entity. Here's the stack trace from the Agent log:

2010-09-14 13:50:28,840 DEBUG [org.rhq.core.pc.inventory.InventoryManager] (http- Executing platform scan...
2010-09-14 13:50:28,942 WARN  [org.rhq.core.pc.inventory.InventoryManager] (http- Platform plugin discovery failed - skipping: java.lang.Exception: Discovery component invocation failed.
        at org.rhq.core.pc.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:270) [:3.0.0.B06]
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [:1.6.0_20]
        at java.util.concurrent.FutureTask.run(FutureTask.java:138) [:1.6.0_20]
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_20]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_20]
        at java.lang.Thread.run(Thread.java:619) [:1.6.0_20]
Caused by: java.lang.IllegalArgumentException: Resource version is longer than maximum length (50) [Linux]
        at org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails.setResourceVersion(DiscoveredResourceDetails.java:201) [:3.0.0.B06]
        at org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails.<init>(DiscoveredResourceDetails.java:95) [:3.0.0.B06]
        at org.rhq.plugins.platform.PlatformDiscoveryComponent.discoverResources(PlatformDiscoveryComponent.java:76)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_20]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_20]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_20]
        at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_20]
        at org.rhq.core.pc.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:266) [:3.0.0.B06]
        ... 5 more

To address this, we could do:

1) make the platform plugin smart enough to abbreviate the version to <= 50 characters,


2) make the plugin container more lax if the version returned by the plugin is > 50 characters - it could log a warning and truncate the version to 50 chars.

--- Additional comment from ian.springer@redhat.com on 2010-09-16 18:30:36 EDT ---

Fixed in master (commit 08f582b) as follows:

- increase max length of Resource.version in RHQ_RESOURCE table from 50 to 100 chars
- make PC more forgiving if a discovery component returns a Resource details with a name, version, or description longer than the max length (the PC will log a warning and then truncate the value to the max length)

--- Additional comment from ian.springer@redhat.com on 2010-09-16 18:37:38 EDT ---

Fixed in release-3.0.0 branch (commit 8577501) but only the "make PC more forgiving" part.
Comment 1 Charles Crouch 2010-11-02 01:32:32 EDT
Test the "make PC more forgiving" part in JON2.4.1
Comment 2 Sunil Kondkar 2010-11-17 08:40:29 EST

Can you please provide the steps to verify the bug?
Comment 3 Scott Marlow 2010-11-17 10:52:23 EST

I hope Ian can provide better steps than I can.  I had installed a custom linux kernel that had a long name (over 50 characters).  Last week, I installed Fedora 14 and no longer have the custom kernel.

If it was up to me, the steps for testing this, would involve hacking the fixed Java class to use a hacked kernel name that is over 50 characters long.  That is probably easier than installing a custom kernel which would be much more hacking.  :)

Comment 4 Ian Springer 2011-01-05 16:17:52 EST
I'm attaching a hacked platform plugin jar whose platform discovery component will return a 100+ character version, specifically:

"xxxxxxxxx0xxxxxxxxx1xxxxxxxxx2xxxxxxxxx3xxxxxxxxx4xxxxxxxxx5xxxxxxxxx6xxxxxxxxx7xxxxxxxxx8xxxxxxxxx9This should get truncated."

When testing this on the release-3.0.0 branch this should get truncated to 50 characters (i.e. "xxxxxxxxx0xxxxxxxxx1xxxxxxxxx2xxxxxxxxx3xxxxxxxxx4") by the PC and a warning logged. When testing it on the master branch, it should get truncated to 100 characters (i.e. "xxxxxxxxx0xxxxxxxxx1xxxxxxxxx2xxxxxxxxx3xxxxxxxxx4xxxxxxxxx5xxxxxxxxx6xxxxxxxxx7xxxxxxxxx8xxxxxxxxx9") by the PC and a warning logged.
Comment 5 Ian Springer 2011-01-05 16:18:47 EST
Created attachment 471944 [details]
a modified platform plugin to allow testing of the fix for this issue
Comment 6 Corey Welton 2011-01-05 21:09:08 EST
QA Verified for JON 241.  The kernel name gets truncated to 50 characters and throws an appropriate warning in the agent log:

2011-01-05 16:34:54,471 WARN  [ResourceDiscoveryComponent.invoker.daemon-1] (rhq.core.pluginapi.inventory.DiscoveredResourceDetails)- Plugin error: Resource version [xxxxxxxxx0xxxxxxxxx1xxxxxxxxx2xxxxxxxxx3xxxxxxxxx4xxxxxxxxx5xxxxxxxxx6xxxxxxxxx7xxxxxxxxx8xxxxxxxxx9This should get truncated.] specified by [ResourceType[id=0, category=Platform, name=Linux, plugin=Platforms]] discovery component is longer than the maximum length (50 - truncating it to 50 characters...
Comment 7 Corey Welton 2011-05-23 21:13:14 EDT
Bookkeeping - closing bug - fixed in recent release.
Comment 8 Corey Welton 2011-05-23 21:13:15 EDT
Bookkeeping - closing bug - fixed in recent release.
Comment 9 Corey Welton 2011-05-23 21:13:15 EDT
Bookkeeping - closing bug - fixed in recent release.

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