Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6359309
Votes 0
Synopsis Large setting for -Xmx param prevents plugin from starting in Internet Explorer
Category java_plugin:misc
Reported Against
Release Fixed
State 11-Closed, duplicate of 6622332, bug
Priority: 3-Medium
Related Bugs 6392705 , 6440867 , 6528750 , 6749176
Submit Date 06-DEC-2005
Description
FULL PRODUCT VERSION :
java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode, sharing)


ADDITIONAL OS VERSION INFORMATION :
 customer  Windows [Version 5.2.3790]

EXTRA RELEVANT SYSTEM CONFIGURATION :
2.0GHz Pentium M processor
1GB physical memory
Internet Explorer 6.0.3790.1830

A DESCRIPTION OF THE PROBLEM :
When Java Plugin is configured with -Xmx parameter set to some number larger than half of the system's physical memory, java plugin will not start in Internet Explorer.  It pops up a message box that says "The Java Runtime Environment cannot be loaded".  On my machine, -Xmx750m does the trick. The problem seems to be independent of the version of Windows operating system. It's also reproducible on Windows 2000 and XP.  It happens with both the <APPLET> tag and with the <OBJECT> tag.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Open Java 1.5 control panel and switch to Java tab.  Open "Java Applet Runtime Settings" by clicking on "View" button.  In the last field (Java Runtime Parameters) enter "-Xmx512m", where "512" should be replaced by 3/4 of the system physical memory size.  Also enable "<APPLET> tag support" for Internet Explorer.  Apply settings.  Open internet explorer and navigate to any web page that contains an applet.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Applet runs and its user interface is visible.
ACTUAL -
The place where the Applet would be on the HTML page is blank with a little icon in top left corner, which represents missing control. An error message dialog is displayed by Java Plugin.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Error message box has the title "Java(TM) Plug-in Fatal Error", and the message is "The Java Runtime Environment cannot be loaded".

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
HTML page that calls up the applet.

-------------------------------------------------

<HTML>
<HEAD>
<TITLE>
Test Applet
</TITLE>
</HEAD>
<BODY>
<APPLET width=400 height=250>
	<PARAM NAME="codebase" VALUE=".">
	<PARAM NAME="code" VALUE="testapplet.TestApplet.class">
	<PARAM NAME="name" VALUE="Test Applet">
</APPLET>
</BODY>
</HTML>

-------------------------------------------------

Even though the actual TestApplet.class doesn' t have to be available to see the problem, below is java code for this Applet.

-------------------------------------------------

package testapplet;

import java.applet.Applet;
import javax.swing.JLabel;

public class TestApplet extends Applet {
    public TestApplet() {
        add(new JLabel("Applet's Running"));
    }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Maximum possible value for -Xmx must be determined by trial and error for each individual machine.
Posted Date : 2005-12-06 00:36:49.0
Work Around
N/A
Evaluation
The applet fails to load because VM initialization fails with such big value for -Xmx.  You can try running any java program (SwingSet2 demo for example) and experience exact same behavior.  So, this is not limited to plugin.  The error you'll see when running java program in command prompt is:
C:\jdk1.5.0_04\demo\jfc\SwingSet2>java -Xmx2000m -cp SwingSet2.jar SwingSet2
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

The vm was unable to allocate requested heap size and failed to initialize.  This is a know behavior.  This issue might be addressed in the future release by vm team.  The workaround is rather simple - specify smaller heap size.  I am closing this bug as "Will not fix".
Posted Date : 2005-12-06 17:17:04.0

Windows loads dll's in various awkward places in the 32-bit virtual
address space, leading to virtual address space fragmentation.  The
jvm requires contiguous virtual address space for the heap, so if
many dll's have been loaded, it's quite likely that for a given
on-the-large-size value of -Xmx, the jvm may not be able to obtain
a large enough contiguous memory region for the heap.
Posted Date : 2006-03-22 17:31:30.0

There have been a large number of negative comments regarding the above evaluation and the decision to close this bug as "will not fix".

Up until recently, it was not technically feasible to fix this problem in the Java Plug-In due to its in-process architecture.

In recent months a new implementation of the Java Plug-In has been developed which changes the execution model of applets. Instead of running the applets in a JVM embedded in the web browser's process, they are now run in a separate JVM process which communicates back to the web browser. This work was checked in under 6622332.

This new plug-in solves this problem in two ways. First, since the JVM is no longer running in the same process as the web browser, the address space fragmentation problem in IE described above does not interfere with the specification of a large -Xmx value (for example, in the Java Runtime Parameters in the Java Control Panel).

Second, the new Java Plug-In will support specification of JVM command-line arguments on a per-applet basis via a new parameter in the applet's HTML. This will eliminate the need to do any global setting of this or other parameters in the Java Control Panel.

The first public release of the new Java Plug-In will be in build 08 of the forthcoming "6uN" release, for which early access builds can be found at https://jdk6.dev.java.net/6uNea.html. As of this writing the new Java Plug-In is not yet the default, but users will be able to turn it on by toggling a Java Control Panel switch. More documentation on the new plug-in will be provided when it becomes available or soon afterward.

To indicate that we have heard your feedback and have responded, the disposition of this bug is being changed from "will not fix". Instead, for tracking purposes, it is being closed as a duplicate of 6622332. We hope that the new plug-in will address this significant issue.

Note that currently the new plug-in does not change the default heap size for applets, but we believe that this will be far less of an issue now that an individual applet can request a particular heap size. We are open to revisiting this particular issue, in particular in the context of the new plug-in.

Please try the new Java Plug-In when it becomes available and file any issues against it under product java, category java_plugin, subcategory plugin2.
Posted Date : 2007-11-27 05:41:42.0
Comments
  
