Skip to main content

java_arguments and JVM Control Panel args cancel each other...

10 replies [Last post]
demonduck
Offline
Joined: 2008-03-14
Points: 0

If I run IE6 using Plugin2 on an applet using this:

AND the arguments in the java_arguments param are the same as the arguments I set for the JVM in the Java Control Panel --

THIS IS IMPORTANT!

Then the applet FAILS with an out of memory error!!!

To be clear, duplicate arguments in both the java_arguments
param AND the JVM arguments set in the Java Control Panel
make the applet fail. This is probably a bug.

I trapped a stack trace and it's clear that the problem is that two sets of memory setting parameters cause both to be ignored.

Here is the output from the Java Console. Remember that I'm setting the memory limits like this:

-Xms384m -Xmx512m

But I'm setting them in both the java_arguments param and the JVM arguments in the Java Control Panel. So they apparently cancel each other out because the memory that the Java Console shows is much less in fact it is the default memory size:

Java Plug-in 1.6.0_14
Using JRE version 1.6.0_14-ea OpenJDK Client VM
User home directory = C:\Documents and Settings\Administrator

PanGnomic v3.3
java.lang.OutOfMemoryError: Java heap space
at pangnomic.PanGnomicImageFetch.makeBufferedImage(PanGnomicImageFetch.java:226)
at pangnomic.PanGnomicImageFetch.run(PanGnomicImageFetch.java:306)
at java.lang.Thread.run(Unknown Source)
flushImage()...

Try it yourself on your own machine. Use this applet:

http://pancyl.com/DarkSnowCreek1.htm

The applet tag in that page has java_arguments as I specified above. Set your JVM params to be the same using the Java Control Panel. You should get similar results using IE6.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mbien
Offline
Joined: 2007-04-29
Points: 0

> In general, the VM options specified by Applet are
> most likely not the same as the ones defined via Java
> Control Panel. Therefore, a new VM will be launched
> with the Applet's VM options append to the ones
> defined in Java Control Panel.

would this already lead to the vm zombie instance or are the flags concatenated before a vm is started?

there was recently a thread about this topic:
http://forums.java.net/jive/thread.jspa?threadID=56914&tstart=0

rogyeu
Offline
Joined: 2006-07-30
Points: 0

In general, the VM options specified by Applet are most likely not the same as the ones defined via Java Control Panel. Therefore, a new VM will be launched with the Applet's VM options append to the ones defined in Java Control Panel. -Xmx is a bit different, it will compare the ones defined in Applet and Java Control Panel and use the larger setting.

For more info about the VM arguments, please see:
https://jdk6.dev.java.net/plugin2/jnlp/#COMMAND_LINE_ARGS

-- RY

demonduck
Offline
Joined: 2008-03-14
Points: 0

> In general, the VM options specified by Applet are
> most likely not the same as the ones defined via Java
> Control Panel. Therefore, a new VM will be launched
> with the Applet's VM options append to the ones
> defined in Java Control Panel. -Xmx is a bit
> different, it will compare the ones defined in Applet
> and Java Control Panel and use the larger setting.
>

I was going to suggest that but didn't for some reason. I think that's probably the best way to handle conflicting memory settings.

mbien
Offline
Joined: 2007-04-29
Points: 0

> Then again - IF you have set the parameters in both
> places, like:
>
> java_arguments = -Xms384m -Xmx512m
> Java Control Panel = -Xms512m -Xmx1024m
>
> which one should the plugin pick up? Is that
> documented anywhere?

a simple opt out "prefer application options" checkbox would be the most flexible fix ;)

demonduck
Offline
Joined: 2008-03-14
Points: 0

I think I agree that the user's preferences should have the highest priority. Most people won't even open the Java Control Panel. Those that do set preferences and JVM arguments -- those arguments should be used by the JVM.

If an applet fails because it needs more memory than the user has set, then it's up to the user to fix that problem.

rogyeu
Offline
Joined: 2006-07-30
Points: 0

Thanks for reporting the issue. A bug report has been submitted. Bug ID 6806739. It may take a day or 2 for it to show. It seems like a length issue to me when appending the Applet VM options to the global VM settings via Java Control Panel.

demonduck
Offline
Joined: 2008-03-14
Points: 0

I did some optimization on my applet today and you may not be able to use my applet as a test case now because it's memory use stays below the default memory threshold on the HTML pages I linked to my original report.

I can make a special test case using a very large image if you need that to be done but I think what you said about long strings may be the source of the problem so you might only need to inspect the relevant source.

Let me know if you want me to make a test case for you.

demonduck
Offline
Joined: 2008-03-14
Points: 0

The disappearing java_argument / JVM options problem appears to be a non-problem in 6u14. I was using JVM args that only where appropriate for 6u14 and greater but saw the problem on 6u12. The bug report explains the reason why the problem surfaced.

See Bug ID 6806739

jacobdk
Offline
Joined: 2008-04-21
Points: 0

I can reproduce this on my system using your applet on Vista x64, FF3 and 6u12 FCS. This clearly looks like a bug to me too - I get a java.lang.OutOfMemoryError.

Then again - IF you have set the parameters in both places, like:

java_arguments = -Xms384m -Xmx512m
Java Control Panel = -Xms512m -Xmx1024m

which one should the plugin pick up? Is that documented anywhere? When I remove the parameters from Java Control Panel, it works as expected.

On a sidenote, I'd like to say, that your 360 degrees image viewer applet is really cool! Nice job. :)

Jacob

demonduck
Offline
Joined: 2008-03-14
Points: 0

I don't think the issue of conflicting JVM args has been brought up anywhere. At least I've never seen it discussed anywhere.

You can give arguments to the JVM in ONE of the places but not both apparently.

I had a thought :-) Maybe it's the length of the argument string. It's really long and two together might blow out a buffer somewhere.

Thanks for the compliment. I hang (in cyberspace) with a lot of Flash devotes and Java is sort of back of the bus if you get my meaning. It's nice to know somebody likes it. I don't hear many good words about it.