Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6586556

Internet Explorer crashes during SocketInputStream.socketRead0

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 6
    • core-libs
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.6.0_02"
      Java(TM) SE Runtime Environment (build 1.6.0_02-b05)
      Java HotSpot(TM) Client VM (build 1.6.0_02-b05, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Internet Explorer Version 6.0.2900.2180.xpsp_sp2_gdr.050301-1519CO, Update Versions: SP2

      A DESCRIPTION OF THE PROBLEM :
      I launch a page with one small, signed applet on it. This applet is a small web server to load other pages. When executed in Internet Explorer, IE crashes with a report from the plug-in on the desktop. The program crashes when attempting to call BufferedReader.readLine(). The crash is ultimately caused by SocketInputStream.socketRead0() at the top of the stack. This problem is new in 6.0u2; 6.0 and 1.5.0_11 work well.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Execute the given applet in IE.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      New IE window opens with served pages.
      ACTUAL -
      The IE window pops up, but immediately the IE process instantly ends with a crash report from the plug-in.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      (see attachment: hs_err.log)



      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.applet.Applet;
      import java.io.*;
      import java.net.*;
      import netscape.javascript.JSObject;

      public class LocalizerApplet extends Applet implements Runnable {
          public void start() {
              thread_ = new Thread(this, "LocalizerApplet");
              thread_.start();
          }

          public void run() {
              ServerSocket serverSocket = null;
              Socket socket = null;

              try {
                  serverSocket = new ServerSocket(0);
                  JSObject window = JSObject.getWindow(this);

                  // launch new window
                  window.call("open", new String[] { "http://localhost:" +
                                     serverSocket.getLocalPort() + "/index.html",
                                     "_blank",
                                     "location=no, toolbar=no, status=yes, menubar=yes, resizable=yes" });

                  for (int i = 0; i < 4; ++i) {
                      socket = serverSocket.accept();
                      String line = new BufferedReader(new InputStreamReader(
                              socket.getInputStream())).readLine();
                      servePage(new PrintStream(socket.getOutputStream(), false));
                      socket.close();
                      socket = null;
                  }

                  Thread.sleep(10000);
                  window.call("done", null);

                  accepting_ = true;
                  Thread.sleep(10000);
              }
              catch (IOException e) {
                  e.printStackTrace();
              }
              catch (InterruptedException e) {
              }
              finally {
                  try {
                      if (socket != null) {
                          socket.close();
                      }
                      if (serverSocket != null) {
                          serverSocket.close();
                      }
                  }
                  catch (IOException e) {
                      e.printStackTrace();
                  }
              }
          }

          private void servePage(PrintStream out) throws IOException {
              StringBuilder html = new StringBuilder("<HTML>\n" +
                  "<FRAMESET >\n" +
                  " <FRAME SRC='index.html'>\n" +
                  " <FRAME SRC='index.html'>\n" +
                  "</FRAMESET>\n" +
                  "</HTML>");
              out.println("HTTP/1.1 200 OK");
              out.println("Content-Type: text/html");
              out.println("Connection: close");
              out.println("Cache-Control: no-cache");
              out.println("Content-Length: " + html.length());
              out.println();
              out.print(html);
              out.flush();
              if (out.checkError()) {
                  throw new IOException("problem");
              }
          }

          public void stop() {
              try {
                  if (accepting_) {
                      thread_.interrupt();
                  }
                  thread_.join();
              }
              catch (InterruptedException e) {
                  e.printStackTrace();
              }
          }

          private Thread thread_;
          private boolean accepting_ = true;
      }

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

            chegar Chris Hegarty
            ryeung Roger Yeung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: