Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

servlet: ignore IllegalStateException from AsyncContext.complete() #11819

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,12 @@
transportState.runOnTransportThread(
() -> {
transportState.complete();
asyncContext.complete();
try {
asyncContext.complete();
} catch (IllegalStateException ignored) {
// Tomcat can throw:
// Calling [asyncComplete()] is not valid for a request with Async state [COMPLETING]
}
log.fine("call completed");
});
};
Expand Down Expand Up @@ -254,7 +259,7 @@
@VisibleForTesting // Lincheck test can not run with java.util.logging dependency.
interface Log {
default boolean isLoggable(Level level) {
return false;
return false;

Check warning on line 262 in servlet/src/main/java/io/grpc/servlet/AsyncServletOutputStreamWriter.java

View check run for this annotation

Codecov / codecov/patch

servlet/src/main/java/io/grpc/servlet/AsyncServletOutputStreamWriter.java#L262

Added line #L262 was not covered by tests
}

default void fine(String str, Object...params) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,12 @@ public void cancel(Status status) {
close(Status.CANCELLED.withCause(status.asRuntimeException()), new Metadata());
CountDownLatch countDownLatch = new CountDownLatch(1);
transportState.runOnTransportThread(() -> {
asyncCtx.complete();
try {
asyncCtx.complete();
} catch (IllegalStateException ignored) {
// Tomcat can throw:
// Calling [asyncComplete()] is not valid for a request with Async state [COMPLETING]
}
countDownLatch.countDown();
});
try {
Expand Down
Loading