This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push: new 711b412 BZ 64188. Channel errors should close the channel, not the connection. 711b412 is described below commit 711b41246ccea8fc91b156dba459991902442179 Author: Mark Thomas <ma...@apache.org> AuthorDate: Mon Mar 2 20:11:58 2020 +0000 BZ 64188. Channel errors should close the channel, not the connection. https://bz.apache.org/bugzilla/show_bug.cgi?id=64188 Based on a suggestion by Alejandro Anadon --- java/org/apache/coyote/AbstractProcessor.java | 19 ++++++++++++++----- webapps/docs/changelog.xml | 7 +++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/java/org/apache/coyote/AbstractProcessor.java b/java/org/apache/coyote/AbstractProcessor.java index 3c0c3b9..80335a7 100644 --- a/java/org/apache/coyote/AbstractProcessor.java +++ b/java/org/apache/coyote/AbstractProcessor.java @@ -374,7 +374,7 @@ public abstract class AbstractProcessor extends AbstractProcessorLight implement // Validate and write response headers prepareResponse(); } catch (IOException e) { - setErrorState(ErrorState.CLOSE_CONNECTION_NOW, e); + handleIOException(e); } } break; @@ -383,10 +383,8 @@ public abstract class AbstractProcessor extends AbstractProcessorLight implement action(ActionCode.COMMIT, null); try { finishResponse(); - } catch (CloseNowException cne) { - setErrorState(ErrorState.CLOSE_NOW, cne); } catch (IOException e) { - setErrorState(ErrorState.CLOSE_CONNECTION_NOW, e); + handleIOException(e); } break; } @@ -399,7 +397,7 @@ public abstract class AbstractProcessor extends AbstractProcessorLight implement try { flush(); } catch (IOException e) { - setErrorState(ErrorState.CLOSE_CONNECTION_NOW, e); + handleIOException(e); response.setErrorException(e); } break; @@ -625,6 +623,17 @@ public abstract class AbstractProcessor extends AbstractProcessorLight implement } + private void handleIOException (IOException ioe) { + if (ioe instanceof CloseNowException) { + // Close the channel but keep the connection open + setErrorState(ErrorState.CLOSE_NOW, ioe); + } else { + // Close the connection and all channels within that connection + setErrorState(ErrorState.CLOSE_CONNECTION_NOW, ioe); + } + } + + /** * Perform any necessary processing for a non-blocking read before * dispatching to the adapter. diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 8e41bd8..52ff0ff 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -116,6 +116,13 @@ A zero length AJP secret will now behave as if it has not been specified. (remm) </fix> + <fix> + <bug>64188</bug>: If an error occurs while committing or flushing the + response when using a multiplexing protocol like HTTP/2 that requires + the channel to be closed but not the connection, just close the channel + and allow the other channels using the connection to continue. Based on + a suggestion from Alejandro Anadon. (markt) + </fix> </changelog> </subsection> <subsection name="Jasper"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org