You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2016/03/17 12:09:52 UTC

[Bug 59189] New: PerMessageDeflate leaves native memory allocated unnecessarily

https://bz.apache.org/bugzilla/show_bug.cgi?id=59189

            Bug ID: 59189
           Summary: PerMessageDeflate leaves native memory allocated
                    unnecessarily
           Product: Tomcat 7
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: WebSocket
          Assignee: dev@tomcat.apache.org
          Reporter: henrik.olsson@mobenga.com

During websocket load tests we noticed that the resident memory usage of the
tomcat process would grow and stay in use even after the sockets were closed
when websocket compression was enabled. The java heap looked fine. It seems to
be caused by PerMessageDeflate creating a Deflater and Inflater which in turn
allocates native memory that isn't freed until the JVM decides to run their
finalizers, which can take a long time before it happens.

I propose calling .end() (which is what finalize() does) on the Deflater and
Inflater when the websocket is closed. I have created a patch that does this
and resident memory usage shrinks after the websockets are closed down with it.
Would you be interested in this?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 59189] PerMessageDeflate leaves native memory allocated unnecessarily

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59189

--- Comment #2 from Henrik Olsson <he...@mobenga.com> ---
Created attachment 33682
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33682&action=edit
Makes PerMessageDeflate call end on Inflater/Deflater by adding a close()
method to the Transformation interface

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 59189] PerMessageDeflate leaves native memory allocated unnecessarily

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59189

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Sure. Attach the patch to this issue and someone will take a look.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 59189] PerMessageDeflate leaves native memory allocated unnecessarily

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59189

--- Comment #5 from Henrik Olsson <he...@mobenga.com> ---
(In reply to Mark Thomas from comment #4)
> Thanks for the report and the proposed fix.
> 
> I ended up applying a variation on your patch since I found a simpler path
> to call close().
> 
> The fix has been applied to:
> - 9.0.x for 9.0.0.M5 onwards
> - 8.5.x for 8.5.1 onwards
> - 8.0.x for 8.0.33 onwards
> - 7.0.x for 7.0.69 onwards

Thanks for the quick response!

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 59189] PerMessageDeflate leaves native memory allocated unnecessarily

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59189

Henrik Olsson <he...@mobenga.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unspecified                 |7.0.68

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 59189] PerMessageDeflate leaves native memory allocated unnecessarily

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59189

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
Thanks for the report and the proposed fix.

I ended up applying a variation on your patch since I found a simpler path to
call close().

The fix has been applied to:
- 9.0.x for 9.0.0.M5 onwards
- 8.5.x for 8.5.1 onwards
- 8.0.x for 8.0.33 onwards
- 7.0.x for 7.0.69 onwards

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 59189] PerMessageDeflate leaves native memory allocated unnecessarily

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59189

--- Comment #3 from Henrik Olsson <he...@mobenga.com> ---
(In reply to Mark Thomas from comment #1)
> Sure. Attach the patch to this issue and someone will take a look.

Attachment added. Not sure if it's the best way to do it but at least it's
something :)

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org