  Include a link with my name & email   

Submitted On 16-FEB-2006
darrinps
I'm at a loss to understand the logic in marking this as "Will not fix" and your assertion about "running any java probram...and experience the exact same behavior" is incorrect.  I often run Java applications set to -Xmx1024M with no problem at all.

The Jave users NEED to be able to set their memory higher some times.  I have a Java applet using Java3D  that NEEDS more than 128M and so do many people (check your own forums).

The "Will not fix" conclusion must not be allowed to stand.


Submitted On 17-FEB-2006
kymtbr
This is unacceptable and needs to be addressed.  The risks involved in running out of memory should be the responsibility of the application. Does this build of the JVM always require half of system memory, no matter how much is available.  What if there is 10GB available?  The JVM should not limit my application to half of the system memory for no good reason.  It should use what it needs and leave the rest to the application.  This workaround must not stand.


Submitted On 20-FEB-2006
giles7777
This bug has been closed incorrectly.  The original report stated the user specified 750 megs of ram.  This is nowhere near the JVM limit of memory.  If this bug is reproducible then its a major issue for applets.


Submitted On 23-FEB-2006
JohnWMuir
We have also experienced this problem when trying to get Tomcat to use more of the available memory on several servers. More than ca. 50% of available memory seems to be the limit. This really won't do ;-(


Submitted On 27-FEB-2006
darrinps
It looks like the > 1/2 memory theory may not hold.  We have two machines that experience this with the -Xmx setting far below 1/2 of the available memory.  On one machine with 1 gig, a setting of -Xmx128M -Xmx256M will cause this problem.  On a second machine with 768M of memory, the same setting causes it as well, but at least six other machines we have with between 512M and 1G work just fine with this setting.

This bug must not be allowed to stay closed.  The "work around" given is completely bogus (specify a smaller memory size).  Well, what if you NEED more memory?  


Submitted On 01-MAR-2006
jon999
I'd like to understand what the correct solution is for this problem.  
There seem to be different situations.


1) User knows that a heap of NNN is needed to run the application
and specifies -XmxNNN.  Application will eventually fail if NNN is
not provided.


2) User knows that a heap of NNN is needed to run the application
well.  Application will run with less than NNN but not necessarily
perform well.


3) User knows that a heap of NNN is sufficient to run the application
well but it may perform safisfactorily with a smaller heap.


For 1) it seems like it is better if the VM fails fast since it is going to
fail eventually.  Don't waste time getting to the failure.


For 2) it's difficult for the VM to tell what level of performance is 
satisfactory so should the VM fail fast or start with whatever
memory it can reserve.


For 3) the VM should start with whatever memory it can reserve.


Are the proposed behavior the right behavior?  What about
2)?  Are there more cases?  I think that some command line
flag would be needed so the VM could distinguish between
1) and 3).  I think the default value of such a command line
flag should be to interpret a -Xmx as in 1) for compatibility with
current releases.  


