Fix race condition in HttpPostEmitter (#13237)

This commit is contained in:
Abhishek Agarwal 2022-10-20 13:40:25 +05:30 committed by GitHub
parent c83115e4e1
commit 9763bf8050
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 5 deletions

View File

@ -534,11 +534,6 @@ public class HttpPostEmitter implements Flushable, Closeable, Emitter
Object batch = concurrentBatch.get(); Object batch = concurrentBatch.get();
if (batch instanceof Batch) { if (batch instanceof Batch) {
((Batch) batch).sealIfFlushNeeded(); ((Batch) batch).sealIfFlushNeeded();
} else {
// batch == null means that HttpPostEmitter is terminated. Batch object might also be a Long object if some
// thread just failed with a serious error in onSealExclusive(). In this case we don't want to shutdown
// the emitter thread.
needsToShutdown = batch == null;
} }
} }
return needsToShutdown; return needsToShutdown;