-
1. Re: Random OutOfMemoryError on the initial deploy of conf/jb
dimitris Jan 5, 2006 1:39 PM (in response to dimitris)Scott:
I would think we need to pass in the container directory of the standalone descriptor as the localURL for the case of a standalone, unpackaged sar descriptor. For the unpacked case we are passing in the sar directory correct? -
2. Re: Random OutOfMemoryError on the initial deploy of conf/jb
dimitris Jan 5, 2006 1:41 PM (in response to dimitris)Correct. But, if I understand, it doesn't seem appropriate to pass in ./conf for conf/jboss-service.xml or ./deploy for deploy/ejb-deployer.xml.
The OOM error comes from the UCL loader, not when using the URLClassLoader on the DeploymentInfo.localUrl. -
3. Re: Random OutOfMemoryError on the initial deploy of conf/jb
starksm64 Jan 5, 2006 2:37 PM (in response to dimitris)The UCL does not open any resources so I don't know what you mean by by the OOME coming from the UCL. All actual class/resource file opens are done by the parent URLClassLoader so I would say its the non-jar file classpath elements that lead to the problem. I would agree that just putting the descriptor containing directory on the classpath will likely lead to undesirable results.
-
4. Re: Random OutOfMemoryError on the initial deploy of conf/jb
dimitris Jan 5, 2006 3:32 PM (in response to dimitris)Ok, I meant the parent URLClassLoader.
I was wondering if a URLClassLoader initialized to an empty URL[] is valid, so we can use this for plain xml descriptor deployments (like conf/jboss-service.xml). I guess I can try it. -
5. Re: Random OutOfMemoryError on the initial deploy of conf/jb
starksm64 Jan 5, 2006 4:08 PM (in response to dimitris)The first question I have is, does this cause the OOME:
File someXML = new File(".../some.xml"); URL[] cp = {someXML.toURL()}; URLClassLoader ucl = new URLClassLoader(cp); ucl.findResource(...) or ucl.loadClass(...)
If it does then pursuing the removal xml descriptor is worth the time. If it does not, I don't think it is. -
6. Re: Random OutOfMemoryError on the initial deploy of conf/jb
dimitris Jan 5, 2006 4:52 PM (in response to dimitris)Got it! This following test produces OOM quite often (30%) at the very first class lookup.
I run it by pointing to the server/all/lib directory.
The OOM happens when I drop conf/jboss-service.xml in there.import java.io.File; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.util.Enumeration; import java.util.Properties; public class TestOOM { public static void main(String[] args) { outputSystemProperties(); File dir = new File(args[0]); File[] files = dir.listFiles(); URL[] cp = new URL[files.length]; for (int i = 0; i < files.length; i++) { try { cp = files.toURL(); System.out.println("#" + i + " " + cp); } catch (MalformedURLException ignore) { } } URLClassLoader ucl = new URLClassLoader(cp); long l = 0; while(true) { try { ucl.findResource("foo.bar.Class" + l); } catch (Throwable t) { // got it! t.printStackTrace(); System.out.println("l = " + l); break; } if (l++ % 1000 == 0) System.out.print("."); } } public static void outputSystemProperties() { System.out.println("+++ SYSTEM PROPERTIES BEGIN +++"); Properties props = System.getProperties(); Enumeration names = props.propertyNames(); while (names.hasMoreElements()) { String key = (String) names.nextElement(); String value = props.getProperty(key); System.out.println(key + "=" + value); } System.out.println("+++ SYSTEM PROPERTIES END +++"); } }
-
7. Re: Random OutOfMemoryError on the initial deploy of conf/jb
starksm64 Jan 5, 2006 7:46 PM (in response to dimitris)You have to include the other jars in there to cause this to happen?
-
8. Re: Random OutOfMemoryError on the initial deploy of conf/jb
dimitris Jan 6, 2006 4:48 AM (in response to dimitris)Yes, it happens when I point to the server/all/lib jars, plus any other (a) non empty (b) non jar file that (c) appears last in the URL[] list!
Weird -
9. Re: Random OutOfMemoryError on the initial deploy of conf/jb
dimitris Jan 8, 2006 5:48 PM (in response to dimitris)By passing 'null', as the first argument to "newClassLoader", when pointing to an .xml descriptor (in DeploymentInfo createClassLoaders() and setRepositoryInfo()) as shown below:
Object[] args = { isXML ? null : localUrl, origUrl, Boolean.TRUE }; String[] sig = { "java.net.URL", "java.net.URL", "boolean" }; ucl = (RepositoryClassLoader) server.invoke(repositoryConfig.repositoryName, "newClassLoader",args, sig);
... the OOM Error seems to go away in the initial boot phase, or at least, it didn't appear again in my tests.
Is there any other implication for not doing this change? -
10. Re: Random OutOfMemoryError on the initial deploy of conf/jb
starksm64 Jan 8, 2006 7:17 PM (in response to dimitris)The main concern will be what is the CodeSource for such a class loader in terms of how security policies are defined. Have you run the testsuite tests-security-manager to validate the behavior at a minimum?
-
11. Re: Random OutOfMemoryError on the initial deploy of conf/jb
dimitris Jan 9, 2006 4:09 AM (in response to dimitris)I tried tests-security-manager and it passes.
I am not familiar with CodeSource but I'd think if the UCL is associated with only an .xml descriptor (e.g. ejb-deployer.xml), no classes will ever be loaded from that one.
In the case of conf/jboss-service.xml, the URLs for the lib/* jars are added at a next step (ucl.addURL(jar)), so there shouldn't be a problem there.
Debugging some more, the above change doesn't eliminate ZipFile.open() on .xml descriptors. I saw ZipFiles created on the content of deploy-hasingleton/jms directory, as a result of an InitialContext() creation in HTTPServerILService.bindJNDIReferences (!). However, I didn't get any OOM Errors for that.
So, we can't possibly catch all execution paths to ZipFile.open on non-jar files but if this workaround doesn't do harm maybe we could try the change in HEAD and see who complaints.
I'll try reporting the issue to Sun, although I wouldn't expect a fix anytime soon. -
12. Re: Random OutOfMemoryError on the initial deploy of conf/jb
smarlow Jan 30, 2006 10:20 AM (in response to dimitris)We are seeing the OutOfMemory here at Novell on a AMD 64 bit processor machine. JBoss 4.0.3SP1, Suse (SLES9) OS, "Java 64-Bit Server VM build 1.5.0_06-b05"
I couldn't recreate the issue with the standalone TestOOM program (I copied server/all/conf/jboss-service.xml to server/all/lib + entered command: "java TestOOM jboss/server/all/lib".
I'll also try to report to Sun and see if there is a fix. If you have a Sun bug number that I can cross reference, please let me know the number.
It also doesn't matter whether I set Min/Max Java memory to 512M or use the defaults Java memory settings. -
13. Re: Random OutOfMemoryError on the initial deploy of conf/jb
dimitris Jan 30, 2006 11:48 AM (in response to dimitris)The bug is reported here: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6373059
To get the error with the TestOOM program, you also need to specify (as a last parameter, if I remember) any non-empty, non-jar file (e.g. a test.xml)
java TestOOM jboss-4.0.2/server/all/lib/ test.xml -
14. Re: Random OutOfMemoryError on the initial deploy of conf/jb
smarlow Jan 31, 2006 10:51 AM (in response to dimitris)I followed your suggestion and could reproduce with the Java 1.5.0_96-b05 (Server VM) build.
I'll cross reference the bug id that you gave me when I report it to Sun.
Thanks,
Scott