ASF Bugzilla – Attachment 33682 Details for
Bug 59189
PerMessageDeflate leaves native memory allocated unnecessarily
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Makes PerMessageDeflate call end on Inflater/Deflater by adding a close() method to the Transformation interface
transformation-close.patch (text/plain), 6.08 KB, created by
Henrik Olsson
on 2016-03-17 12:08:34 UTC
(
hide
)
Description:
Makes PerMessageDeflate call end on Inflater/Deflater by adding a close() method to the Transformation interface
Filename:
MIME Type:
Creator:
Henrik Olsson
Created:
2016-03-17 12:08:34 UTC
Size:
6.08 KB
patch
obsolete
>Only in apache-tomcat-7.0.68-src/java/org/apache/catalina/startup: catalina.properties >diff -u -uwr apache-tomcat-7.0.68-src-orig/java/org/apache/tomcat/websocket/PerMessageDeflate.java apache-tomcat-7.0.68-src/java/org/apache/tomcat/websocket/PerMessageDeflate.java >--- apache-tomcat-7.0.68-src-orig/java/org/apache/tomcat/websocket/PerMessageDeflate.java 2016-02-08 21:32:02.000000000 +0100 >+++ apache-tomcat-7.0.68-src/java/org/apache/tomcat/websocket/PerMessageDeflate.java 2016-03-17 12:57:34.290063688 +0100 >@@ -439,6 +439,15 @@ > } > } > >+ @Override >+ public void close() { >+ if (next != null) { >+ next.close(); >+ } >+ deflater.end(); >+ inflater.end(); >+ } >+ > > private void startNewMessage() { > firstCompressedFrameWritten = false; >diff -u -uwr apache-tomcat-7.0.68-src-orig/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java apache-tomcat-7.0.68-src/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java >--- apache-tomcat-7.0.68-src-orig/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java 2016-02-08 21:32:03.000000000 +0100 >+++ apache-tomcat-7.0.68-src/java/org/apache/tomcat/websocket/server/WsHttpUpgradeHandler.java 2016-03-17 12:57:04.559941743 +0100 >@@ -129,7 +129,7 @@ > handshakeRequest.getQueryString(), > handshakeRequest.getUserPrincipal(), httpSessionId, > negotiatedExtensions, subProtocol, pathParameters, secure, >- endpointConfig); >+ endpointConfig, transformation); > WsFrameServer wsFrame = new WsFrameServer(sis, wsSession, transformation); > sos.setWriteListener(new WsWriteListener(this, wsRemoteEndpointServer)); > // WsFrame adds the necessary final transformations. Copy the >diff -u -uwr apache-tomcat-7.0.68-src-orig/java/org/apache/tomcat/websocket/Transformation.java apache-tomcat-7.0.68-src/java/org/apache/tomcat/websocket/Transformation.java >--- apache-tomcat-7.0.68-src-orig/java/org/apache/tomcat/websocket/Transformation.java 2016-02-08 21:32:02.000000000 +0100 >+++ apache-tomcat-7.0.68-src/java/org/apache/tomcat/websocket/Transformation.java 2016-03-17 12:56:34.173150207 +0100 >@@ -94,4 +94,9 @@ > * may be bigger or smaller than the size of the input list > */ > List<MessagePart> sendMessagePart(List<MessagePart> messageParts); >+ >+ /** >+ * Close this transformation. Performs any cleanup needed. >+ */ >+ void close(); > } >diff -u -uwr apache-tomcat-7.0.68-src-orig/java/org/apache/tomcat/websocket/WsFrameBase.java apache-tomcat-7.0.68-src/java/org/apache/tomcat/websocket/WsFrameBase.java >--- apache-tomcat-7.0.68-src-orig/java/org/apache/tomcat/websocket/WsFrameBase.java 2016-02-08 21:32:02.000000000 +0100 >+++ apache-tomcat-7.0.68-src/java/org/apache/tomcat/websocket/WsFrameBase.java 2016-03-17 12:55:20.969515015 +0100 >@@ -777,6 +777,12 @@ > // NO-OP send so simply return the message unchanged. > return messageParts; > } >+ >+ >+ @Override >+ public void close() { >+ // NO-OP, nothing needed >+ } > } > > >@@ -818,5 +824,11 @@ > // NO-OP send so simply return the message unchanged. > return messageParts; > } >+ >+ >+ @Override >+ public void close() { >+ // NO-OP, nothing needed >+ } > } > } >diff -u -uwr apache-tomcat-7.0.68-src-orig/java/org/apache/tomcat/websocket/WsSession.java apache-tomcat-7.0.68-src/java/org/apache/tomcat/websocket/WsSession.java >--- apache-tomcat-7.0.68-src-orig/java/org/apache/tomcat/websocket/WsSession.java 2016-02-08 21:32:03.000000000 +0100 >+++ apache-tomcat-7.0.68-src/java/org/apache/tomcat/websocket/WsSession.java 2016-03-17 12:55:05.492784325 +0100 >@@ -84,6 +84,7 @@ > private final boolean secure; > private final String httpSessionId; > private final String id; >+ private final Transformation transformation; > > // Expected to handle message types of <String> only > private MessageHandler textMessageHandler = null; >@@ -119,7 +120,7 @@ > URI requestUri, Map<String,List<String>> requestParameterMap, > String queryString, Principal userPrincipal, String httpSessionId, > List<Extension> negotiatedExtensions, String subProtocol, Map<String,String> pathParameters, >- boolean secure, EndpointConfig endpointConfig) throws DeploymentException { >+ boolean secure, EndpointConfig endpointConfig, Transformation transformation) throws DeploymentException { > this.localEndpoint = localEndpoint; > this.wsRemoteEndpoint = wsRemoteEndpoint; > this.wsRemoteEndpoint.setSession(this); >@@ -157,6 +158,7 @@ > > this.userProperties.putAll(endpointConfig.getUserProperties()); > this.id = Long.toHexString(ids.getAndIncrement()); >+ this.transformation = transformation; > > InstanceManager instanceManager = webSocketContainer.getInstanceManager(); > if (instanceManager != null) { >@@ -498,6 +500,9 @@ > > // Close the socket > wsRemoteEndpoint.close(); >+ >+ // Close the transformation >+ transformation.close(); > } > } > } >diff -u -uwr apache-tomcat-7.0.68-src-orig/java/org/apache/tomcat/websocket/WsWebSocketContainer.java apache-tomcat-7.0.68-src/java/org/apache/tomcat/websocket/WsWebSocketContainer.java >--- apache-tomcat-7.0.68-src-orig/java/org/apache/tomcat/websocket/WsWebSocketContainer.java 2016-02-08 21:32:03.000000000 +0100 >+++ apache-tomcat-7.0.68-src/java/org/apache/tomcat/websocket/WsWebSocketContainer.java 2016-03-16 16:06:23.769379015 +0100 >@@ -457,7 +457,7 @@ > WsSession wsSession = new WsSession(endpoint, wsRemoteEndpointClient, > this, null, null, null, null, null, extensionsAgreed, > subProtocol, Collections.<String,String>emptyMap(), secure, >- clientEndpointConfiguration); >+ clientEndpointConfiguration, transformation); > > WsFrameClient wsFrameClient = new WsFrameClient(response, channel, > wsSession, transformation);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 59189
: 33682