You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@guacamole.apache.org by "Frco. Javier Rial" <fj...@gmail.com> on 2022/06/08 13:01:23 UTC

Websockets problem when simulatenous connections

Hi all

I'm having this same exact problem as describe this
https://stackoverflow.com/questions/54374533/guacamole-multiple-simultaneous-vnc-connections-over-websocket-close-each-other

I've built my own guacamole application, just like this (I'm omitting the
keycloak integration for authentication that I have and some minor details)
My app has an angular frontend, a backend in Java and a docker server.

Basically, when an user connects to the httptunnel/websocket, the backend
in java connects to the docker server (using docker api) to setup and run
an specific docker image for this user. This image contains the guacd
daemon running inside

Just to clarify, if I use HTTPTunnel, it works fine. I have my own
implementation for the httptunnel in the java backend and works without any
issues handling several connected users, but, with the poor performance
provided by the httptunnel

While using the websocket implementation in java, I have the mentioned
problem in stackoverflow

My implementation is as follows (minimal code provided here)
@ServerEndpoint(value = "/webSocket", configurator =
CustomSpringConfigurator.class)
@Component
public class WebSocketTunnel extends GuacamoleWebSocketTunnelEndpoint {

    @Autowired
    private DefaultConfiguration defaultConfiguration;

    @Autowired
    private ContainerService containerService;

    @Autowired
    private UserUtil userUtil;

    @Override
    protected GuacamoleTunnel createTunnel(Session session, EndpointConfig
endpointConfig) throws GuacamoleException {

        try {
            GuacamoleSocket socket = null;
   containerService.getContainer(principalTO.get().getIdUser());
            socket = new ConfiguredGuacamoleSocket(
                new InetGuacamoleSocket(containerTO.get().getHost(),

Integer.parseInt(containerTO.get().getPort())),configuration);
                    }
                }
            GuacamoleTunnel tunnel = new SimpleGuacamoleTunnel(socket);
            return tunnel;
        } catch (Exception e) {
            log.error(e);
        }
        return null;
    }

    .....
}


The angular frontend just connects to the java backend endpoint that
creates the websocket and gets the tunnel provided.

The socket is configured against the IP/port of the running docker image on
the docker server
It returns the websocket and everything works fine with one connected user.
Each running docker image has it's own ip and different ports binded
externally for the guacd daemon (internally all guacd listen on the same
port 4822)

But as soon as any other user tries to connect, the websocket is closed

This is logged in the java backend

Exception in thread "Thread-2" java.lang.IllegalStateException: The
WebSocket session [1] has been closed and no method (apart from close())
may be called on a closed session
at org.apache.tomcat.websocket.WsSession.checkState(WsSession.java:1082)
at
org.apache.tomcat.websocket.WsSession.getUserProperties(WsSession.java:990)
at
org.apache.tomcat.websocket.WsRemoteEndpointImplBase.getBlockingSendTimeout(WsRemoteEndpointImplBase.java:533)
at
org.apache.tomcat.websocket.WsRemoteEndpointImplBase.getTimeoutExpiry(WsRemoteEndpointImplBase.java:270)
at
org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendMessageBlock(WsRemoteEndpointImplBase.java:244)
at
org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendString(WsRemoteEndpointImplBase.java:195)
at
org.apache.tomcat.websocket.WsRemoteEndpointBasic.sendText(WsRemoteEndpointBasic.java:37)
at
org.apache.guacamole.websocket.GuacamoleWebSocketTunnelEndpoint.sendInstruction(GuacamoleWebSocketTunnelEndpoint.java:152)
at
org.apache.guacamole.websocket.GuacamoleWebSocketTunnelEndpoint.access$200(GuacamoleWebSocketTunnelEndpoint.java:53)
at
org.apache.guacamole.websocket.GuacamoleWebSocketTunnelEndpoint$2.run(GuacamoleWebSocketTunnelEndpoint.java:253)


Can someone give me any hint about the websocket implementation ??
Please, feel free to ask me for anything

