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

--- Comment #2 from SergeP <se...@american-data.com> ---
Mark

Looks like it did not save my environment - Windows Server 2012

Also these bugs might be related to this one:

*    [57546](https://bz.apache.org/bugzilla/show_bug.cgi?id=57546)
*    [57750](https://bz.apache.org/bugzilla/show_bug.cgi?id=57750)

The 57546 bug looks very similar to what we are experiencing. We tested on
Linux and so far we do not see the same behavior. Also this is our web socket
code:

package ad.ecs.async.websocket;

import java.io.IOException;
import java.util.Arrays;

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;

import ad.common.Global;
import ad.ecs.async.AsyncEngine;
import ad.ecs.async.AsyncResponse;
import ad.ecs.async.AsyncType;
import ad.ecs.db.DatabaseEngine;
import ad.ecs.db.paradox.User;
import ad.ecs.security.engine.SecurityEngine;

/**
 * @author Serge Perepel
 * @since Aug 23, 2017 12:23:32 PM
 */
@ServerEndpoint(value = "/asyncMsg", encoders = AsyncResponseEncoder.class)
public class ECSAsync {

    @OnOpen
    public void open(Session session) throws IOException{
        session.getBasicRemote().sendText("Connection Established");
    }

    @OnMessage
    public String login(String sessionID, Session session) {
        AsyncEngine.INSTANCE.wsConnect(session, sessionID);
        org.hibernate.Session dbSession =
DatabaseEngine.getSessionFactory().openSession();
        try {
                int userID =
SecurityEngine.INSTANCE.getUserIDBasedOnSessionID(sessionID);
                User user = (User) dbSession.get(User.class, userID);
                if (user != null) {
                        if (user.getNextLogin() == 1) {
                                AsyncResponse response = new AsyncResponse();
                                response.setType(AsyncType.None);
                                response.setData(Arrays.asList("PASSWORD"));
                                response.setObjData("PASSWORD");
                               
AsyncEngine.INSTANCE.addTransientResult(sessionID, response);
                        }
                }
        } finally {
                dbSession.close();
        }
        return "ok"; 
    }

    @OnClose 
    public void close(Session session, CloseReason reason) {
        AsyncEngine.INSTANCE.wsDisconnect(session);
    }

    @OnError
    public void error(Session session, Throwable error) {
        Global.INSTANCE.getLogHelper().exception(error);
        //session.close(new CloseReason(closeCode, reasonPhrase));
    }
}

Front end opens connection and sends invalid sessionID which causes
the line `AsyncEngine.INSTANCE.wsConnect(session, sessionID);` to throw
exception and after that disconnect happens on the front end. At this point
front end opens new connection and process goes into the loop. I'm assuming
that the connection handler suppose to get freed after a disconnect happen. But
it seems to accumulate. You can try this code and just replace code in the
login method to always throw the exception. On the front end onDisconnect try
to open new connection and send a random message to the web socket. Hopefully
this will reproduce the issue for you.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to