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

Deadlock when a thread is constructed at the same time as a class is loaded

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1
    • Resolution: Fixed
    • Affects Version/s: 1.1.4
    • Fix Version/s: 1.1.4
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      1.1.4
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Not verified

      Description


      ingrid.yao@Eng 1997-08-06

      Oracle report the deadlock problem:
      ==============================================================
      Have a look at the sequence of methods calls in the two deadlocked threads;
      "Forms-Runform-1" and "AWT-EventQueue-0":

      sun.applet.AppletClassLoader.getThreadGroup is synchronized , so the
      "Forms-Runform-1" thread is waiting for the AppletClassLoader object's monitor, which is held by the "AWT-EventQueue-0" thread.

      sun.applet.AppletSecurity.checkRead is synchronized, so the "AWT-EventQueue-0"
      thread is waiting for the AppletSecurity object's monitor, which is held by the
      "Forms-Runform-1" thread.

      Each thread is blocked waiting for a monitor held by the other thread, so we have a deadlock.

      Here is the stack trace and the monitor state with the irrelevant parts removed:

          "Forms-Runform-1" (TID:0xf653b0, sys_thread_t:0x874580, Win32ID:0x94, stat4
              sun.applet.AppletClassLoader.getThreadGroup(AppletClassLoader.java:597)
              sun.applet.AppletSecurity.inThreadGroup(AppletSecurity.java:184)
              sun.applet.AppletSecurity.checkAccess(AppletSecurity.java:214)
              java.lang.ThreadGroup.checkAccess(ThreadGroup.java:271)
              java.lang.Thread.init(Thread.java:261)
              java.lang.Thread.<init>(Thread.java:393)
              oracle.ewt.timer.Timer.<init>(Timer.java:35)
              oracle.ewt.timer.Periodic.<init>(Periodic.java:28)
              oracle.ewt.lwAWT.lwText.CursorIdler.<init>(CursorIdler.java:38)
              oracle.ewt.lwAWT.lwText.CursorIdler.getCursorIdler(CursorIdler.java:50)
              oracle.ewt.lwAWT.lwText.LWTextComponent.addNotify(LWTextComponent.java)
              java.awt.Container.addNotify(Container.java:1083)
              oracle.forms.uiClient.v1_4.ui.DrawnPanel.addNotify(DrawnPanel.java:447)
              java.awt.Container.addNotify(Container.java:1083)
              java.awt.Container.addNotify(Container.java:1083)
              java.awt.Container.addNotify(Container.java:1083)
              oracle.forms.uiClient.v1_4.ui.DrawnPanel.addNotify(DrawnPanel.java:447)
              java.awt.Container.addNotify(Container.java:1083)
              java.awt.Container.addNotify(Container.java:1083)
              java.awt.Container.addNotify(Container.java:1083)

          "AWT-EventQueue-0" (TID:0xf5ac08, sys_thread_t:0x872d90, Win32ID:0x8b, sta5
              sun.applet.AppletSecurity.checkRead(AppletSecurity.java:436)
              java.io.FileInputStream.<init>(FileInputStream.java:103)
              java.net.SocketInputStream.<init>(SocketInputStream.java:50)
              java.net.PlainSocketImpl.getInputStream(PlainSocketImpl.java:394)
              java.net.Socket.getInputStream(Socket.java:290)
              sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:484)
              sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConn)
              sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:119)
              sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:494)
              sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:197)
              java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
              oracle.ewt.lwAWT.SharedPainter.paint(SharedPainter.java:323)
              oracle.ewt.lwAWT.BufferedFrame.paint(BufferedFrame.java:281)
              oracle.ewt.lwAWT.BufferedFrame.update(BufferedFrame.java:268)
              oracle.forms.uiClient.v1_4.ui.ExtendedFrame.update(ExtendedFrame.java:)
              java.awt.Component.dispatchEventImpl(Component.java:1714)
              java.awt.Container.dispatchEventImpl(Container.java:897)
              java.awt.Window.dispatchEventImpl(Window.java:443)
              java.awt.Component.dispatchEvent(Component.java:1693)
              java.awt.EventDispatchThread.run(EventDispatchThread.java:63)

      Monitor Cache Dump:
          sun.applet.AppletSecurity@F56D08/FA8958: owner "Forms-Runform-1" (0x874580)
          sun.applet.AppletClassLoader@F59D48/FB9420: owner "AWT-EventQueue-0" (0x87)


      If you walk up the stack examining each method in turn, you can see that:

      - The AppletSecurity object's monitor is grabbed by the "Forms-Runform-1"
        thread in sun.applet.AppletSecurity.checkAccess, because it is synchronized

      - The AppletClassLoader object's monitor is grabbed by the "AWT-EventQueue-0"
        thread in sun.applet.AppletClassLoader.findClass, because it is synchronized.

        Attachments

          Activity

            People

            Assignee:
            apalanissunw Anand Palaniswamy (Inactive)
            Reporter:
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: