-----Original Message-----
From: Mark Thomas [mailto:ma...@apache.org]

>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 java.io.IOException;

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>
        <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://" + window.location.host + 

        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
se...@american-data.com<mailto:se...@american-data.com> | www.american-data.com

[Follow us on 
[Follow us on LinkedIn] <https://www.linkedin.com/company/american-data>    
[Follow us on Twitter] <https://twitter.com/AmericanDataECS>   [Follow us on 
Twitter] <https://www.youtube.com/channel/UCiKfcsunZXWIYHf_2oE708A>

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 
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]<http://www.american-data.com/viewer>

To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to