Derby
  1. Derby
  2. DERBY-1751

derbynet/testSecMec.java fails with ShutdownException in DerbyNetClient framework

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.2.1.6
    • Fix Version/s: 10.2.2.0, 10.3.1.4
    • Component/s: Test
    • Labels:
      None
    • Environment:
      JVM: Sun JDK 6 (build 1.6.0-rc-b95)
      OS: Solaris 10 (sparc) local zones
      Hardware: Sun Fire V210 Server, 2 x 1000 MHz CPU
    • Urgency:
      Normal
    • Bug behavior facts:
      Regression Test Failure

      Description

      During 10.2.1.0 beta testing this test failed with org.apache.derby.iapi.services.context.ShutdownException on 2 of 4 platforms running Solaris zones:

      Platform "sparc_zone2":
      derbynetclientmats/derbynetmats/DerbyNetClient/derbynetmats/testSecMec.diff

      Platform "sparc_zone3":
      derbynetclientmats/derbynetmats/DerbyNetClient/derbynetmats/testSecMec.diff
      derbyall/derbynetclientmats/DerbyNetClient/derbynetmats/derbynetmats/testSecMec.diff

      The test did not fail on other platforms, which may indicate timing sensitivity (tests are run concurrently in 4 zones (1 global, 3 local) on one single machine). Here is one of the diffs (from platform "sparc_zone2"):

                      • Diff file derbynetclientmats/derbynetmats/DerbyNetClient/derbynetmats/testSecMec.diff
          • Start: testSecMec jdk1.6.0-rc DerbyNetClient derbynetmats:derbynetmats 2006-08-14 21:31:48 ***
            308a309,312
            > java.sql.SQLException: Java exception: ': org.apache.derby.iapi.services.context.ShutdownException'.
            > ... 14 more----------------------------------------------
            > Testing with derby.drda.securityMechanism=INVALID_VALUE
            > EXPECTED EXCEPTION DRDA_InvalidValue.U:Invalid value, INVALID_VALUE, for derby.drda.securityMechanism.
            310,312d313
            < Testing with derby.drda.securityMechanism=INVALID_VALUE
            < EXPECTED EXCEPTION DRDA_InvalidValue.U:Invalid value, INVALID_VALUE, for derby.drda.securityMechanism.
            < -----
            Test Failed.
          • End: testSecMec jdk1.6.0-rc DerbyNetClient derbynetmats:derbynetmats 2006-08-14 21:32:54 ***

      The failure occurred in the DerbyNetClient framework when shutting down the database for the second (and last) time in the method testUSRSSBPWD_with_BUILTIN(). This test method was added August 9, 2006 (DERBY-528).

      Attatching derby.log from the failure in derbynetclientmats/derbynetmats on sparc_zone2.

      1. derby-1751v2.diff
        14 kB
        Fernanda Pizzorno
      2. derby-1751.stat
        0.5 kB
        Fernanda Pizzorno
      3. derby-1751.diff
        14 kB
        Fernanda Pizzorno
      4. ASF.LICENSE.NOT.GRANTED--derby.log
        62 kB
        John H. Embretsen

        Issue Links

          Activity

          Hide
          John H. Embretsen added a comment -

          I have not observed any related failures lately (although I have not seen any test results from Solaris Zones platforms yet, and the platform is not available to me at the moment) so I have confidene that this issue has been fixed. I am closing the issue, thanks for resolving!

          Show
          John H. Embretsen added a comment - I have not observed any related failures lately (although I have not seen any test results from Solaris Zones platforms yet, and the platform is not available to me at the moment) so I have confidene that this issue has been fixed. I am closing the issue, thanks for resolving!
          Hide
          Knut Anders Hatlen added a comment -

          Thanks to Fernanda for fixing the problem and to Bryan for reviewing the patch.
          Committed v2 into trunk with revision 449671, and into 10.2 with revision 449674.

          Show
          Knut Anders Hatlen added a comment - Thanks to Fernanda for fixing the problem and to Bryan for reviewing the patch. Committed v2 into trunk with revision 449671, and into 10.2 with revision 449674.
          Hide
          Bryan Pendleton added a comment -

          Thanks Fernanda for the explanation. Your patch is certainly
          simpler than the previous technique and it is nice to see all
          that test code get simpler. I guess I am a little bit concerned
          that this technique might cause us to miss important messages
          in the server output, but I don't have anything better to suggest
          right now. +1 from me for this patch.

          Show
          Bryan Pendleton added a comment - Thanks Fernanda for the explanation. Your patch is certainly simpler than the previous technique and it is nice to see all that test code get simpler. I guess I am a little bit concerned that this technique might cause us to miss important messages in the server output, but I don't have anything better to suggest right now. +1 from me for this patch.
          Hide
          Fernanda Pizzorno added a comment -

          Hi Bryan,

          The approach I am taking in this patch is similar to the approach
          taken in Derby-273. The difference is that the approach I am
          taking will set the NetworkServer's console output to a file when
          the server is started and the output will continue to be to the
          same file until the server is closed. The approach taken on
          DERBY-273 was to set the output to a file right before shutting
          down the server. This not sufficient to prevent the test from
          failing due to a shut down exception because these exceptions
          do not happen only when the server is shut down, they can also
          happen when the engine is shut down (connection with the property
          shutdown=true).

          Fernanda

          Show
          Fernanda Pizzorno added a comment - Hi Bryan, The approach I am taking in this patch is similar to the approach taken in Derby-273. The difference is that the approach I am taking will set the NetworkServer's console output to a file when the server is started and the output will continue to be to the same file until the server is closed. The approach taken on DERBY-273 was to set the output to a file right before shutting down the server. This not sufficient to prevent the test from failing due to a shut down exception because these exceptions do not happen only when the server is shut down, they can also happen when the engine is shut down (connection with the property shutdown=true). Fernanda
          Hide
          Fernanda Pizzorno added a comment -

          I forgot to run the jdbc40 suite, sorry. Thanks for catching this error Knut Anders. I am attaching a new patch (derby-1751v2.diff) were the problem is fixed.

          Show
          Fernanda Pizzorno added a comment - I forgot to run the jdbc40 suite, sorry. Thanks for catching this error Knut Anders. I am attaching a new patch (derby-1751v2.diff) were the problem is fixed.
          Hide
          Bryan Pendleton added a comment -

          I haven't reviewed your patch, but wonder: it sounds like the approach
          you are taking here is very similar to that taken for DERBY-273. Is that
          true? Can you compare and constrast the approach taken in this issue
          with the one in that issue, as that might assist reviewers who were involved
          in that issue with their review of this issue. Thanks!

          Show
          Bryan Pendleton added a comment - I haven't reviewed your patch, but wonder: it sounds like the approach you are taking here is very similar to that taken for DERBY-273 . Is that true? Can you compare and constrast the approach taken in this issue with the one in that issue, as that might assist reviewers who were involved in that issue with their review of this issue. Thanks!
          Hide
          Knut Anders Hatlen added a comment -

          Hi Fernanda,

          Derbyall passed on JVM 1.5, but the jdbc40 suite (DerbyNetClient, JVM 1.6 b99) failed:

                          • Diff file jdbc40/DerbyNetClient/jdbc40/TestConnectionMethods.diff
              • Start: TestConnectionMethods jdk1.6.0-rc DerbyNetClient jdbc40:jdbc40 2006-09-21 20:18:10 ***
                0 add
                > INFO: Network server shutdown returned: java.lang.NullPointerException
                Test Failed.
              • End: TestConnectionMethods jdk1.6.0-rc DerbyNetClient jdbc40:jdbc40 2006-09-21 20:18:19 ***

          Could this be related to your patch?

          Show
          Knut Anders Hatlen added a comment - Hi Fernanda, Derbyall passed on JVM 1.5, but the jdbc40 suite (DerbyNetClient, JVM 1.6 b99) failed: Diff file jdbc40/DerbyNetClient/jdbc40/TestConnectionMethods.diff Start: TestConnectionMethods jdk1.6.0-rc DerbyNetClient jdbc40:jdbc40 2006-09-21 20:18:10 *** 0 add > INFO: Network server shutdown returned: java.lang.NullPointerException Test Failed. End: TestConnectionMethods jdk1.6.0-rc DerbyNetClient jdbc40:jdbc40 2006-09-21 20:18:19 *** Could this be related to your patch?
          Hide
          Fernanda Pizzorno added a comment -

          The attached patch (derby-1751.diff) avoids the problem seen in this issue by setting the console output of the network server to a file. This change in made to the following files:

          • java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestConnectionMethods.java
          • java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testSecMec.java
          • java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dataSourcePermissions_net.java
          • java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java

          It also changes DRDAProtocolException so that agent Errors will be printed to the network server console intead of System.out.

          I have successfully run derbyall with this patch, and I have verified that shutdown exceptions do not cause the test to fail with this patch. Can someone please review it?

          Thank you in advance!

          Show
          Fernanda Pizzorno added a comment - The attached patch (derby-1751.diff) avoids the problem seen in this issue by setting the console output of the network server to a file. This change in made to the following files: java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestConnectionMethods.java java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/testSecMec.java java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dataSourcePermissions_net.java java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java It also changes DRDAProtocolException so that agent Errors will be printed to the network server console intead of System.out. I have successfully run derbyall with this patch, and I have verified that shutdown exceptions do not cause the test to fail with this patch. Can someone please review it? Thank you in advance!
          Hide
          Rick Hillegas added a comment -

          Moving to 10.2.2.0.

          Show
          Rick Hillegas added a comment - Moving to 10.2.2.0.
          Hide
          Bryan Pendleton added a comment -

          DERBY-1114 also seems relevant to this issue. It seems like
          DERBY-273, DERBY-1114, and DERBY-1751 should all be
          considered as an "ongoing thread" of issues with this particular test.

          Show
          Bryan Pendleton added a comment - DERBY-1114 also seems relevant to this issue. It seems like DERBY-273 , DERBY-1114 , and DERBY-1751 should all be considered as an "ongoing thread" of issues with this particular test.
          Hide
          Bryan Pendleton added a comment -

          This sounds quite similar to DERBY-273.

          Show
          Bryan Pendleton added a comment - This sounds quite similar to DERBY-273 .
          Hide
          Knut Anders Hatlen added a comment -

          This test and many others fail intermittently this way because they start a network server within the test itself. Since the server is running in the same process as the test, harmless exceptions (caused by the database engine shutting down at the same time as one of the server threads is closing a connection) are printed together with the test output. Since these tests are not testing engine shutdown behaviour, they should ignore server output.

          The network server is started like this:
          networkServer = new NetworkServerControl(InetAddress.getByName(hostName),NETWORKSERVER_PORT);
          networkServer.start(null);

          The null argument given to start() means that console output should be disabled. However, it doesn't disable all output. Some of the consolePrint* methods print exceptions to System.err when the console is null. The only way to make the server completely silent, is to set the console printer to a stream which just throws away all output. Something like:

          PrintWriter pw = new PrintWriter(new OutputStream() { public void write(int b) { } });
          networkServer.start(pw);

          Show
          Knut Anders Hatlen added a comment - This test and many others fail intermittently this way because they start a network server within the test itself. Since the server is running in the same process as the test, harmless exceptions (caused by the database engine shutting down at the same time as one of the server threads is closing a connection) are printed together with the test output. Since these tests are not testing engine shutdown behaviour, they should ignore server output. The network server is started like this: networkServer = new NetworkServerControl(InetAddress.getByName(hostName),NETWORKSERVER_PORT); networkServer.start(null); The null argument given to start() means that console output should be disabled. However, it doesn't disable all output. Some of the consolePrint* methods print exceptions to System.err when the console is null. The only way to make the server completely silent, is to set the console printer to a stream which just throws away all output. Something like: PrintWriter pw = new PrintWriter(new OutputStream() { public void write(int b) { } }); networkServer.start(pw);

            People

            • Assignee:
              Fernanda Pizzorno
              Reporter:
              John H. Embretsen
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development