Submitted On 08-MAY-2007
I receive the exact same error in the following settings on a machine with 4 GB of Ram.  I have tried to set 
 -Xmx to:  512m, 256m and 128m; however the exact same problem occurrs.   I am running Java 1.6 on Vista with IE 7.  If I remove the parameter completely the applet will load; however, due to the memory requirements it does not run properly.  



Submitted On 09-MAY-2007
cforster
Guys, this sort of thing has been going on for Java from Sun since inception.  There is little/no regard for "user experience" issues in running applets of any significance. Numerous times over the years Sun has been asked for this & other plugin enhancements necessary to deploy robust applets using it.  They have, as a rule, screwed up.  
Often, they respond like "Have the user use Control Panel & type in -XmxNNNm...."  "Have the user import the certificate manually using keystore...",  "Have them uninstall ver 1.X.X of their JRE & reinstall.."  and don't get me started on modal dialogs...
Its sad because Java on the client had a lot of potential.
Best you can do if you want to use Java on the client is head over the Java Web Start or some 3rd party distro-as-application product.


Submitted On 23-MAY-2007
NO NEED TO BE A JERK...

hey thanks for telling us whats wrong, why dont you tell me how to fix it!  I don't care how a car is made, JUST TELL ME HOW TO DRIVE IT!


Submitted On 11-JUL-2007
anilsaxena2
This is ridiculous, why this is will not fix status ?


Submitted On 13-JUL-2007
sunnychangs
If you are running into problems with process memory space for Windows XP SP2, you might want to install this hotfix 894472

http://support.microsoft.com/kb/894472/en-us

Also see this blog: http://www-03.ibm.com/developerworks/blogs/page/gbowerman?entry=dll_hell


Submitted On 30-SEP-2007
Galen1967
Marking this as "Well not fix" is entirely unacceptable!  96M (the apparent default for 1.6) is entirely too small for today's applications.

Asking our customers to "fiddle" with their control panel is not unlike asking a high schooler to build a space shuttle.  It's just not going to happen.

I understand that it's  a bug in Windows that is causing this but to just chuck it aside and say, "not out problem," is bogus!


Submitted On 16-OCT-2007
I agree with the previous comments.  I'm developing a panorama viewer that needs to decompress and display multi- megabyte images.  OutOfMemoryError's are constantly being reported by people trying to view the images.  

Their complaints constantly point out that Flash and other plugins don't have memory problems and when it is suggested that they have to configure the JVM via the Java Control Panel their reaction range from incredulous to hostile.  

Because of this one flaw in the engineering of the JRE, many, many people have written off Java as a vehicle for large panoramic image delivery.  

I've invested the last ten years of my life developing my Java programming skills and what do I get from SUN -- a knife in my back and excuses as to why the obvious need for more reliable memory allocation cannot be addressed.  

UNACCEPTABLE!

Ken Warner
pancyl.com


Submitted On 31-OCT-2007
tomw2
Well, after 12 years of developing applets in Java, I'm now throwing in the towel and heading for ActionScript.  Sun's attitude about this is short-sighted, to say the least.  This is a "killer" -- end users should be able to use more than 128M or 256M...and NOT have to configure it themselves!    Good job in convincing people that Java is not meant for running applets inside a browser!


Submitted On 13-NOV-2007
How could you mark it "Will Not Fix", who hell this guys is ?


Submitted On 27-NOV-2007
Well, partially in response to the delicious:

"NO NEED TO BE A JERK..."

apparent reply to my comment on this bug, I'll be posting an over-bearing hack/work-around for it to a site as its > the 4000 char limit of these comments.  Code will require a signed applet w/full rights.
BTW, my comment was borne of having tried and succeeded at developing & supporting a large commercial client-side Java applet/application since 1999. Just suggesting you research things before betting your app or company on this technology.


Submitted On 03-DEC-2007
As I said above, I posted workaround code here:
http://www.dreamincode.net/code/snippet1490.htm
"Java Plugin Signed Applet code" - Use at your own risk blah, blah, blah. If you have signed applet failing for heap under JPI, this should help.


Submitted On 01-FEB-2008
sergen
several Java Virtual Machines running in the same process


Submitted On 09-SEP-2008
Is this problem now fixed and part of the standard java 1.6 ?


Submitted On 09-SEP-2008
It this problem fix and integrated into java 1.6 at this point ?



PLEASE NOTE: JDK6 is formerly known as Project Mustang