cryostatio / cryostat

Secure JDK Flight Recorder management for containerized JVMs
https://cryostat.io
Other
11 stars 9 forks source link

[Bug] WebSocket server does not send pings, client disconnects and reconnects periodically #459

Closed andrewazores closed 4 months ago

andrewazores commented 4 months ago

Current Behavior

After establishing a WebSocket notification connection between the Cryostat server and web-client UI the connection is left idle, unless some activity happens and triggers the emission of a notification event.

If the connection is idle for long enough it will be closed (by the browser?):

image

image

The web-client knows to retry opening a WebSocket connection when it is disconnected, so the connection is re-established almost immediately.

Expected Behavior

WebSocket ping frames should be sent periodically so that the connection is kept alive and the web-client application code does not need to attempt to reconnect.

Older Cryostat versions did this every 5 seconds: https://github.com/cryostatio/cryostat/blob/ed1fcbd31d8e2d759b85397a29414959c9e40df9/src/main/java/io/cryostat/messaging/MessagingServer.java#L184 . This is probably much faster than it needs to be: https://stackoverflow.com/questions/14576298/how-to-decide-the-ping-interval-for-websocket-connection

Steps To Reproduce

No response

Environment

No response

Anything else?

No response