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/05/05 06:00:50 UTC

[Bug 59431] New: Websocket memory leak org.apache.tomcat.websocket.server.WsFrameServer

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

            Bug ID: 59431
           Summary: Websocket memory leak
                    org.apache.tomcat.websocket.server.WsFrameServer
           Product: Tomcat 7
           Version: 7.0.69
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: WebSocket
          Assignee: dev@tomcat.apache.org
          Reporter: hugo.larson@yahoo.com

Created attachment 33826
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33826&action=edit
image

Hello,

I have been struggling with memory problem for a while. For some reason the
memory (1,3 GB) get full after some days of usage. 

Im using websocket to send and receive queries to client connected with Tyrus
with the following function.
The WsPayload is stored in the session userproperties and later ofcourse
removed.

I have a dump file of the heap and I see with Mat abnormal amount
org.apache.tomcat.websocket.server.WsFrameServer objects each occupying 5MB.
There is no relations between amount of objects and sessions. The sessions are
about 30-70.

The dump file is 30 MB so its not possible to attache it but will attach a
screenshot of MAT 

@OnMessage
public void onMessage(Session session, final ByteBuffer message) {
        try (ByteArrayInputStream ins = new  
ByteArrayInputStream(message.array());
            ObjectInputStream in = new ObjectInputStream(new
GZIPInputStream(ins))){
            WsPayLoad sPayLoad = (WsPayLoad) in.readObject();

            WsHelper.putRespWsPayloadsSess(session, sPayLoad, message);
        } catch (IOException | ClassNotFoundException e) {
            e.printStackTrace();
        }
    }

BR,
Hugo Larson

-- 
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 59431] Websocket memory leak org.apache.tomcat.websocket.server.WsFrameServer

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

--- Comment #2 from hugo.larson@yahoo.com ---
Hi,

How can you tell that they are eligible for GC?

Additionally when I made the dump i had 30 sessions but even the active
sessions could not allocate 5MB each

This it what MAT say in the problem suspect tab:
103 instances of "org.apache.tomcat.websocket.server.WsFrameServer", loaded by
"org.apache.catalina.loader.StandardClassLoader @ 0xcd11dbe0" occupy 543 285
448 (92,59%) bytes. 

Keywords
org.apache.tomcat.websocket.server.WsFrameServer
org.apache.catalina.loader.StandardClassLoader @ 0xcd11dbe0

I dont think MAT would classify the object as suspects if they are eligible for
GC.

I really wish that I could reproduce the leak.

Thanks,
Hugo

-- 
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 59431] Websocket memory leak org.apache.tomcat.websocket.server.WsFrameServer

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

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

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

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
The attached image shows that the WsFrameServer object has no GC root and is
therefore eligible for GC.

A quick test with the latest 7.0.x code with YourKit shows WsFrameServer
objects in memory but all of them are eligible for GC.

For this type of bug report to be valid, you need to provide a reproducible
test case that results in one or more WsFrameServer objects in memory and not
eligible for GC with no active WebSocket conenctions.

The users list is the best place to debug the memory issues you are
experiencing.

-- 
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