You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by km...@apache.org on 2010/03/19 19:54:04 UTC

svn commit: r925377 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStart.java

Author: kmarsden
Date: Fri Mar 19 18:54:04 2010
New Revision: 925377

URL: http://svn.apache.org/viewvc?rev=925377&view=rev
Log:
DERBY-4322  intermittent failure in runtimeinfo.

Contributed by Myrna van Lunteren.

The theory is that this failure is caused by a problem in the previous test DerbyNetAutostart which launches a process to start the server and can be left pinging if the check for the server in the launching process, does not allow enough time for the server to come up.  The pings increment the session number as seen by runtimeinfo.  So the changes are to DerbyNetAutoStart and are to

1) Make sure the server launching process retries enough times for the launched process comes up.
2) Make sure if something does go wrong, the launched process is destroyed


Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStart.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStart.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStart.java?rev=925377&r1=925376&r2=925377&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStart.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/DerbyNetAutoStart.java Fri Mar 19 18:54:04 2010
@@ -82,6 +82,7 @@ public class DerbyNetAutoStart
     private static StringBuffer basePropertiesSB = new StringBuffer();
     private static File derbyPropertiesFile;
     private static final Properties authenticationProperties;
+    private static Process serverProcess;
     static
     {
         authenticationProperties = new Properties();
@@ -95,16 +96,22 @@ public class DerbyNetAutoStart
     public static void main( String[] args)
     {
         setup( args);
-        runAllTests();
-        if( passed)
-        {
-            System.out.println( "PASSED.");
-            System.exit(0);
-        }
-        else
-        {
-            System.out.println( "FAILED.");
-            System.exit(1);
+        try { 
+            runAllTests();
+            if( passed)
+            {
+                System.out.println( "PASSED.");
+                System.exit(0);
+            }
+            else
+            {
+                System.out.println( "FAILED.");
+                System.exit(1);
+            }
+            // ensure the serverProcess goes away in case of an error somewhere
+        } finally {
+            if (serverProcess != null)
+                serverProcess.destroy();
         }
     } // end of main
 
@@ -150,7 +157,7 @@ public class DerbyNetAutoStart
 					}
 					// Block so other process can get connections
 					while (isServerStarted(server))
-						Thread.sleep(500);
+						Thread.sleep(1000);
                     System.exit(0);
                 }
             }
@@ -329,7 +336,7 @@ public class DerbyNetAutoStart
         {
             try
             {
-                Thread.sleep(500);
+                Thread.sleep(1000);
             }
             catch( InterruptedException ie){};
 
@@ -340,7 +347,7 @@ public class DerbyNetAutoStart
             }
             catch( SQLException sqle)
             {
-                if( ntries > 20)
+                if( ntries > 60)
                 {
                     System.out.println( "Server start failed: " +
 										sqle.getMessage());
@@ -553,7 +560,7 @@ public class DerbyNetAutoStart
                 }
                 catch( SQLException sqle)
                 {
-                    if( ntries > 5)
+                    if( ntries > 20)
                     {
                         passed = false;
                         System.out.println( "  Could not access database through the network server.");