ARTEMIS-3084 Issue a warning instead of blocking forever in case of not completing closes
This commit is contained in:
parent
7ce5315d7a
commit
b05bea7db9
|
@ -21,6 +21,7 @@ import java.io.IOException;
|
|||
import java.nio.ByteBuffer;
|
||||
import java.util.PriorityQueue;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.ActiveMQException;
|
||||
|
@ -134,10 +135,14 @@ public class AIOSequentialFile extends AbstractSequentialFile {
|
|||
@Override
|
||||
public void waitNotPending() {
|
||||
try {
|
||||
short retryPending = 0;
|
||||
do {
|
||||
pendingCallbacks.await();
|
||||
pendingCallbacks.await(1, TimeUnit.SECONDS);
|
||||
}
|
||||
while(pendingClose && retryPending < 60);
|
||||
if (pendingClose) {
|
||||
AIOSequentialFileFactory.threadDump("File " + getFileName() + " still has pending IO before closing it");
|
||||
}
|
||||
while(pendingClose);
|
||||
} catch (InterruptedException e) {
|
||||
// nothing to be done here, other than log it and forward it
|
||||
logger.warn(e.getMessage(), e);
|
||||
|
|
|
@ -304,11 +304,7 @@ public final class AIOSequentialFileFactory extends AbstractSequentialFileFactor
|
|||
try {
|
||||
// if we stop libaioContext before we finish this, we will never get confirmation on items previously sent
|
||||
if (!pendingClose.await(1, TimeUnit.MINUTES)) {
|
||||
ActiveMQJournalLogger.LOGGER.warn("Timeout on waiting for asynchronous close");
|
||||
final ThreadInfo[] threads = ManagementFactory.getThreadMXBean().dumpAllThreads(true, true);
|
||||
for (ThreadInfo threadInfo : threads) {
|
||||
ActiveMQJournalLogger.LOGGER.warn(threadInfo.toString());
|
||||
}
|
||||
threadDump("Timeout on waiting for asynchronous close");
|
||||
}
|
||||
} catch (Throwable throwableToLog) {
|
||||
logger.warn(throwableToLog.getMessage(), throwableToLog);
|
||||
|
@ -333,6 +329,13 @@ public final class AIOSequentialFileFactory extends AbstractSequentialFileFactor
|
|||
}
|
||||
}
|
||||
|
||||
static void threadDump(String message) {
|
||||
ActiveMQJournalLogger.LOGGER.warn(message);
|
||||
final ThreadInfo[] threads = ManagementFactory.getThreadMXBean().dumpAllThreads(true, true);
|
||||
for (ThreadInfo threadInfo : threads) {
|
||||
ActiveMQJournalLogger.LOGGER.warn(threadInfo.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The same callback is used for Runnable executor.
|
||||
|
|
Loading…
Reference in New Issue