Skip to content

websocket timeouts, ping/pong #1202

Closed
Closed

Description

@tolgaulas

ArcadeDB Version:

23.6.1

OS and JDK Version:

Debian 11, jdk-17

Expected behavior

websocket connections should not expire until closed or websockets should respond pings with pongs to keep the connection open.

Actual behavior

I could not test it thoroughly but what I observed from various tools (i.e wsocat,nodejs), the subscription works but after sometime the announcements stop. In nodejs what we see the server closes connection.

After I peeked at arcadedb source code in server/src/main/java/com/arcadedb/server/http/ws (and its parent http stack), though iI am not very literate with java, I felt that the [websocket ping/pong] (https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers#pings_and_pongs_the_heartbeat_of_websockets) and as the connection is based on standard http connection, it is probably timing out when there is no activity.

Steps to reproduce

`connect with ws for subscribe, insert into watched db, observe the announcement, wait for long time (10m?), and insert one more time, observe nothing published on websocket (wsocat reconnect the socket i presume, nodejs doesnot hence gives disconnected notification even before that.

<An SQL script to reproduce the problem or a JUnit test case will increase **A LOT** the chance to have a quick fix>

Can you pls shed some light on this? I know REST/JSON has some session-id passing feature (which expires on transcations).

if we periodically subscribe by sending commands, this connection remains open, but this sounds unwise as it may kill resources in the server, am I wrong?

Activity

  1. tolgaulas commented on Aug 17, 2023

    @tolgaulas
    Author

    I dug a little and i saw that the webserver extends a portion of the undertow's websocket default implementation which by default respond to pongs. And i confirm this by using this and sow that it responds the pong messages

    ./websocat "ws://user:pass@arcadedb:2480/ws" --ping-interval 1 --ping-timeout 2 --print-ping-rtts -E
    RTT 0.082423 s
    RTT 0.068529 s
    RTT 0.069332 s
    RTT 0.067708 s
    RTT 0.069457 s
    RTT 0.069364 s
    RTT 0.075618 s
    RTT 0.067169 s
    

    Also, node-red's stock websocket had some issues in reporting/displaying the connection as disconnected while it actually was not.

    So ws works fine on ping/pongs.

  2. lvca commented on Aug 17, 2023

    @lvca
    Member

    @tolgaulas do you know why it disconnects after a while?

  3. self-assigned this
    on Aug 17, 2023
  4. added
    invalid
    on Aug 17, 2023
  5. added this to the 23.9.1 milestone on Aug 17, 2023
  6. tolgaulas commented on Aug 17, 2023

    @tolgaulas
    Author

    @tolgaulas do you know why it disconnects after a while?

    Actually it does not, we were testing it with node-red, it was node-red's mistake as displaying such. So it was a false-error. Despite its been claimed its fixed here, we're having similar problems with it.

    we will dig into it more with node-red

  7. lvca commented on Aug 17, 2023

    @lvca
    Member

    Ok, thanks.

  8. tolgaulas commented on Aug 18, 2023

    @tolgaulas
    Author

    @lvca also made an extensive test on ws timeouts, I can confirm that ws connections are kept alive for 6min, 60min, 600mins, 6000mins idle intervals and acted as behaved (responded to the open channel with actions_) at the end of the pauses all the time. Also peeped the source, i could not see any kind of session management in websocket related activities but only in transactional stuff at the moment, . So my initial report was false (may be due to unhealthy network environment ); ws is healthy, rock solid and per standards.

  9. lvca commented on Aug 18, 2023

    @lvca
    Member

    Great, thanks @tolgaulas for digging into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

invalid

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions