Duplicate :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
FULL PRODUCT VERSION : jre 1.6.0_10 and 1.6.0_11 ADDITIONAL OS VERSION INFORMATION : Mine is Windows XP version 2002 SP3 plus Firfox 3.0.5. But seems to happen in any OS and any browser. EXTRA RELEVANT SYSTEM CONFIGURATION : Only happen in plug-in 1.6.0_10 and 1.6.0_11 with "Enable the next-generation Java plug-in" checked in java control panel. A DESCRIPTION OF THE PROBLEM : Our java applet based application broke constantly in clients machine since they upgrade to java plu-in 1.6.0_10 or 1.6.0_11. Upon close exam, we believe there is a bug in HttpURLConnection class that when a thread running HttpURLConnection is being interrupted by another thread, the class is corrupted somewhere and print our an InterruptedException. In java console, following interruptedException is printed along with unrecognized message ID 42 (message id 46 sometimes). Once we see this exception, unexpected behavior happens in our application afterwords, such as cookie lost. The problem never happens when running in a JDE or webstart. It also never happen in previous version of jre plug-in or turn "Enable the next-generation java plug-in" off. It only happens with applet, with plug-in 1.6.0_10 or 11 and with the next-generation java plug-in enabled. 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) at sun.plugin2.main.client.MessagePassingExecutionContext.getProxyList(Unknown Source) at sun.plugin2.main.client.PluginProxySelector.select(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at TestApplet$3.run(TestApplet.java:48) at java.lang.Thread.run(Unknown Source) sun.plugin2.main.client.PluginMain: unrecognized message ID 42 STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Please use the test case code I posted. - Compile it to a jar - Sign the jar - Run it as a applet in a browser (I use both firefox 3.0.5 and IE 6.0.29) - Make sure browser has Java Plug-in 1.6.0_10 or 1.6.0_11 - Make sure "Enable the next-generation java plug-in" is checked in java control panel. - set java colsole trace level to 5 by pressing 5. - click on test button - watch java console, java.lang.InterruptedException and unrecognized message ID 42 (or 46) will appear. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - Some messages printed but no InterruptedException, no unrecognized message ID 42 (or 46) ACTUAL - Java console print out exceptions as following: Request: http://www.google.com Connected to http://www.google.com network: Cache entry not found [url: http://www.google.com/, version: null] 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) at sun.plugin2.main.client.MessagePassingExecutionContext.getProxyList(Unknown Source) at sun.plugin2.main.client.PluginProxySelector.select(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at TestApplet$3.run(TestApplet.java:48) at java.lang.Thread.run(Unknown Source) network: Connecting http://www.google.com/ with proxy=DIRECT sun.plugin2.main.client.PluginMain: unrecognized message ID 42 network: Connecting http://www.google.com:80/ with proxy=DIRECT network: Connecting http://www.google.com/ with cookie "PREF=ID=c6fa9c86bc98312b:TM=1232480837:LM=1232480837:S=F2wXIF7ZbsKD_hK7" network: Cache entry not found [url: http://www.google.ca/, version: null] network: Connecting http://www.google.ca/ with proxy=DIRECT network: Connecting http://www.google.ca:80/ with proxy=DIRECT network: Connecting http://www.google.ca/ with cookie "PREF=ID=c5a56a5bfc85c016:TM=1232480837:LM=1232480837:S=EuFaQsFtaTEw_APv" Fecthed data from http://www.google.com ERROR MESSAGES/STACK TRACES THAT OCCUR : 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) at sun.plugin2.main.client.MessagePassingExecutionContext.getProxyList(Unknown Source) at sun.plugin2.main.client.PluginProxySelector.select(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at TestApplet$3.run(TestApplet.java:48) at java.lang.Thread.run(Unknown Source) sun.plugin2.main.client.PluginMain: unrecognized message ID 42 REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import javax.swing.JApplet; import javax.swing.JButton; import javax.swing.SwingUtilities; /** * @author Stone Huang * */ @SuppressWarnings("serial") public class TestApplet extends JApplet { @Override public void start() { SwingUtilities.invokeLater(new Runnable() { public void run() { setLayout(new FlowLayout()); add(createTestButton()); } }); } private JButton createTestButton() { JButton button = new JButton("Test"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { test(); } }); return button; } public void test() { final Thread thread = new Thread(new Runnable() { public void run() { try { URL url = getUrl("http://www.google.com"); System.out.println("Request: " + url.toString()); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); System.out.println("Connected to " + url.toString()); BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); String data = reader.readLine(); System.out.println("Fecthed data from " + url.toString()); reader.close(); conn.disconnect(); System.out.println("Response: " + data); } catch (IOException e) { e.printStackTrace(); } } }); thread.start(); thread.interrupt(); } private URL getUrl(String url) { try { return new URL(url); } catch (MalformedURLException e) { e.printStackTrace(); return null; } } } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : None. Release Regression From : 6u7 The above release value was the last known release where this bug was not reproducible. Since then there has been a regression.
|