OpenJPA
  1. OpenJPA
  2. OPENJPA-1970

CPU spinning forever at TreeMap.get in Schema.java

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.1
    • Fix Version/s: 1.1.1
    • Component/s: jdbc
    • Labels:
      None
    • Environment:
      openJPA 1.1.x
    • Patch Info:
      Patch Available

      Description

      CPU is spinning forever at TreeMap.get in schema.java.
      The reason found to be because of structural modification of treemap outside a synchronized block.
      Synchronizing the treemap is fixing the issue.
      The issue can be reproduced with an openJPA test case but due to the nature of the problem, it is replicable intermittently on dual core machine.
      Attached patch has the test case and also the test case is ignored in default runs because it will cause the tests to stuck at TreeMap.get.

      This is seen in 1.1.x version of openJPA and hence uploading the patch only for that version.

      1. OPENJPA-1970.diff
        6 kB
        Ravi P Palacherla

        Activity

        Hide
        Ravi P Palacherla added a comment -

        Changes in Schema.java contributed by Horoki Tateno.

        Show
        Ravi P Palacherla added a comment - Changes in Schema.java contributed by Horoki Tateno.
        Hide
        Ravi P Palacherla added a comment -

        Horoki Tateno has granted a license to the ASF

        Show
        Ravi P Palacherla added a comment - Horoki Tateno has granted a license to the ASF
        Hide
        Rick Curtis added a comment -

        Ravi -

        If the test fails and causes the build to hang... don't we want that to happen? A test that isn't run doesn't really test much.

        I see that this problem was only observed on 1.1.x, but did you try to recreate this problem on trunk?

        Thanks,
        Rick

        Show
        Rick Curtis added a comment - Ravi - If the test fails and causes the build to hang... don't we want that to happen? A test that isn't run doesn't really test much. I see that this problem was only observed on 1.1.x, but did you try to recreate this problem on trunk? Thanks, Rick
        Hide
        Ravi P Palacherla added a comment -

        Rick,

        The only issue in including the test case is there is a chance of OutOfMemory.
        The test case uses 10 threads out of which 6 threads continuously add elements (1million) to TreeMap and 4 threads tries to retrieve the added elements.
        So there is a chance that the test can run into OutOfMemory.

        Even with the above setup Iam able to replicate the issue only on a dual core machine and if the issue is reproduced 1 out of 10 runs.
        I have a wrapper shell script that runs the same test 10 times and I always see that one of these tests hang (CPU spin) at TreeMap.get.

        Regarding running this test case on trunk, I did not encounter the issue on trunk (using same wrapped shell script),
        can not say that the issue does not exist in trunk but I did not see it happen while running the same test case in trunk.

        Regards,
        Ravi.

        Show
        Ravi P Palacherla added a comment - Rick, The only issue in including the test case is there is a chance of OutOfMemory. The test case uses 10 threads out of which 6 threads continuously add elements (1million) to TreeMap and 4 threads tries to retrieve the added elements. So there is a chance that the test can run into OutOfMemory. Even with the above setup Iam able to replicate the issue only on a dual core machine and if the issue is reproduced 1 out of 10 runs. I have a wrapper shell script that runs the same test 10 times and I always see that one of these tests hang (CPU spin) at TreeMap.get. Regarding running this test case on trunk, I did not encounter the issue on trunk (using same wrapped shell script), can not say that the issue does not exist in trunk but I did not see it happen while running the same test case in trunk. Regards, Ravi.

          People

          • Assignee:
            Ravi P Palacherla
            Reporter:
            Ravi P Palacherla
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development