Bug 863502 - EMS ConnectionFactory.discoverServerClasses can throw OutOfMemoryError
Summary: EMS ConnectionFactory.discoverServerClasses can throw OutOfMemoryError
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Plugins
Version: 4.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: RHQ 4.9
Assignee: Rémy Maucherat
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-05 16:06 UTC by Elias Ross
Modified: 2014-03-26 08:31 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-03-26 08:31:03 UTC
Embargoed:


Attachments (Terms of Use)
Addresses OutOfMemoryError in EMS (2.21 KB, application/octet-stream)
2012-10-05 16:06 UTC, Elias Ross
no flags Details
Search recursively for EMS connection classes in HOME/lib instead of HOME (HOME/server/lib on Tomcat 5.5) (3.54 KB, patch)
2013-07-11 10:43 UTC, Thomas Segismont
no flags Details | Diff

Description Elias Ross 2012-10-05 16:06:49 UTC
Created attachment 622290 [details]
Addresses OutOfMemoryError in EMS

I have a Tomcat installation with a lot of files in a server directory. So many files that it is an issue finding the server classes.

This is what I see.

Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
        at java.nio.ByteBuffer.wrap(ByteBuffer.java:350)
        at java.lang.StringCoding$StringDecoder.decode(StringCoding.java:137)
        at java.lang.StringCoding.decode(StringCoding.java:173)
        at java.lang.String.<init>(String.java:443)
        at java.lang.String.<init>(String.java:515)
        at java.io.UnixFileSystem.list(Native Method)
        at java.io.File.list(File.java:973)
        at java.io.File.listFiles(File.java:1051)
        at org.mc4j.ems.connection.ConnectionFactory.findFile(ConnectionFactory.java:241)
        at org.mc4j.ems.connection.ConnectionFactory.findFile(ConnectionFactory.java:246)
        at org.mc4j.ems.connection.ConnectionFactory.findFile(ConnectionFactory.java:246)
        at org.mc4j.ems.connection.ConnectionFactory.findFile(ConnectionFactory.java:235)
        at org.mc4j.ems.connection.ConnectionFactory.discoverServerClasses(ConnectionFactory.java:204)
        at org.jboss.on.plugins.tomcat.TomcatServerComponent.loadConnection(TomcatServerComponent.java:201)
        at org.jboss.on.plugins.tomcat.TomcatServerComponent.start(TomcatServerComponent.java:307)

The obvious improvement would be to catch the exception.

Patch is attached

Comment 1 Thomas Segismont 2013-07-01 13:25:08 UTC
How many files do you have in your server directory?

Which directory is it of the Tomcat server?

What kind of files are you storing there?

Comment 2 Elias Ross 2013-07-01 16:40:56 UTC
Probably tens or hundreds of thousands of files in a single directory. It was a directory that did not contain classes but data files.

I'm guessing this is not really a big issue but the plugin should not have been looking for classes in there.

Comment 3 Thomas Segismont 2013-07-03 12:06:40 UTC
Fixed in master 

commit faf0013f511894eb2c7b9ef14f87b5e87d657154
Author: Thomas Segismont <tsegismo>
Date:   Wed Jul 3 14:01:00 2013 +0200


Changed the libraryURI root: the plugin was looking for catalina jars from the CATALINA_HOME directory, instead of CATALINA_HOME/lib.

Now users can put any number of files in CATALINA_HOME, provided they're outside the lib directory.

Comment 4 Thomas Segismont 2013-07-03 15:07:27 UTC
Reverted. This needs to go through the EWS team

Comment 5 Thomas Segismont 2013-07-11 10:43:09 UTC
Created attachment 772164 [details]
Search recursively for EMS connection classes in HOME/lib instead of HOME (HOME/server/lib on Tomcat 5.5)

Comment 6 Rémy Maucherat 2013-07-11 13:45:48 UTC
The new patch is looking good, and can be backported if needed as it will certainly support Tomcat 5.5 as well. In case the functionality is really required in some cases.
 
commit	794d564b16b697870ca92040f27acbcdcad63522 in master

Comment 7 Heiko W. Rupp 2014-03-26 08:31:03 UTC
Bulk closing now that 4.10 is out.

If you think an issue is not resolved, please open a new BZ and link to the existing one.


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