zowe / zlux

The top-level superproject for zLUX. zLUX includes the Zowe Desktop framework in addition to several built-in apps and an example server implementation.
Eclipse Public License 2.0
38 stars 42 forks source link

WebSocket session duration #968

Open pablocarle opened 1 year ago

pablocarle commented 1 year ago

Describe the bug

When accessing the Zowe Desktop through the Zowe API ML Gateway, and opening a WebSocket session by opening for example the TN 3270 emulator, the session will be closed after a 5 minute idling time.

This is mostly a question, to understand if the Zowe Desktop in standalone mode has a similar limitation from the client perspective, where it will close idling websockets after 5 minutes, or if there's something to be improved in the API ML Gateway (which acts as both a WebSocket server and client for the ZLUX)

Is this something that are you guys already aware of?

Steps to Reproduce

  1. Start Zowe
  2. Open Zowe Desktop through the API ML session
  3. Open TN 3270 emulator and login
  4. Wait 5 minutes without action
  5. WebSocket connection is closed and it requires to open it again.

Expected behavior

Screenshots (if needed)

image

Logs

2023-05-10 10:06:59.420 <ZWEAGW1:HttpClient@d0a2765e-scheduler-1:17171702> ZWESVUSR WARN  (o.z.a.g.w.WebSocketProxyClientHandler) WebSocket transport error in session 0c17328a-92de-47c4-8c9f-0539f0c528d9
org.eclipse.jetty.websocket.api.CloseException: java.util.concurrent.TimeoutException: Idle timeout expired: 300001/300000 ms
Caused by: java.util.concurrent.TimeoutException: Idle timeout expired: 300001/300000 ms
    ... 9 common frames omitted
2023-05-10 10:06:59.422 <ZWEAGW1:HttpClient@d0a2765e-scheduler-1:17171702> ZWESVUSR DEBUG (o.z.a.g.w.WebSocketProxyClientHandler) afterConnectionClosed(session=JettyWebSocketSession[id=0c17328a-92de-47c4-8c9f-0539f0c528d9, uri=wss://usilca32.lvn.broadcom.net:40034/ZLUX/plugins/org.zowe.zlux.bootstrap/services/adminnotificationdata/_current/],status=CloseStatus[code=1001, reason=java.util.concurrent.TimeoutException: Idle timeout expired: 300001/300000 ms])

Describe your environment

Additional context

pablocarle commented 1 year ago

Possibly related: https://stackoverflow.com/questions/49408031/websockets-in-chrome-and-firefox-disconnecting-after-one-minute-of-inactivity Basically if the Zowe Desktop does not currently implement a custom ping to keep the socket open on inactivity it may be relying on the browser implementation. By looking at the network tab in Chrome I don't see the ping messages, but the implementation between the websocket client on the browser and the client on the Gateway side is different, since going directly to the Zowe Desktop results in a longer session even on inactivity.

Ideally I think there should be some implementation of a ping to keep the session open as long as the UI is open, this would work even with Gateway as it relies the messages.

1000TurquoisePogs commented 1 year ago

It seems like we can add pings in the terminals because the server code just ignores messages that arent in a certain json format. So, we just need some interval code on the websocket code within here https://github.com/zowe/tn3270-ng2/blob/v2.x/staging/webClient/src/app/terminal.ts for example.

Martin-Zeithaml commented 1 year ago

Some commercial terminals has a setting to press a key each several minutes. You can define which key and interval. This is another way how to keep the connection open.