Derby
  1. Derby
  2. DERBY-3337

convert jdbcapi/derbyStress.java to JUnit

    Details

      Description

      Convert derbyStress to JUnit. Framework will have to be setup for running in a low memory profile. Temporarily moved the test back to derbyall. See DERBY-3336 for details and possible options moving forward.

      1. derby-3337_noprop_diff.txt
        20 kB
        Kathey Marsden
      2. derby-3337_diff.txt
        22 kB
        Kathey Marsden

        Issue Links

          Activity

          Hide
          Kathey Marsden added a comment -

          Unassigning Christopher. We haven't heard from him in over a year. Christopher, please reassign yourself if you would like to continue working on this issue.

          Show
          Kathey Marsden added a comment - Unassigning Christopher. We haven't heard from him in over a year. Christopher, please reassign yourself if you would like to continue working on this issue.
          Hide
          Kathey Marsden added a comment -

          In working on DERBY-4200, I decided finally that it makes most sense to first convert this test to JUnit and add it to the memory suite and then add in a property for the periodic sleeps where needed for DERBY-4200. I think I will rename the test to MemoryLeakFixesTest and move it to the memory directory and suite.

          Although the test currently runs with 64MB, I found that at least on Windows it runs fine with 16MB like the other memory tests so I think can be pulled into memory._Suite

          Show
          Kathey Marsden added a comment - In working on DERBY-4200 , I decided finally that it makes most sense to first convert this test to JUnit and add it to the memory suite and then add in a property for the periodic sleeps where needed for DERBY-4200 . I think I will rename the test to MemoryLeakFixesTest and move it to the memory directory and suite. Although the test currently runs with 64MB, I found that at least on Windows it runs fine with 16MB like the other memory tests so I think can be pulled into memory._Suite
          Hide
          Kathey Marsden added a comment -

          This patch converts derbyStress to junit and moves it to memory.MemoryLeakFixesTest and adds it to the memory suite so it will get picked up by lowmem testing.

          The test has a system property derby.tests.waitforfinalizermillis which can be set to put in arbitrary waits to catch up in case it is needed for the finalizer to catch up. I am thinking I might try to modify it further to call Runtime.freememMemory() and only sleep if we are running short, but I think I will check this in first if nobody objects.

          I still need to run tests.

          Show
          Kathey Marsden added a comment - This patch converts derbyStress to junit and moves it to memory.MemoryLeakFixesTest and adds it to the memory suite so it will get picked up by lowmem testing. The test has a system property derby.tests.waitforfinalizermillis which can be set to put in arbitrary waits to catch up in case it is needed for the finalizer to catch up. I am thinking I might try to modify it further to call Runtime.freememMemory() and only sleep if we are running short, but I think I will check this in first if nobody objects. I still need to run tests.
          Hide
          Knut Anders Hatlen added a comment -

          The changes look fine to me, although it might be better to keep the handling of the derby.tests.waitforfinalizermillis property localized to the test (I'm assuming it's not meant to be used by other tests as a general mechanism?).

          In sleepForFinalizer(), we should probably let the InterruptedException propagate up to the caller rather than printing it.

          Show
          Knut Anders Hatlen added a comment - The changes look fine to me, although it might be better to keep the handling of the derby.tests.waitforfinalizermillis property localized to the test (I'm assuming it's not meant to be used by other tests as a general mechanism?). In sleepForFinalizer(), we should probably let the InterruptedException propagate up to the caller rather than printing it.
          Hide
          Kathey Marsden added a comment -

          Thanks Knut for the review. I had the property in the test at first, but then decided it would be better to keep the various properties centralized as much as possible rather than scattered about. I suppose if other tests had this problem, they could use it.

          I am not a big fan of the property actually as it has to be tuned and can cause unneeded sleeps. I just realized there is a Runtime.runFinalization() method. Maybe I could just make the test by default run finalazation if freeMemory() runs low. Do you think that is too much of an inteference with the test? I keep thinking this is something the jvm's should do.

          I will definitely make the change to throw the InterruptedException.

          Show
          Kathey Marsden added a comment - Thanks Knut for the review. I had the property in the test at first, but then decided it would be better to keep the various properties centralized as much as possible rather than scattered about. I suppose if other tests had this problem, they could use it. I am not a big fan of the property actually as it has to be tuned and can cause unneeded sleeps. I just realized there is a Runtime.runFinalization() method. Maybe I could just make the test by default run finalazation if freeMemory() runs low. Do you think that is too much of an inteference with the test? I keep thinking this is something the jvm's should do. I will definitely make the change to throw the InterruptedException.
          Hide
          Kathey Marsden added a comment -

          Here is a patch with the property removed. Instead of the sleep, we call runFinalization() if there is less than a half MB of free memory.

          On IBM JDK 1.6 where (with the first patch), I was seeing the test fail intermittently with 16MB and the property not set, it now seems to pass consistently, just calling runFinalization() a few times (as can be seen with -Dderby.tests.debug=true

          I think I like this approach better and think it still tests that Derby does not leak.

          Show
          Kathey Marsden added a comment - Here is a patch with the property removed. Instead of the sleep, we call runFinalization() if there is less than a half MB of free memory. On IBM JDK 1.6 where (with the first patch), I was seeing the test fail intermittently with 16MB and the property not set, it now seems to pass consistently, just calling runFinalization() a few times (as can be seen with -Dderby.tests.debug=true I think I like this approach better and think it still tests that Derby does not leak.
          Hide
          Knut Anders Hatlen added a comment -

          +1. The updated patch looks cleaner, and I agree that it still tests that Derby doesn't leak.

          Show
          Knut Anders Hatlen added a comment - +1. The updated patch looks cleaner, and I agree that it still tests that Derby doesn't leak.
          Hide
          Knut Anders Hatlen added a comment -

          [bulk update] Close all resolved issues that haven't been updated for more than one year.

          Show
          Knut Anders Hatlen added a comment - [bulk update] Close all resolved issues that haven't been updated for more than one year.

            People

            • Assignee:
              Kathey Marsden
              Reporter:
              Kathey Marsden
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development