db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r1065141 - in /db/derby/code/branches/10.5: ./ java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockMinion.java java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockTest.java
Date Sat, 29 Jan 2011 23:25:42 GMT
Author: kmarsden
Date: Sat Jan 29 23:25:41 2011
New Revision: 1065141

URL: http://svn.apache.org/viewvc?rev=1065141&view=rev
Log:
DERBY-4987 BootLockTest can hang reading spawned process output

The test will now only attempt to get the error output if BootLockMinion has exited and also
has a max timeout of ten minutes which won't slow down normal runs of the test but hopefully
be long enough without risk of hanging again. 




Modified:
    db/derby/code/branches/10.5/   (props changed)
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockMinion.java
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockTest.java

Propchange: db/derby/code/branches/10.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Jan 29 23:25:41 2011
@@ -1,2 +1,2 @@
 /db/derby/code/branches/10.6:942027,957000,962738,965351,987678,1055601
-/db/derby/code/trunk:757811,764912,769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,791027,792001,792254,792434,793089,793588,794106,794276,794303,794955,795166,795459,796020,796027,796316,796372,797147,798347,798742,800523,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,827505,829022,829410,830545,831304,831319,832379,833430,835286,881074,881444,882732,884163,885421,885659,887246,888311,892912,897161,898635,901165,901648,901760,902857,903108,905224,908418,908586,909176,910481,910511,911315,911793,915177,915733,916075,916897,917771,918152,918359,921028,927430,928065,929085,934474,936215,938959,940462,940469,942286,942476,942480,942587,946794,948045,948069,951346,951366,952138,952581,954748,955001,955634,956075,956445,956659,958163,959550,962716,965647,967304,980684,986689,986834,999119,1002291,1002682,1002853,102142
 6,1025795,1040658,1053724,1055169,1062096,1063809
+/db/derby/code/trunk:757811,764912,769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,791027,792001,792254,792434,793089,793588,794106,794276,794303,794955,795166,795459,796020,796027,796316,796372,797147,798347,798742,800523,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,827505,829022,829410,830545,831304,831319,832379,833430,835286,881074,881444,882732,884163,885421,885659,887246,888311,892912,897161,898635,901165,901648,901760,902857,903108,905224,908418,908586,909176,910481,910511,911315,911793,915177,915733,916075,916897,917771,918152,918359,921028,927430,928065,929085,934474,936215,938959,940462,940469,942286,942476,942480,942587,946794,948045,948069,951346,951366,952138,952581,954748,955001,955634,956075,956445,956659,958163,959550,962716,965647,967304,980684,986689,986834,999119,1002291,1002682,1002853,102142
 6,1025795,1040658,1053724,1055169,1062096,1063809,1065061

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockMinion.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockMinion.java?rev=1065141&r1=1065140&r2=1065141&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockMinion.java
(original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockMinion.java
Sat Jan 29 23:25:41 2011
@@ -38,6 +38,8 @@ import org.apache.derby.jdbc.EmbeddedSim
  */
 
 public class BootLockMinion {
+    private static int WAIT_FOR_DESTROY_MAX_MILLIS = BootLockTest.MINION_WAIT_MAX_MILLIS;
+    
     public static void main(String[] args) {
         String dbName = args[0];
         Connection con;
@@ -60,10 +62,13 @@ public class BootLockMinion {
             File checkFile = new File(BootLockTest.minionCompleteFileName);
             checkFile.createNewFile();
             //infinite loop until we get killed by BootLockTest.java
-            for(;;)
+            int wait = WAIT_FOR_DESTROY_MAX_MILLIS;
+            while(wait > 0)
             {
-                Thread.sleep(30000);
+                Thread.sleep(10000);
+                wait -= 10000;
             }
+            System.err.println("BootLockMinion exceeded maximum wait for destroy");
         }
         catch (Exception e) {
             e.printStackTrace();

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockTest.java?rev=1065141&r1=1065140&r2=1065141&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockTest.java
(original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockTest.java
Sat Jan 29 23:25:41 2011
@@ -74,6 +74,8 @@ public class BootLockTest extends BaseJD
 
     private final static String DATA_MULTIPLE_JBMS_ON_DB = "XSDB6";
     private final static String DATA_MULTIPLE_JBMS_FORCE_LOCK = "XSDB8";
+    // Ten minutes should hopefully be enough!
+    public static final int MINION_WAIT_MAX_MILLIS = 600000;
 
     /**
      * Constructor
@@ -130,7 +132,7 @@ public class BootLockTest extends BaseJD
         Process p = null;
 
         p = execJavaCmd(cmd);
-        waitForMinionBoot(p,60000);
+        waitForMinionBoot(p,MINION_WAIT_MAX_MILLIS);
 
         // We now know minion has booted
 
@@ -174,6 +176,8 @@ public class BootLockTest extends BaseJD
     }
 
     private void waitForMinionBoot(Process p, int waitmillis) throws InterruptedException
{
+        boolean minionComplete;
+        int minionExitValue;
         StringBuffer failmsg = new StringBuffer();
         // boolean set to true once we find the  lock file
         File lockFile = new File(dbLockFile);
@@ -202,22 +206,38 @@ public class BootLockTest extends BaseJD
         
         // If we got here, the database did not boot. Try to print the error.
         failmsg.append(
-                "Minion did not start or boot db in 60 seconds.\n" +
-                "----Minion's stderr:\n");
-        do {
-            try {
-                minionErrLine = minionSysErr.readLine();
-            } catch (Exception ioe) {
-                // may not always work, so just bail out.
-                failmsg.append("could not read minion's stderr");
-            }
-
-            if (minionErrLine != null) {
-                failmsg.append(minionErrLine);
-            }
-        } while (minionErrLine != null);
+                "Minion did not start or boot db in " +
+                (MINION_WAIT_MAX_MILLIS/1000) +
+                " seconds.\n");                
+        try {
+            minionExitValue = p.exitValue();
+            minionComplete =true;
+            failmsg.append("exitValue = " + minionExitValue);
+        }catch (IllegalThreadStateException e )
+        {
+            // got exception on exitValue.
+            // still running ..
+            minionComplete=false;
+        }
+        // If the process exited try to print why.
+        if (minionComplete) {
+            failmsg.append("----Process exited. Minion's stderr:\n");
+            do {
+                try {
+                    minionErrLine = minionSysErr.readLine();
+                } catch (Exception ioe) {
+                    // may not always work, so just bail out.
+                    failmsg.append("could not read minion's stderr");
+                }
+
+                if (minionErrLine != null) {
+                    failmsg.append(minionErrLine);
+                }
+            } while (minionErrLine != null);
 
-        failmsg.append("\n----Minion's stderr ended");
+            failmsg.append("\n----Minion's stderr ended");
+        }
+        
         p.destroy();
         p.waitFor();
         fail(failmsg.toString());



Mime
View raw message