JDK-6763545 : JSException on JSObject.getMember with long data
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6u10
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_vista
  • CPU: x86
  • Submitted: 2008-10-24
  • Updated: 2011-02-16
  • Resolved: 2009-01-08
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Verze 6.0.6001]

A DESCRIPTION OF THE PROBLEM :
I have an applet for digitally signing documents in browsers. Documents are send from web server to hidden input in browser (Base64 encoded), applet then use JSObject getMember method for reading that data by this method:

private String getFormInputValue(String inputName) {
       JSObject browserWindow = JSObject.getWindow(this);
       JSObject mainForm = (JSObject) browserWindow.eval("document.forms[0]");
       JSObject inputObject = (JSObject) mainForm.getMember(inputName);
       return (String) inputObject.getMember("value");
} 

When document data is longer, JSException is thrown :

netscape.javascript.JSException
	at sun.plugin2.main.client.MessagePassingJSObject.newJSException(Unknown Source)
	at sun.plugin2.main.client.MessagePassingJSObject.waitForReply(Unknown Source)
	at sun.plugin2.main.client.MessagePassingJSObject.doMemberOp(Unknown Source)
	at sun.plugin2.main.client.MessagePassingJSObject.getMember(Unknown Source)






STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Put longer data into form field (megabytes) and try to read them.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
getMember reads that data
ACTUAL -
exception is thrown

ERROR MESSAGES/STACK TRACES THAT OCCUR :
netscape.javascript.JSException
	at sun.plugin2.main.client.MessagePassingJSObject.newJSException(Unknown Source)
	at sun.plugin2.main.client.MessagePassingJSObject.waitForReply(Unknown Source)
	at sun.plugin2.main.client.MessagePassingJSObject.doMemberOp(Unknown Source)
	at sun.plugin2.main.client.MessagePassingJSObject.getMember(Unknown Source)
	at ASDSoft.DigitalSignature.DocumentSigner.getFormInputValue(DocumentSigner.java:376)
	at ASDSoft.DigitalSignature.DocumentSigner.signDocumentInternal(DocumentSigner.java:149)
	at ASDSoft.DigitalSignature.DocumentSigner.access$100(DocumentSigner.java:21)
	at ASDSoft.DigitalSignature.DocumentSigner$1.run(DocumentSigner.java:133)
	at java.security.AccessController.doPrivileged(Native Method)
	at ASDSoft.DigitalSignature.DocumentSigner.signDocument(DocumentSigner.java:128)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at sun.plugin.javascript.JSInvoke.invoke(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
	at sun.plugin2.liveconnect.JavaClass$MethodInfo.invoke(Unknown Source)
	at sun.plugin2.liveconnect.JavaClass$MemberBundle.invoke(Unknown Source)
	at sun.plugin2.liveconnect.JavaClass.invoke0(Unknown Source)
	at sun.plugin2.liveconnect.JavaClass.invoke(Unknown Source)
	at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$DefaultInvocationDelegate.invoke(Unknown Source)
	at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo.doObjectOp(Unknown Source)
	at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$LiveConnectWorker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.InterruptedException
	at java.lang.Object.wait(Native Method)
	at sun.plugin2.message.Queue.waitForMessage(Unknown Source)
	at sun.plugin2.message.Pipe.receive(Unknown Source)
	... 29 more
Info: dataToSign=nullInfo: dataToSign=nullJVM heartbeat .. Exception, send ts: 6763455616, now ts: 6763455685, dT 69


REPRODUCIBILITY :
This bug can be reproduced always.

Comments
EVALUATION Two issues have been fixed in 6u14 build 01 related to OutOfMemoryErrors sending large amounts of data both from JavaScript to Java as well as Java to JavaScript: 6786860 and 6788906. This particular issue is the same as 6788906 and is being closed as a duplicate of that bug for bookkeeping purposes. We can not guarantee that sending arbitrarily large amounts of string data in either direction will work, but the more efficient serialization implementation and newly increased limits should allow similar behavior to the classic Java Plug-In without significantly increasing footprint.
08-01-2009

EVALUATION Most likely an OutOfMemoryError is being thrown somewhere during the process of serializing the data from the browser to the attached JVM. Need to diagnose where this may be occurring. Currently the browser side JVM has a heap size which will limit the amount of data that can be transferred in one shot from the browser. On the other hand, it is not clear that it is wise to allow arbitrary, or at least very large, amounts of data to be fetched from the browser in this manner. Note that the data could be transferred in the form of a JavaScript array or a set of strings as a workaround. Raising the priority until we have an evaluation of exactly why this is failing.
25-10-2008