Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How long does the client send no messages? The session will be disconnected #247

Open
pseason opened this issue Sep 9, 2021 · 5 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@pseason
Copy link

pseason commented Sep 9, 2021

In the current version, only the Handshake is used at the start of the connection. If the client does not send a message for a long time, the session will not be closed automatically. Will future versions do this session logic maintenance? For example, Netty can set the session to be automatically closed if the client does not send messages for a long time .

@chgz
Copy link
Contributor

chgz commented Sep 9, 2021

Not yet
If you don’t send messages all the time, it may be closed because heartbeat hasn’t responded.

I also suggest adding this timeout verification mechanism.
like: after the connection is established, close the connection if the verification is not completed within 5 seconds
prevent malicious empty connections..

@henriqueoelze henriqueoelze added enhancement New feature or request good first issue Good for newcomers labels Sep 9, 2021
@henriqueoelze
Copy link
Contributor

Hello folks. We will analyze the suggestion and add it to our roadmap. Thanks for the suggestion. At first view, we agreed that the feature makes sense for future releases.

@pseason
Copy link
Author

pseason commented Sep 10, 2021

Celebrate the decision

@lopies
Copy link

lopies commented Nov 17, 2021

maybe you can look for config.go

@tangxinfa
Copy link

Very different heartbeat timeout threshold between pitaya and libpitaya.

pitaya server(see pitaya/agent/agent.go):

deadline := time.Now().Add(-2 * a.heartbeatTimeout).Unix()

libpitaya client(see libpitaya/src/tr/uv/tr_uv_tcp_aux.c)

uint64_t threshold = (tt->hb_interval * 1000) * (PC_HEARTBEAT_TIMEOUT_FACTOR + 4); // +1 here to keep with the old behaviour

The default heartbeat interval is 30s, this means pitaya server will detect the dead connection in 60s, and client will detect it in 180s.

It is not acceptable.

We should select a lower value such as 5s, then the server is 10s, and client is 30s.

Pitaya server and libpitaya client use the same heartbeat timeout threshold will make things simple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants