From e2777395bbf687915c970f16ab597ac714f8f559 Mon Sep 17 00:00:00 2001 From: David Mechler Date: Tue, 17 Nov 2020 17:26:05 -0500 Subject: [PATCH] Additional spot to exit upon no space left on device exception (#1579) * 1411 - additional spot to exit when no space exception thrown Signed-off-by: David Mechler --- .../query/cache/TransactionLogBloomCacher.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/query/cache/TransactionLogBloomCacher.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/query/cache/TransactionLogBloomCacher.java index c0c418f827..2f60e70f94 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/query/cache/TransactionLogBloomCacher.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/query/cache/TransactionLogBloomCacher.java @@ -49,6 +49,7 @@ import org.apache.logging.log4j.Logger; public class TransactionLogBloomCacher { private static final Logger LOG = LogManager.getLogger(); + private static final String NO_SPACE_LEFT_ON_DEVICE = "No space left on device"; public static final int BLOCKS_PER_BLOOM_CACHE = 100_000; public static final int BLOOM_BITS_LENGTH = 256; @@ -140,6 +141,12 @@ public class TransactionLogBloomCacher { cachingStatus.currentBlock = blockNum; blockNum++; } + } catch (IOException e) { + if (e.getMessage().contains(NO_SPACE_LEFT_ON_DEVICE)) { + LOG.error(e.getMessage()); + System.exit(0); + } + throw e; } } @@ -178,6 +185,10 @@ public class TransactionLogBloomCacher { populateLatestSegment(blockNumber); } } catch (final IOException e) { + if (e.getMessage().contains(NO_SPACE_LEFT_ON_DEVICE)) { + LOG.error(e.getMessage()); + System.exit(0); + } LOG.error("Unhandled caching exception.", e); } finally { cachingStatus.cachingCount.decrementAndGet(); @@ -257,6 +268,10 @@ public class TransactionLogBloomCacher { cacheFile.getName()); } } catch (final IOException e) { + if (e.getMessage().contains(NO_SPACE_LEFT_ON_DEVICE)) { + LOG.error(e.getMessage()); + System.exit(0); + } LOG.error( String.format("Unhandled exception removing cache for block number %d", blockNum), e); }