Re: Websockets problem when simulatenous connections

Posted by "Frco. Javier Rial" <fj...@gmail.com>.
It was indeed,

By adding this spring notation @Scope("prototype") to the class, now, it
can handle several websockets connections

That's because of the scopes of the bean

Scope
Description
singleton (default)
Single bean object instance per spring IoC container
prototype
Opposite to singleton, it produces a new instance each and every time a
bean is requested.
I was using the defalt one (without being aware of this)

Now, as the scope is prototyped, I need to handle the cleaning of the bean
upon closing socket to avoid memory leaks in the java backend.

O xov., 9 de xuño de 2022 ás 07:18, Frco. Javier Rial (<fj...@gmail.com>)
escribiu:

> I think that my problem is that the websocket controller in Java (Spring)
> is only instantiated once, and so as the tunnel variable is a private one
> in the GuacamoleWebSocketTunnelEndpoint class, it can not handle several
> websocket connections
>
> Could this be the problem?
>
>
>
> O mér., 8 de xuño de 2022 ás 16:20, Frco. Javier Rial (<fj...@gmail.com>)
> escribiu:
>
>> Hi Lukas
>>
>> I'm doing that, or at least I think I'm doing it
>>
>> Each connection to the websocket endpoint, creates a running docker
>> container (with its own guacd, rdp,...) , and then creates the websocket to
>> this running docker container, and returns it to the webapp in Angular
>>
>> When, there is one connection established (viewing the rdp, and so on),
>> if another new connection cames in, a new docker instance is created for
>> this connection, but before that, the websocket error appears closing the
>> communication in this new connection and also in the previous existing one
>>
>> O mér., 8 de xuño de 2022 ás 15:54, Lukáš Raška (<lu...@raska.me>)
>> escribiu:
>>
>>> Hi,
>>> every new comnection creates new guacd connection, which means new VNC
>>> connection. You need to create some kind of lookup map so when new user
>>> tries to connect, either new connection is established or existing one is
>>> used.
>>>
>>> The trickier part are race conditions,so synchronizing access to the
>>> lookup table is the key, especially when removing the connection and
>>> handling disconnects.
>>>
>>>
>>> Hope it helps a bit.
>>>
>>>
>>> Best Regards,
>>> Lukas
>>>
>>> Dne st 8. 6. 2022 15:04 uživatel Frco. Javier Rial <fj...@gmail.com>
>>> napsal:
>>>
>>>> Hi all
>>>>
>>>> I'm having this same exact problem as describe this
>>>> https://stackoverflow.com/questions/54374533/guacamole-multiple-simultaneous-vnc-connections-over-websocket-close-each-other
>>>>
>>>> I've built my own guacamole application, just like this (I'm omitting
>>>> the keycloak integration for authentication that I have and some minor
>>>> details)
>>>> My app has an angular frontend, a backend in Java and a docker server.
>>>>
>>>> Basically, when an user connects to the httptunnel/websocket, the
>>>> backend in java connects to the docker server (using docker api) to
>>>> setup and run an specific docker image for this user. This image contains
>>>> the guacd daemon running inside
>>>>
>>>> Just to clarify, if I use HTTPTunnel, it works fine. I have my own
>>>> implementation for the httptunnel in the java backend and works without any
>>>> issues handling several connected users, but, with the poor performance
>>>> provided by the httptunnel
>>>>
>>>> While using the websocket implementation in java, I have the mentioned
>>>> problem in stackoverflow
>>>>
>>>> My implementation is as follows (minimal code provided here)
>>>> @ServerEndpoint(value = "/webSocket", configurator =
>>>> CustomSpringConfigurator.class)
>>>> @Component
>>>> public class WebSocketTunnel extends GuacamoleWebSocketTunnelEndpoint {
>>>>
>>>>     @Autowired
>>>>     private DefaultConfiguration defaultConfiguration;
>>>>
>>>>     @Autowired
>>>>     private ContainerService containerService;
>>>>
>>>>     @Autowired
>>>>     private UserUtil userUtil;
>>>>
>>>>     @Override
>>>>     protected GuacamoleTunnel createTunnel(Session session,
>>>> EndpointConfig endpointConfig) throws GuacamoleException {
>>>>
>>>>         try {
>>>>             GuacamoleSocket socket = null;
>>>>    containerService.getContainer(principalTO.get().getIdUser());
>>>>             socket = new ConfiguredGuacamoleSocket(
>>>>                 new InetGuacamoleSocket(containerTO.get().getHost(),
>>>>
>>>> Integer.parseInt(containerTO.get().getPort())),configuration);
>>>>                     }
>>>>                 }
>>>>             GuacamoleTunnel tunnel = new SimpleGuacamoleTunnel(socket);
>>>>             return tunnel;
>>>>         } catch (Exception e) {
>>>>             log.error(e);
>>>>         }
>>>>         return null;
>>>>     }
>>>>
>>>>     .....
>>>> }
>>>>
>>>>
>>>> The angular frontend just connects to the java backend endpoint that
>>>> creates the websocket and gets the tunnel provided.
>>>>
>>>> The socket is configured against the IP/port of the running docker
>>>> image on the docker server
>>>> It returns the websocket and everything works fine with one connected
>>>> user. Each running docker image has it's own ip and different ports binded
>>>> externally for the guacd daemon (internally all guacd listen on the same
>>>> port 4822)
>>>>
>>>> But as soon as any other user tries to connect, the websocket is closed
>>>>
>>>> This is logged in the java backend
>>>>
>>>> Exception in thread "Thread-2" java.lang.IllegalStateException: The
>>>> WebSocket session [1] has been closed and no method (apart from close())
>>>> may be called on a closed session
>>>> at org.apache.tomcat.websocket.WsSession.checkState(WsSession.java:1082)
>>>> at
>>>> org.apache.tomcat.websocket.WsSession.getUserProperties(WsSession.java:990)
>>>> at
>>>> org.apache.tomcat.websocket.WsRemoteEndpointImplBase.getBlockingSendTimeout(WsRemoteEndpointImplBase.java:533)
>>>> at
>>>> org.apache.tomcat.websocket.WsRemoteEndpointImplBase.getTimeoutExpiry(WsRemoteEndpointImplBase.java:270)
>>>> at
>>>> org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendMessageBlock(WsRemoteEndpointImplBase.java:244)
>>>> at
>>>> org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendString(WsRemoteEndpointImplBase.java:195)
>>>> at
>>>> org.apache.tomcat.websocket.WsRemoteEndpointBasic.sendText(WsRemoteEndpointBasic.java:37)
>>>> at
>>>> org.apache.guacamole.websocket.GuacamoleWebSocketTunnelEndpoint.sendInstruction(GuacamoleWebSocketTunnelEndpoint.java:152)
>>>> at
>>>> org.apache.guacamole.websocket.GuacamoleWebSocketTunnelEndpoint.access$200(GuacamoleWebSocketTunnelEndpoint.java:53)
>>>> at
>>>> org.apache.guacamole.websocket.GuacamoleWebSocketTunnelEndpoint$2.run(GuacamoleWebSocketTunnelEndpoint.java:253)
>>>>
>>>>
>>>> Can someone give me any hint about the websocket implementation ??
>>>> Please, feel free to ask me for anything
>>>>
>>>>

