Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-1722

notify() in synchronized section makes wait(long) wait forever

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • None
    • None
    • DRLVM
    • None
    • Windows XP IA32
    • Unknown

    Description

      DRLVM svn = r453182, (Oct 5 2006), Windows/ia32/msvc 1310, debug build
      with jit and interpreter (-Xint)

      The following test:

      public class Test {
      public static void main(String args[]) throws Exception {
      new Thread() {
      public void run() {
      while (true) {
      System.err.println("entering cycle");
      synchronized (this) {
      try

      { System.err.println("before wait"); wait(50); System.err.println("after wait"); notify(); }

      catch (InterruptedException e)

      { e.printStackTrace(); }

      }
      System.err.println("after cycle");
      }
      }
      }.start();
      }

      }

      Prints in RI:

      entering cycle
      before wait
      after wait
      after cycle
      entering cycle
      before wait
      after wait
      after cycle

      endlessly

      in DRL:

      entering cycle
      before wait
      after wait
      after cycle
      entering cycle
      before wait
      <test hangs>

      If we remove notify() from loop, the loop will become infinite

      Attachments

        Issue Links

          Activity

            People

              cap Alexey Petrenko
              aluht Anton Luht
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: