Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 12967 invoked from network); 29 Jan 2011 23:26:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 29 Jan 2011 23:26:59 -0000 Received: (qmail 48892 invoked by uid 500); 29 Jan 2011 23:26:59 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 48852 invoked by uid 500); 29 Jan 2011 23:26:59 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 48845 invoked by uid 99); 29 Jan 2011 23:26:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 29 Jan 2011 23:26:59 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 29 Jan 2011 23:26:58 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 488C7238896F; Sat, 29 Jan 2011 23:26:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1065142 - in /db/derby/code/branches/10.7: ./ 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:26:38 -0000 To: derby-commits@db.apache.org From: kmarsden@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110129232638.488C7238896F@eris.apache.org> Author: kmarsden Date: Sat Jan 29 23:26:37 2011 New Revision: 1065142 URL: http://svn.apache.org/viewvc?rev=1065142&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.7/ (props changed) db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockMinion.java db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockTest.java Propchange: db/derby/code/branches/10.7/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Jan 29 23:26:37 2011 @@ -1 +1 @@ -/db/derby/code/trunk:1035603,1036769,1038514,1038813,1039084,1039268,1040658,1041338,1043227,1043389,1044096,1051026,1053724,1055169,1059888,1060480,1062096,1063809 +/db/derby/code/trunk:1035603,1036769,1038514,1038813,1039084,1039268,1040658,1041338,1043227,1043389,1044096,1051026,1053724,1055169,1059888,1060480,1062096,1063809,1065061 Modified: db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockMinion.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockMinion.java?rev=1065142&r1=1065141&r2=1065142&view=diff ============================================================================== --- db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockMinion.java (original) +++ db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockMinion.java Sat Jan 29 23:26:37 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.7/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockTest.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockTest.java?rev=1065142&r1=1065141&r2=1065142&view=diff ============================================================================== --- db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockTest.java (original) +++ db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockTest.java Sat Jan 29 23:26:37 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());