Re: Websockets problem when simulatenous connections

Posted by "Frco. Javier Rial" <fj...@gmail.com>.
I think that my problem is that the websocket controller in Java (Spring)
is only instantiated once, and so as the tunnel variable is a private one
in the GuacamoleWebSocketTunnelEndpoint class, it can not handle several
websocket connections

Could this be the problem?



O mér., 8 de xuño de 2022 ás 16:20, Frco. Javier Rial (<fj...@gmail.com>)
escribiu:

> Hi Lukas
>
> I'm doing that, or at least I think I'm doing it
>
> Each connection to the websocket endpoint, creates a running docker
> container (with its own guacd, rdp,...) , and then creates the websocket to
> this running docker container, and returns it to the webapp in Angular
>
> When, there is one connection established (viewing the rdp, and so on), if
> another new connection cames in, a new docker instance is created for this
> connection, but before that, the websocket error appears closing the
> communication in this new connection and also in the previous existing one
>
> O mér., 8 de xuño de 2022 ás 15:54, Lukáš Raška (<lu...@raska.me>)
> escribiu:
>
>> Hi,
>> every new comnection creates new guacd connection, which means new VNC
>> connection. You need to create some kind of lookup map so when new user
>> tries to connect, either new connection is established or existing one is
>> used.
>>
>> The trickier part are race conditions,so synchronizing access to the
>> lookup table is the key, especially when removing the connection and
>> handling disconnects.
>>
>>
>> Hope it helps a bit.
>>
>>
>> Best Regards,
>> Lukas
>>
>> Dne st 8. 6. 2022 15:04 uživatel Frco. Javier Rial <fj...@gmail.com>
>> napsal:
>>
>>> Hi all
>>>
>>> I'm having this same exact problem as describe this
>>> https://stackoverflow.com/questions/54374533/guacamole-multiple-simultaneous-vnc-connections-over-websocket-close-each-other
>>>
>>> I've built my own guacamole application, just like this (I'm omitting
>>> the keycloak integration for authentication that I have and some minor
>>> details)
>>> My app has an angular frontend, a backend in Java and a docker server.
>>>
>>> Basically, when an user connects to the httptunnel/websocket, the
>>> backend in java connects to the docker server (using docker api) to
>>> setup and run an specific docker image for this user. This image contains
>>> the guacd daemon running inside
>>>
>>> Just to clarify, if I use HTTPTunnel, it works fine. I have my own
>>> implementation for the httptunnel in the java backend and works without any
>>> issues handling several connected users, but, with the poor performance
>>> provided by the httptunnel
>>>
>>> While using the websocket implementation in java, I have the mentioned
>>> problem in stackoverflow
>>>
>>> My implementation is as follows (minimal code provided here)
>>> @ServerEndpoint(value = "/webSocket", configurator =
>>> CustomSpringConfigurator.class)
>>> @Component
>>> public class WebSocketTunnel extends GuacamoleWebSocketTunnelEndpoint {
>>>
>>>     @Autowired
>>>     private DefaultConfiguration defaultConfiguration;
>>>
>>>     @Autowired
>>>     private ContainerService containerService;
>>>
>>>     @Autowired
>>>     private UserUtil userUtil;
>>>
>>>     @Override
>>>     protected GuacamoleTunnel createTunnel(Session session,
>>> EndpointConfig endpointConfig) throws GuacamoleException {
>>>
>>>         try {
>>>             GuacamoleSocket socket = null;
>>>    containerService.getContainer(principalTO.get().getIdUser());
>>>             socket = new ConfiguredGuacamoleSocket(
>>>                 new InetGuacamoleSocket(containerTO.get().getHost(),
>>>
>>> Integer.parseInt(containerTO.get().getPort())),configuration);
>>>                     }
>>>                 }
>>>             GuacamoleTunnel tunnel = new SimpleGuacamoleTunnel(socket);
>>>             return tunnel;
>>>         } catch (Exception e) {
>>>             log.error(e);
>>>         }
>>>         return null;
>>>     }
>>>
>>>     .....
>>> }
>>>
>>>
>>> The angular frontend just connects to the java backend endpoint that
>>> creates the websocket and gets the tunnel provided.
>>>
>>> The socket is configured against the IP/port of the running docker image
>>> on the docker server
>>> It returns the websocket and everything works fine with one connected
>>> user. Each running docker image has it's own ip and different ports binded
>>> externally for the guacd daemon (internally all guacd listen on the same
>>> port 4822)
>>>
>>> But as soon as any other user tries to connect, the websocket is closed
>>>
>>> This is logged in the java backend
>>>
>>> Exception in thread "Thread-2" java.lang.IllegalStateException: The
>>> WebSocket session [1] has been closed and no method (apart from close())
>>> may be called on a closed session
>>> at org.apache.tomcat.websocket.WsSession.checkState(WsSession.java:1082)
>>> at
>>> org.apache.tomcat.websocket.WsSession.getUserProperties(WsSession.java:990)
>>> at
>>> org.apache.tomcat.websocket.WsRemoteEndpointImplBase.getBlockingSendTimeout(WsRemoteEndpointImplBase.java:533)
>>> at
>>> org.apache.tomcat.websocket.WsRemoteEndpointImplBase.getTimeoutExpiry(WsRemoteEndpointImplBase.java:270)
>>> at
>>> org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendMessageBlock(WsRemoteEndpointImplBase.java:244)
>>> at
>>> org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendString(WsRemoteEndpointImplBase.java:195)
>>> at
>>> org.apache.tomcat.websocket.WsRemoteEndpointBasic.sendText(WsRemoteEndpointBasic.java:37)
>>> at
>>> org.apache.guacamole.websocket.GuacamoleWebSocketTunnelEndpoint.sendInstruction(GuacamoleWebSocketTunnelEndpoint.java:152)
>>> at
>>> org.apache.guacamole.websocket.GuacamoleWebSocketTunnelEndpoint.access$200(GuacamoleWebSocketTunnelEndpoint.java:53)
>>> at
>>> org.apache.guacamole.websocket.GuacamoleWebSocketTunnelEndpoint$2.run(GuacamoleWebSocketTunnelEndpoint.java:253)
>>>
>>>
>>> Can someone give me any hint about the websocket implementation ??
>>> Please, feel free to ask me for anything
>>>
>>>

