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

Deadlocks resulting from threads being created in wrong group

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Incomplete
    • Affects Version/s: 1.4.2, 1.4.2_02
    • Fix Version/s: None
    • Component/s: deploy
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_2000, windows_xp

      Description

      Name: gm110360 Date: 04/08/2004


      FULL PRODUCT VERSION :
      Java(TM) Plug-in: Version 1.4.2_03
      Using JRE version 1.4.2_03 Java HotSpot(TM) Client VM

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

      A DESCRIPTION OF THE PROBLEM :
      The Plug-in creates a thread group for an applet codebase, including
      an event dispatch thread, plus a thread for each applet to run the
      lifecycle methods. So when one of those methods invokes
      EventQueue.invokeAndWait(), the event goes on the applet's queue
      and is serviced by the applet dispatch thread. It is therefore
      single-threaded with respect to GUI events in the applet.

      But when a thread is created to service an incoming event, e.g. from
      a script function, it is created in the main thread group. Events therefore
      go on the base event queue, which breaks the single thread model
      and conflict with GUI events.

      Such threads should surely be created in the applet thread group.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      The problem involves an applet which executes visible effects from
      both Swing GUI events and script events.

      It is always reproducible in the sense that it is structurally wrong.
      A threaded debugger shows which event queue is used in each
      case.

      Consequent problems (usually deadlocks) are intrinsically hard
      to reproduce. However, in our complex web application, sustained use
      will generally yield a problem within a few minutes.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      All events submitted by EventQueue.invokeAndWait() should be
      dispatched by the applet group's dispatch thread.
      ACTUAL -
      GUI-originated events go on the applet group's dispatch thread, but
      script-originated events go on the main group's dispatch thread.
      Deadlocks between the two threads can be seen on a debugger.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      As a workaround, we are using a worker thread in the applet thread
      group, to find the correct dispatch queue. Events are transferred
      to this thread by a mechanism similar to that of
      EventQueue.invokeAndWait(); this thread then invokes that method.
      (Incident Review ID: 244954)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              vdrozdov Victor Drozdov (Inactive)
              Reporter:
              gmanwanisunw Girish Manwani (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: