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 <david.mechler@consensys.net>
pull/1581/head
David Mechler 4 years ago committed by GitHub
parent 9bc90442d2
commit e2777395bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      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 { public class TransactionLogBloomCacher {
private static final Logger LOG = LogManager.getLogger(); 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 BLOCKS_PER_BLOOM_CACHE = 100_000;
public static final int BLOOM_BITS_LENGTH = 256; public static final int BLOOM_BITS_LENGTH = 256;
@ -140,6 +141,12 @@ public class TransactionLogBloomCacher {
cachingStatus.currentBlock = blockNum; cachingStatus.currentBlock = blockNum;
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); populateLatestSegment(blockNumber);
} }
} catch (final IOException e) { } 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); LOG.error("Unhandled caching exception.", e);
} finally { } finally {
cachingStatus.cachingCount.decrementAndGet(); cachingStatus.cachingCount.decrementAndGet();
@ -257,6 +268,10 @@ public class TransactionLogBloomCacher {
cacheFile.getName()); cacheFile.getName());
} }
} catch (final IOException e) { } catch (final IOException e) {
if (e.getMessage().contains(NO_SPACE_LEFT_ON_DEVICE)) {
LOG.error(e.getMessage());
System.exit(0);
}
LOG.error( LOG.error(
String.format("Unhandled exception removing cache for block number %d", blockNum), e); String.format("Unhandled exception removing cache for block number %d", blockNum), e);
} }

Loading…
Cancel
Save