Re: Websockets problem when simulatenous connections

Posted by "Frco. Javier Rial" <fj...@gmail.com>.
Hi Lukas

I'm doing that, or at least I think I'm doing it

Each connection to the websocket endpoint, creates a running docker
container (with its own guacd, rdp,...) , and then creates the websocket to
this running docker container, and returns it to the webapp in Angular

When, there is one connection established (viewing the rdp, and so on), if
another new connection cames in, a new docker instance is created for this
connection, but before that, the websocket error appears closing the
communication in this new connection and also in the previous existing one

O mér., 8 de xuño de 2022 ás 15:54, Lukáš Raška (<lu...@raska.me>) escribiu:

> Hi,
> every new comnection creates new guacd connection, which means new VNC
> connection. You need to create some kind of lookup map so when new user
> tries to connect, either new connection is established or existing one is
> used.
>
> The trickier part are race conditions,so synchronizing access to the
> lookup table is the key, especially when removing the connection and
> handling disconnects.
>
>
> Hope it helps a bit.
>
>
> Best Regards,
> Lukas
>
> Dne st 8. 6. 2022 15:04 uživatel Frco. Javier Rial <fj...@gmail.com>
> napsal:
>
>> Hi all
>>
>> I'm having this same exact problem as describe this
>> https://stackoverflow.com/questions/54374533/guacamole-multiple-simultaneous-vnc-connections-over-websocket-close-each-other
>>
>> I've built my own guacamole application, just like this (I'm omitting the
>> keycloak integration for authentication that I have and some minor details)
>> My app has an angular frontend, a backend in Java and a docker server.
>>
>> Basically, when an user connects to the httptunnel/websocket, the backend
>> in java connects to the docker server (using docker api) to setup and run
>> an specific docker image for this user. This image contains the guacd
>> daemon running inside
>>
>> Just to clarify, if I use HTTPTunnel, it works fine. I have my own
>> implementation for the httptunnel in the java backend and works without any
>> issues handling several connected users, but, with the poor performance
>> provided by the httptunnel
>>
>> While using the websocket implementation in java, I have the mentioned
>> problem in stackoverflow
>>
>> My implementation is as follows (minimal code provided here)
>> @ServerEndpoint(value = "/webSocket", configurator =
>> CustomSpringConfigurator.class)
>> @Component
>> public class WebSocketTunnel extends GuacamoleWebSocketTunnelEndpoint {
>>
>>     @Autowired
>>     private DefaultConfiguration defaultConfiguration;
>>
>>     @Autowired
>>     private ContainerService containerService;
>>
>>     @Autowired
>>     private UserUtil userUtil;
>>
>>     @Override
>>     protected GuacamoleTunnel createTunnel(Session session,
>> EndpointConfig endpointConfig) throws GuacamoleException {
>>
>>         try {
>>             GuacamoleSocket socket = null;
>>    containerService.getContainer(principalTO.get().getIdUser());
>>             socket = new ConfiguredGuacamoleSocket(
>>                 new InetGuacamoleSocket(containerTO.get().getHost(),
>>
>> Integer.parseInt(containerTO.get().getPort())),configuration);
>>                     }
>>                 }
>>             GuacamoleTunnel tunnel = new SimpleGuacamoleTunnel(socket);
>>             return tunnel;
>>         } catch (Exception e) {
>>             log.error(e);
>>         }
>>         return null;
>>     }
>>
>>     .....
>> }
>>
>>
>> The angular frontend just connects to the java backend endpoint that
>> creates the websocket and gets the tunnel provided.
>>
>> The socket is configured against the IP/port of the running docker image
>> on the docker server
>> It returns the websocket and everything works fine with one connected
>> user. Each running docker image has it's own ip and different ports binded
>> externally for the guacd daemon (internally all guacd listen on the same
>> port 4822)
>>
>> But as soon as any other user tries to connect, the websocket is closed
>>
>> This is logged in the java backend
>>
>> Exception in thread "Thread-2" java.lang.IllegalStateException: The
>> WebSocket session [1] has been closed and no method (apart from close())
>> may be called on a closed session
>> at org.apache.tomcat.websocket.WsSession.checkState(WsSession.java:1082)
>> at
>> org.apache.tomcat.websocket.WsSession.getUserProperties(WsSession.java:990)
>> at
>> org.apache.tomcat.websocket.WsRemoteEndpointImplBase.getBlockingSendTimeout(WsRemoteEndpointImplBase.java:533)
>> at
>> org.apache.tomcat.websocket.WsRemoteEndpointImplBase.getTimeoutExpiry(WsRemoteEndpointImplBase.java:270)
>> at
>> org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendMessageBlock(WsRemoteEndpointImplBase.java:244)
>> at
>> org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendString(WsRemoteEndpointImplBase.java:195)
>> at
>> org.apache.tomcat.websocket.WsRemoteEndpointBasic.sendText(WsRemoteEndpointBasic.java:37)
>> at
>> org.apache.guacamole.websocket.GuacamoleWebSocketTunnelEndpoint.sendInstruction(GuacamoleWebSocketTunnelEndpoint.java:152)
>> at
>> org.apache.guacamole.websocket.GuacamoleWebSocketTunnelEndpoint.access$200(GuacamoleWebSocketTunnelEndpoint.java:53)
>> at
>> org.apache.guacamole.websocket.GuacamoleWebSocketTunnelEndpoint$2.run(GuacamoleWebSocketTunnelEndpoint.java:253)
>>
>>
>> Can someone give me any hint about the websocket implementation ??
>> Please, feel free to ask me for anything
>>
>>

