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 2011/01/30 00:27:37 UTC
svn commit: r1065143 - in /db/derby/code/branches/10.6: ./
java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockMinion.java
java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockTest.java
Author: kmarsden
Date: Sat Jan 29 23:27:37 2011
New Revision: 1065143
URL: http://svn.apache.org/viewvc?rev=1065143&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.6/ (props changed)
db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockMinion.java
db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockTest.java
Propchange: db/derby/code/branches/10.6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Jan 29 23:27:37 2011
@@ -1,2 +1,2 @@
-/db/derby/code/trunk:938547,938796,938959,939231,940462,940469,941627,942031,942286,942476,942480,942587,944152,946794,948045,948069,951346,951366,952138,952237,952581,954344,954421,954544,954748,955001,955540,955634,956075,956234,956445,956569,956659,957260,957902,958163,958257,958264,958508,958522,958555,958618,958939,959550,962716,963206,963705,964115,965647,967304,980684,986689,986834,987539,989099,990292,997325,998170,999119,1002291,1002682,1002853,1021426,1025795,1028716,1030043,1033864,1038514,1040658,1053724,1055169,1062096,1063809
+/db/derby/code/trunk:938547,938796,938959,939231,940462,940469,941627,942031,942286,942476,942480,942587,944152,946794,948045,948069,951346,951366,952138,952237,952581,954344,954421,954544,954748,955001,955540,955634,956075,956234,956445,956569,956659,957260,957902,958163,958257,958264,958508,958522,958555,958618,958939,959550,962716,963206,963705,964115,965647,967304,980684,986689,986834,987539,989099,990292,997325,998170,999119,1002291,1002682,1002853,1021426,1025795,1028716,1030043,1033864,1038514,1040658,1053724,1055169,1062096,1063809,1065061
/db/derby/docs/trunk:954344
Modified: db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockMinion.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockMinion.java?rev=1065143&r1=1065142&r2=1065143&view=diff
==============================================================================
--- db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockMinion.java (original)
+++ db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockMinion.java Sat Jan 29 23:27: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.6/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockTest.java?rev=1065143&r1=1065142&r2=1065143&view=diff
==============================================================================
--- db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockTest.java (original)
+++ db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/store/BootLockTest.java Sat Jan 29 23:27: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());