some more info to this test to help diagnose intermittent ci failure, works fine locally

This commit is contained in:
gtully 2014-03-12 14:01:08 +00:00
parent 67f151fe0b
commit 128921e687
1 changed files with 13 additions and 6 deletions

View File

@ -19,6 +19,7 @@ package org.apache.activemq.bugs;
import java.io.File;
import java.lang.IllegalStateException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Timer;
import java.util.TimerTask;
@ -518,12 +519,17 @@ public class AMQ2149Test {
threads.add(thread);
}
final long expiry = System.currentTimeMillis() + 1000 * 60 * 30;
final long expiry = System.currentTimeMillis() + 1000 * 60 * 4;
while(!threads.isEmpty() && exceptions.isEmpty() && System.currentTimeMillis() < expiry) {
Thread sendThread = threads.firstElement();
sendThread.join(1000*10);
sendThread.join(1000*20);
if (!sendThread.isAlive()) {
threads.remove(sendThread);
} else {
Throwable throwable = new Throwable("blocked send thread");
throwable.setStackTrace(sendThread.getStackTrace());
LOG.error("Send thread blocked", throwable);
throwable.printStackTrace();
}
}
LOG.info("senders done..." + threads);
@ -535,10 +541,6 @@ public class AMQ2149Test {
receivers.remove(receiver);
}
}
assertTrue("No timeout waiting for senders/receivers to complete", System.currentTimeMillis() < expiry);
if (!exceptions.isEmpty()) {
exceptions.get(0).printStackTrace();
}
for (Connection connection : connections) {
try {
@ -547,6 +549,11 @@ public class AMQ2149Test {
}
connections.clear();
assertTrue("No timeout waiting for senders/receivers to complete", System.currentTimeMillis() < expiry);
if (!exceptions.isEmpty()) {
exceptions.get(0).printStackTrace();
}
LOG.info("Dangling threads: " + threads);
for (Thread dangling : threads) {
dangling.interrupt();