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

validate() deadlock involving applets with synchronized init() methods

    XMLWordPrintable

Details

    • 1.0.k
    • sparc
    • generic
    • Not verified

    Description

      A deadlock can occur when an application calls validate() on a container
      holding an applet with a synchronized init() method -and- the implementation
      of the APPLET_RESIZE event calls validate(). This all happens with the
      spreadsheet demo on the java home page and HotJava. It's timing sensitive,
      but is quite reproducable on Kona.

      Scenario:

      1. Applet's synchronized init() method gets called.
      2. init() method calls resize().
      3. java.applet.Applet.resize() calls appletResize().
      4. sun.applet.AppletPanel posts an APPLET_RESIZE event.
      5. sun.hotjava.tags.TagAppletPanel.handleEvent calls validate()
           in response to the APPLET_RESIZE event.

      validate() is synchronized, so we now hold a lock on the applet (a component) and the
      applet panel (a container holding the component), aquired in that order.

      At the same time, an expose event is heading into the application (in this case
      HotJava).

      1. The expose event hits the top level window, which decides to call
           validate on the container holding the applet.
      2. The container (through the standard implementation of validate()) calls
           validate on its components.

      We now hold a lock on the applet panel (the container) and the applet (the component),
      aquired in that order.

      Since the lock aquisition happened in the opposite order, we have a
      window for deadlock.

      To reproduce, run Kona and any of the demo applets that have a synchronized
      init() method such as the spreadsheet.

      [2 May 96 a]

      Attachments

        Activity

          People

            duke J. Duke
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: