You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Greg Dhuse (JIRA)" <ji...@apache.org> on 2008/05/31 18:51:46 UTC

[jira] Created: (DIRMINA-598) ByteBuffer passed to ProtocolEncoderOutput.write(ByteBuffer) does not get released back to the pool

ByteBuffer passed to ProtocolEncoderOutput.write(ByteBuffer) does not get released back to the pool
---------------------------------------------------------------------------------------------------

                 Key: DIRMINA-598
                 URL: https://issues.apache.org/jira/browse/DIRMINA-598
             Project: MINA
          Issue Type: Bug
          Components: Filter
    Affects Versions: 1.1.7
            Reporter: Greg Dhuse


When pooled ByteBuffers are used in conjunction with a ProtocolCodecFilter, buffers passed to ProtocolEncoderOutput.write() do not get released back to the pool in all circumstances, causing unnecessary memory allocation.  

The following patch appears to resolve this issue in a simple filter chain, but it should be verified that there is no case where this change would cause a buffer to be released too early.

Best regards,
 Greg


Index: core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
===================================================================
--- core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java	(revision 657929)
+++ core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java	(working copy)
@@ -186,6 +186,10 @@
     public void messageSent(NextFilter nextFilter, IoSession session,
             Object message) throws Exception {
         if (message instanceof HiddenByteBuffer) {
+			// Release buffer originally passed to ProtocolEncoderOutput.write(ByteBuffer)
+			// See http://mina.apache.org/report/1.1/apidocs/org/apache/mina/common/ByteBuffer.html
+			((HiddenByteBuffer) message).release();
+        	
             return;
         }
 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRMINA-598) ByteBuffer passed to ProtocolEncoderOutput.write(ByteBuffer) does not get released back to the pool

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-598?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny updated DIRMINA-598:
--------------------------------------

    Fix Version/s: 1.1.8
                   2.0.0-M4

We have to check the proposal, see if it applies to 2.0 too.

> ByteBuffer passed to ProtocolEncoderOutput.write(ByteBuffer) does not get released back to the pool
> ---------------------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-598
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-598
>             Project: MINA
>          Issue Type: Bug
>          Components: Filter
>    Affects Versions: 1.1.7
>            Reporter: Greg Dhuse
>             Fix For: 2.0.0-M4, 1.1.8
>
>
> When pooled ByteBuffers are used in conjunction with a ProtocolCodecFilter, buffers passed to ProtocolEncoderOutput.write() do not get released back to the pool in all circumstances, causing unnecessary memory allocation.  
> The following patch appears to resolve this issue in a simple filter chain, but it should be verified that there is no case where this change would cause a buffer to be released too early.
> Best regards,
>  Greg
> Index: core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
> ===================================================================
> --- core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java	(revision 657929)
> +++ core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java	(working copy)
> @@ -186,6 +186,10 @@
>      public void messageSent(NextFilter nextFilter, IoSession session,
>              Object message) throws Exception {
>          if (message instanceof HiddenByteBuffer) {
> +			// Release buffer originally passed to ProtocolEncoderOutput.write(ByteBuffer)
> +			// See http://mina.apache.org/report/1.1/apidocs/org/apache/mina/common/ByteBuffer.html
> +			((HiddenByteBuffer) message).release();
> +        	
>              return;
>          }
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRMINA-598) ByteBuffer passed to ProtocolEncoderOutput.write(ByteBuffer) does not get released back to the pool

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-598?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny updated DIRMINA-598:
--------------------------------------

    Fix Version/s:     (was: 2.0.0-M4)

Does not affect 2.0.0

> ByteBuffer passed to ProtocolEncoderOutput.write(ByteBuffer) does not get released back to the pool
> ---------------------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-598
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-598
>             Project: MINA
>          Issue Type: Bug
>          Components: Filter
>    Affects Versions: 1.1.7
>            Reporter: Greg Dhuse
>             Fix For: 1.1.8
>
>
> When pooled ByteBuffers are used in conjunction with a ProtocolCodecFilter, buffers passed to ProtocolEncoderOutput.write() do not get released back to the pool in all circumstances, causing unnecessary memory allocation.  
> The following patch appears to resolve this issue in a simple filter chain, but it should be verified that there is no case where this change would cause a buffer to be released too early.
> Best regards,
>  Greg
> Index: core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
> ===================================================================
> --- core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java	(revision 657929)
> +++ core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java	(working copy)
> @@ -186,6 +186,10 @@
>      public void messageSent(NextFilter nextFilter, IoSession session,
>              Object message) throws Exception {
>          if (message instanceof HiddenByteBuffer) {
> +			// Release buffer originally passed to ProtocolEncoderOutput.write(ByteBuffer)
> +			// See http://mina.apache.org/report/1.1/apidocs/org/apache/mina/common/ByteBuffer.html
> +			((HiddenByteBuffer) message).release();
> +        	
>              return;
>          }
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-598) ByteBuffer passed to ProtocolEncoderOutput.write(ByteBuffer) does not get released back to the pool

Posted by "Julien Vermillard (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-598?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12650510#action_12650510 ] 

Julien Vermillard commented on DIRMINA-598:
-------------------------------------------

no ByteBuffer pools in 2.0 no ? So it can't apply.

> ByteBuffer passed to ProtocolEncoderOutput.write(ByteBuffer) does not get released back to the pool
> ---------------------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-598
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-598
>             Project: MINA
>          Issue Type: Bug
>          Components: Filter
>    Affects Versions: 1.1.7
>            Reporter: Greg Dhuse
>             Fix For: 2.0.0-M4, 1.1.8
>
>
> When pooled ByteBuffers are used in conjunction with a ProtocolCodecFilter, buffers passed to ProtocolEncoderOutput.write() do not get released back to the pool in all circumstances, causing unnecessary memory allocation.  
> The following patch appears to resolve this issue in a simple filter chain, but it should be verified that there is no case where this change would cause a buffer to be released too early.
> Best regards,
>  Greg
> Index: core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
> ===================================================================
> --- core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java	(revision 657929)
> +++ core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java	(working copy)
> @@ -186,6 +186,10 @@
>      public void messageSent(NextFilter nextFilter, IoSession session,
>              Object message) throws Exception {
>          if (message instanceof HiddenByteBuffer) {
> +			// Release buffer originally passed to ProtocolEncoderOutput.write(ByteBuffer)
> +			// See http://mina.apache.org/report/1.1/apidocs/org/apache/mina/common/ByteBuffer.html
> +			((HiddenByteBuffer) message).release();
> +        	
>              return;
>          }
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.