Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-1614

Test harness overrides heap size settings when starting Network Server

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 10.2.1.6
    • 10.2.1.6
    • Test
    • None
    • Test frameworks DerbyNet and DerbyNetClient
    • Urgent

    Description

      Test specific heap size settings can be passed to the test harness using the jvmflags system property, for example in a <testname>_app.properties file or at the command line when starting a test, e.g "-Djvmflags=-Xms32m^-Xmx32m".

      The test harness almost always overrides such settings when starting a new Network Server using the org.apache.derbyTesting.functionTests.harness.NetServer class of the test harness. Currently, if either -ms or -Xms is missing from the jvmflags, NetServer.start() adds -ms16777216. Also, if either -mx or -Xmx is missing from the jvmflags, NetServer.start() adds -ms33554432. This has been the case since SVN revision 420048 (July 8, 2006).

      Earlier revisions did not override the heap settings unless the newer -Xms or -Xmx flags were used instead of the -ms and -mx flags. A patch for DERBY-1091 attempted (among other things) to make the harness recognize the newer flags as well as the older flags, but the resulting behavior is (most likely) not as intended.

      If a test is run in either the DerbyNet framework or the DerbyNetClient framework, the test-specific JVM flags should (probably) be used for the Network Server JVM as well as the test JVM. Currently, even if non-default heap size flags are passed to the harness, the server JVM will ignore these settings since the harness adds -ms and/or -mx flags after all other heap flags. The exception is if both new and old versions of heap flags are passed to the harness, e.g:

      jvmflags=-ms32m^-Xms32m^-mx128m^-Xmx128m

      Here is the code causing this behaviour:

      if (setJvmFlags && ((jvmflags.indexOf("-ms") == -1) || (jvmflags.indexOf("-Xms") == -1)))
      // only setMs if no starting memory was given
      jvm.setMs(16*1024*1024); // -ms16m
      if (setJvmFlags && ((jvmflags.indexOf("-mx") == -1) || (jvmflags.indexOf("-Xmx") == -1)))
      // only setMx if no max memory was given
      jvm.setMx(32*1024*1024); // -mx32m

      Attachments

        1. DERBY-1614_v1.diff
          4 kB
          John Embretsen
        2. DERBY-1614_v2.diff
          4 kB
          John Embretsen
        3. DERBY-1614_v3.diff
          3 kB
          John Embretsen

        Issue Links

          Activity

            People

              johnemb John Embretsen
              johnemb John Embretsen
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: