Skip to content

Commit

Permalink
Fail publisher thread on LinkageErrors. These happen with joda time. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Nextdoor Engineer authored and chaochenq committed Jun 13, 2017
1 parent 51c60e0 commit 69f7b41
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/com/amazon/kinesis/streaming/agent/Agent.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ public static void main(String[] args) throws Exception {
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
if (e instanceof OutOfMemoryError) {
// This prevents the JVM from hanging in case of an OOME
if (e instanceof OutOfMemoryError || e instanceof LinkageError) {
// This prevents the JVM from hanging in case of an OOME and if we have a LinkageError
// we can't trust the JVM state.
dontShutdownOnExit = true;
}
String msg = "FATAL: Thread " + t.getName() + " threw an unrecoverable error. Aborting application";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ public void runOnce() {
metricsPublisher.publishMetrics(dataToPublish);
} catch (Throwable t) {
LOG.error("Caught exception thrown by metrics Publisher in CWPublisherRunnable", t);
if (t instanceof LinkageError) {
throw t;
}
}
// Changing the value of lastFlushTime will change the time when metrics are flushed next.
lastFlushTime = getTime() + nextJitterValueToUse;
Expand Down

0 comments on commit 69f7b41

Please sign in to comment.