Any takers to tackle this issue?

-----Original Message-----
From: Serge Perepel [] 
Sent: Friday, January 26, 2018 2:33 PM
To: Tomcat Users List
Subject: RE: Suspected memory leak of 
org.apache.coyote.AbstractProtocol$ConnectionHandler object while using 

-----Original Message-----
From: Mark Thomas []

>This is likely to get looked at faster if you provide code that other people 
>can run that will reproduce the issue you are seeing rather than expecting 
>someone else to construct the test case for you.

Here is how you can reproduce it:

Server websocket:

package ad.ecs.websocket;


import javax.websocket.CloseReason;
import javax.websocket.OnClose;
import javax.websocket.OnError;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;

@ServerEndpoint(value = "/asyncMsg")
public class TestWebsocket {
    public void open(Session session) throws IOException{
        session.getBasicRemote().sendText("Connection Established");

    public String login(String sessionID, Session session) {
//        you can do this instead of exception and it will still leak memory
//        try {
//            session.close(new CloseReason(CloseCodes.GOING_AWAY, "Clearing 
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
        throw new IllegalArgumentException("Testing Leak");

    public void close(Session session, CloseReason reason) {

    public void error(Session session, Throwable error) {


Here is the front end html:

<!DOCTYPE html>
    <script type="text/javascript" src="app.js"></script> </head> <body>
        <button onclick="test()">

Here is js file:

    var webSocket = null;

    function test() {
        console.log("test button clicked");

    function openSocket() {
        console.log("open webSocket");
        webSocket = new WebSocket("ws://" + + 

        webSocket.onopen = function(event){
            console.log("webSocket open");

        webSocket.onmessage = function(event){
            console.log("webSocket onMessage", event);

        webSocket.onclose = function(event){
            webSocket = null;
            console.log("webSocket connection closed", event);

    function closeSocket(){
        console.log("close webSocket");
        if (webSocket)

You need to run it on multiple clients if you want it leak fast. We did it with 
8 clients and it leaked 3GB with in like 10 min.

Thank you

Serge Perepel
Software Developer | American Data
p. 608.643.8022 | tf. 800.464.9942 | f. 608.643.2314<> |

[Follow us on 
[Follow us on LinkedIn] <>    
[Follow us on Twitter] <>   [Follow us on 
Twitter] <>

Notice: This message is the property of 1984 Systems, Inc. (DBA) American Data 
and contains information that may be confidential and/or privileged. If you are 
not the intended recipient, you should not use, disclose or take any action 
based on the message. If you have received this transmission in error, please 
immediately contact the sender by return e-mail and delete this e-mail, and any 
attachments, from any computer.

[ECS 10 Conversion]<>

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to