Re: Websockets problem when simulatenous connections

Posted by Lukáš Raška <lu...@raska.me>.
Hi,
every new comnection creates new guacd connection, which means new VNC
connection. You need to create some kind of lookup map so when new user
tries to connect, either new connection is established or existing one is
used.

The trickier part are race conditions,so synchronizing access to the lookup
table is the key, especially when removing the connection and handling
disconnects.


Hope it helps a bit.


Best Regards,
Lukas

Dne st 8. 6. 2022 15:04 uživatel Frco. Javier Rial <fj...@gmail.com>
napsal:

> Hi all
>
> I'm having this same exact problem as describe this
> https://stackoverflow.com/questions/54374533/guacamole-multiple-simultaneous-vnc-connections-over-websocket-close-each-other
>
> I've built my own guacamole application, just like this (I'm omitting the
> keycloak integration for authentication that I have and some minor details)
> My app has an angular frontend, a backend in Java and a docker server.
>
> Basically, when an user connects to the httptunnel/websocket, the backend
> in java connects to the docker server (using docker api) to setup and run
> an specific docker image for this user. This image contains the guacd
> daemon running inside
>
> Just to clarify, if I use HTTPTunnel, it works fine. I have my own
> implementation for the httptunnel in the java backend and works without any
> issues handling several connected users, but, with the poor performance
> provided by the httptunnel
>
> While using the websocket implementation in java, I have the mentioned
> problem in stackoverflow
>
> My implementation is as follows (minimal code provided here)
> @ServerEndpoint(value = "/webSocket", configurator =
> CustomSpringConfigurator.class)
> @Component
> public class WebSocketTunnel extends GuacamoleWebSocketTunnelEndpoint {
>
>     @Autowired
>     private DefaultConfiguration defaultConfiguration;
>
>     @Autowired
>     private ContainerService containerService;
>
>     @Autowired
>     private UserUtil userUtil;
>
>     @Override
>     protected GuacamoleTunnel createTunnel(Session session, EndpointConfig
> endpointConfig) throws GuacamoleException {
>
>         try {
>             GuacamoleSocket socket = null;
>    containerService.getContainer(principalTO.get().getIdUser());
>             socket = new ConfiguredGuacamoleSocket(
>                 new InetGuacamoleSocket(containerTO.get().getHost(),
>
> Integer.parseInt(containerTO.get().getPort())),configuration);
>                     }
>                 }
>             GuacamoleTunnel tunnel = new SimpleGuacamoleTunnel(socket);
>             return tunnel;
>         } catch (Exception e) {
>             log.error(e);
>         }
>         return null;
>     }
>
>     .....
> }
>
>
> The angular frontend just connects to the java backend endpoint that
> creates the websocket and gets the tunnel provided.
>
> The socket is configured against the IP/port of the running docker image
> on the docker server
> It returns the websocket and everything works fine with one connected
> user. Each running docker image has it's own ip and different ports binded
> externally for the guacd daemon (internally all guacd listen on the same
> port 4822)
>
> But as soon as any other user tries to connect, the websocket is closed
>
> This is logged in the java backend
>
> Exception in thread "Thread-2" java.lang.IllegalStateException: The
> WebSocket session [1] has been closed and no method (apart from close())
> may be called on a closed session
> at org.apache.tomcat.websocket.WsSession.checkState(WsSession.java:1082)
> at
> org.apache.tomcat.websocket.WsSession.getUserProperties(WsSession.java:990)
> at
> org.apache.tomcat.websocket.WsRemoteEndpointImplBase.getBlockingSendTimeout(WsRemoteEndpointImplBase.java:533)
> at
> org.apache.tomcat.websocket.WsRemoteEndpointImplBase.getTimeoutExpiry(WsRemoteEndpointImplBase.java:270)
> at
> org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendMessageBlock(WsRemoteEndpointImplBase.java:244)
> at
> org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendString(WsRemoteEndpointImplBase.java:195)
> at
> org.apache.tomcat.websocket.WsRemoteEndpointBasic.sendText(WsRemoteEndpointBasic.java:37)
> at
> org.apache.guacamole.websocket.GuacamoleWebSocketTunnelEndpoint.sendInstruction(GuacamoleWebSocketTunnelEndpoint.java:152)
> at
> org.apache.guacamole.websocket.GuacamoleWebSocketTunnelEndpoint.access$200(GuacamoleWebSocketTunnelEndpoint.java:53)
> at
> org.apache.guacamole.websocket.GuacamoleWebSocketTunnelEndpoint$2.run(GuacamoleWebSocketTunnelEndpoint.java:253)
>
>
> Can someone give me any hint about the websocket implementation ??
> Please, feel free to ask me for anything
>
>