This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new c3b7372 Revert stream memory footprint reduction and incomplete fixes c3b7372 is described below commit c3b7372b2bd09973222d5d6d5610a5e09d1292bc Author: Mark Thomas <ma...@apache.org> AuthorDate: Tue Sep 8 10:16:57 2020 +0100 Revert stream memory footprint reduction and incomplete fixes Revert the changes due to the steady stream of regressions that are being reported and.or found by the CI systems. A more robust solution is required. --- java/org/apache/coyote/http2/Stream.java | 41 +++++++++++--------------------- webapps/docs/changelog.xml | 5 ++++ 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/java/org/apache/coyote/http2/Stream.java b/java/org/apache/coyote/http2/Stream.java index 46719da..813980c 100644 --- a/java/org/apache/coyote/http2/Stream.java +++ b/java/org/apache/coyote/http2/Stream.java @@ -297,19 +297,14 @@ public class Stream extends AbstractStream implements HeaderEmitter { void doStreamCancel(String msg, Http2Error error) throws CloseNowException { - // Avoid NPEs on duplicate cancellations - StreamOutputBuffer streamOutputBuffer = this.streamOutputBuffer; - Response coyoteResponse = this.coyoteResponse; StreamException se = new StreamException(msg, error, getIdAsInt()); - if (streamOutputBuffer != null && coyoteResponse != null) { - // Prevent the application making further writes - streamOutputBuffer.closed = true; - // Prevent Tomcat's error handling trying to write - coyoteResponse.setError(); - coyoteResponse.setErrorReported(); - // Trigger a reset once control returns to Tomcat - streamOutputBuffer.reset = se; - } + // Prevent the application making further writes + streamOutputBuffer.closed = true; + // Prevent Tomcat's error handling trying to write + coyoteResponse.setError(); + coyoteResponse.setErrorReported(); + // Trigger a reset once control returns to Tomcat + streamOutputBuffer.reset = se; throw new CloseNowException(msg, se); } @@ -477,13 +472,7 @@ public class Stream extends AbstractStream implements HeaderEmitter { name), Http2Error.PROTOCOL_ERROR, getIdAsInt()); } - // Avoid NPE if Stream has been closed on Stream specific thread - Request coyoteRequest = this.coyoteRequest; - if (coyoteRequest != null) { - // HTTP/2 headers are already always lower case - // In 8.5.x trailer headers are added to headers collection. - coyoteRequest.getMimeHeaders().addValue(name).setString(value); - } + coyoteRequest.getMimeHeaders().addValue(name).setString(value); } } } @@ -624,14 +613,9 @@ public class Stream extends AbstractStream implements HeaderEmitter { final boolean isContentLengthInconsistent() { - Request coyoteRequest = this.coyoteRequest; - // May be null when processing trailer headers after stream has been - // closed. - if (coyoteRequest != null) { - long contentLengthHeader = coyoteRequest.getContentLengthLong(); - if (contentLengthHeader > -1 && contentLengthReceived != contentLengthHeader) { - return true; - } + long contentLengthHeader = coyoteRequest.getContentLengthLong(); + if (contentLengthHeader > -1 && contentLengthReceived != contentLengthHeader) { + return true; } return false; } @@ -737,12 +721,15 @@ public class Stream extends AbstractStream implements HeaderEmitter { if (log.isDebugEnabled()) { log.debug(sm.getString("stream.recycle", getConnectionId(), getIdentifier())); } + /* + * Temporarily disabled due to multiple regressions (NPEs) coyoteRequest = null; cookieHeader = null; coyoteResponse = null; inputBuffer = null; streamOutputBuffer = null; http2OutputBuffer = null; + */ } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index a7a7430..2337deb 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -157,6 +157,11 @@ streams to account for DATA frames containing zero-length padding. (markt) </fix> + <fix> + <bug>64710</bug>: Revert the changes to reduce the memory footprint of + closed HTTP/2 streams as they triggered multiple regressions in the form + of <code>NullPointerException</code>s. (markt) + </fix> </changelog> </subsection> <subsection name="WebSocket"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org