JDK-6922320 : plugin2 should take available heap into consideration when choosing VM to be used for applet
  • Type: Enhancement
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2010-02-02
  • Updated: 2014-09-12
  • Resolved: 2010-12-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b123Fixed
Related Reports
Relates :  
Relates :  
Description
Browser part of the plugin2 attempts to run the applet in any VM that:
   1) has same set of VM parameters
   2) is not marked as tainted

This means that applets with default parameters will be run in the same VM. 

However, as VM heap size is limited it will eventually throw OOM if too many applets will be assigned to run in this VM.
This may cause failure of more than single applet but potentailly applets running in that VM.

This is especially painfull as many applets including FX are actually leaking memory.

We really need to consider how much free heap is available before trying to launch new applet.

Possible implementation is as follows:
  1) client VMs need to send estimate of available heap with heartbeat pings (e.g. using Runtime.freeMemory() to get the estimate)
  2) browser VM should avoid assigning new applets to existing VM is available heap size is below some threshold, e.g. 30Mb)
       and should launch new VM instead
We whould also consider applet hints on what is the minimal memory they need. they can work with default heap and therefore
they do not need to request bigger heap but this does not mean they will work with half of default heap ...

Comments
EVALUATION The final implementations has the following specification: JVM is unhealthy and should be rejected for reuse if one of the following condition is true: (1) availableHeap <= 32 MB (2) appletThreadCount > 50 (3) availableHeap < required_jvm_heap where: * availableHeap = maxHeap - (totalHeap - freeHeap) * appletThreadCount is total number of threads used by all applets in the target JVM. * required_jvm_heap is an applet parameter, e.g. <PARAM name="required_jvm_heap" value="128m"/>
14-12-2010

EVALUATION Selection of client VM are based on health indicators: available heap > 32MB and appletThreadCount < 45.
10-12-2010