NO-JIRA Fixing intermittent failures

This commit is contained in:
Clebert Suconic 2019-09-10 14:53:49 -04:00
parent d888e91cf2
commit 7fd7558ed8
1 changed files with 6 additions and 15 deletions

View File

@ -143,6 +143,7 @@ import org.apache.activemq.artemis.utils.RandomUtil;
import org.apache.activemq.artemis.utils.ThreadDumpUtil; import org.apache.activemq.artemis.utils.ThreadDumpUtil;
import org.apache.activemq.artemis.utils.ThreadLeakCheckRule; import org.apache.activemq.artemis.utils.ThreadLeakCheckRule;
import org.apache.activemq.artemis.utils.UUIDGenerator; import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.apache.activemq.artemis.utils.Wait;
import org.apache.activemq.artemis.utils.actors.OrderedExecutorFactory; import org.apache.activemq.artemis.utils.actors.OrderedExecutorFactory;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.junit.After; import org.junit.After;
@ -2025,17 +2026,7 @@ public abstract class ActiveMQTestBase extends Assert {
} }
} }
private void checkFilesUsage() { private void checkFilesUsage() throws Exception {
long timeout = System.currentTimeMillis() + 15000;
while (LibaioContext.getTotalMaxIO() != 0 && System.currentTimeMillis() > timeout) {
try {
Thread.sleep(100);
} catch (Exception ignored) {
}
}
int invmSize = InVMRegistry.instance.size(); int invmSize = InVMRegistry.instance.size();
if (invmSize > 0) { if (invmSize > 0) {
InVMRegistry.instance.clear(); InVMRegistry.instance.clear();
@ -2043,11 +2034,11 @@ public abstract class ActiveMQTestBase extends Assert {
fail("invm registry still had acceptors registered"); fail("invm registry still had acceptors registered");
} }
final long totalMaxIO = LibaioContext.getTotalMaxIO(); if (!Wait.waitFor(() -> LibaioContext.getTotalMaxIO() == 0)) {
if (totalMaxIO != 0) { Assert.fail("There are still libaio files open :: " + LibaioContext.getTotalMaxIO());
LibaioContext.resetMaxAIO(); Assert.fail("test did not close all its files " + LibaioContext.getTotalMaxIO());
Assert.fail("test did not close all its files " + totalMaxIO);
} }
} }
private void cleanupPools() { private void cleanupPools() {