Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
niloc132 committed Aug 29, 2022
1 parent 7063333 commit 49fc641
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -45,6 +45,7 @@
import java.util.Enumeration;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Logger;

import static com.google.common.base.Preconditions.checkArgument;
Expand Down Expand Up @@ -279,6 +280,7 @@ private static final class GrpcReadListener implements ReadListener {
final AsyncContext asyncCtx;
final ServletInputStream input;
final InternalLogId logId;
private final AtomicBoolean closed = new AtomicBoolean(false);

GrpcReadListener(
ServletServerStream stream,
Expand Down Expand Up @@ -321,6 +323,11 @@ public void onDataAvailable() throws IOException {
@Override
public void onAllDataRead() {
logger.log(FINE, "[{0}] onAllDataRead", logId);
if (!closed.compareAndSet(false, true)) {
// https://github.com/eclipse/jetty.project/issues/8405
logger.log(FINE, "[{0}] onAllDataRead already called, skipping this one", logId);
return;
}
stream.transportState().runOnTransportThread(
() -> stream.transportState().inboundDataReceived(ReadableBuffers.empty(), true));
}
Expand Down

0 comments on commit 49fc641

Please sign in to comment.