Skip to content
This repository has been archived by the owner on Mar 27, 2021. It is now read-only.

Commit

Permalink
Add log of current number of data points for debugging OOMing (#688)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Rustamov authored Aug 27, 2020
1 parent 9c9c6ca commit ab84a98
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions heroic-core/src/main/java/com/spotify/heroic/HeroicCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ public class HeroicCore implements HeroicConfiguration {
(Thread t, Throwable e) -> {
//noinspection finally
try {
System.out.print("The Heroic is dying heroically now!\n");
System.out.flush();
System.err.println(
String.format("Uncaught exception caught in thread %s, exiting...", t));
e.printStackTrace(System.err);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -724,15 +724,21 @@ private QuotaWatcher(final long dataLimit, final long retainLimit,

@Override
public void readData(long n) {
read.addAndGet(n);
long curDataPoints = read.addAndGet(n);
if (curDataPoints > 1_000_000) {
log.info("Current data points num: {}", curDataPoints);
}
throwIfViolated();
// Must be called after checkViolation above, since that one might throw an exception.
dataInMemoryReporter.reportDataHasBeenRead(n);
}

@Override
public void retainData(final long n) {
retained.addAndGet(n);
long curRetainedDataPoints = retained.addAndGet(n);
if (curRetainedDataPoints > 500_000) {
log.info("Current retained data points num: {}", curRetainedDataPoints);
}
throwIfViolated();
}

Expand Down

0 comments on commit ab84a98

Please sign in to comment.