YARN-6376. Exceptions caused by synchronous putEntities requests can be swallowed (Haibo Chen via Varun Saxena)

This commit is contained in:
Varun Saxena 2017-03-31 02:17:20 +05:30
parent 7c2bc444b3
commit b58777a9c9
2 changed files with 14 additions and 3 deletions

View File

@ -137,8 +137,14 @@ public abstract class TimelineCollector extends CompositeService {
+ callerUgi + ")");
}
TimelineWriteResponse response = writeTimelineEntities(entities);
flushBufferedTimelineEntities();
TimelineWriteResponse response;
// synchronize on the writer object so that no other threads can
// flush the writer buffer concurrently and swallow any exception
// caused by the timeline enitites that are being put here.
synchronized (writer) {
response = writeTimelineEntities(entities);
flushBufferedTimelineEntities();
}
return response;
}

View File

@ -259,7 +259,12 @@ public class TimelineCollectorManager extends AbstractService {
public void run() {
try {
writer.flush();
// synchronize on the writer object to avoid flushing timeline
// entities placed on the buffer by synchronous putEntities
// requests.
synchronized (writer) {
writer.flush();
}
} catch (Throwable th) {
// we need to handle all exceptions or subsequent execution may be
// suppressed