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

Issue with retry/idle policy for PING PONG over wss #3322

Open
BhanuPrakash-P opened this issue Jan 30, 2025 · 1 comment
Open

Issue with retry/idle policy for PING PONG over wss #3322

BhanuPrakash-P opened this issue Jan 30, 2025 · 1 comment

Comments

@BhanuPrakash-P
Copy link

Hi @lws-team,

I am using libwebsockets v4.3 for my webserver. I have set the retry/idle policy for wss as shown below and assigned it to lws_context_creation_info before lws_create_context().

static const lws_retry_bo_t retryPolicy = {
  .conceal_count= 0,
  .jitter_percent = 0,
  .retry_ms_table_count = 0,
  .secs_since_valid_hangup = 30,
  .secs_since_valid_ping = 15
};

info.retry_and_idle_policy = &retryPolicy;
context = lws_create_context(&info);

My server has couple of vhosts created for http/ws, https/wss.

I tried this with minimal-example of ws-server on linux platform, everything is fine.
Logs:

[2025/01/30 23:33:36:2700] I: [wsisrv|1|adopted|h1|h1|/|ws|/]: lws_validity_cb: scheduling validity check
[2025/01/30 23:33:36:2707] D: [wsisrv|1|adopted|h1|h1|/|ws|/]: _lws_change_pollfd: fd 8 events 1 -> 5
[2025/01/30 23:33:36:2749] I: rops_handle_POLLOUT_ws: issuing ping on wsi [wsisrv|1|adopted|h1|h1|/|ws|/]: ws http h2: 0
[2025/01/30 23:33:36:2759] I: [wsisrv|1|adopted|h1|h1|/|ws|/]: lws_issue_raw: ssl_capable_write (2) says 2
[2025/01/30 23:33:36:2763] D: [wsisrv|1|adopted|h1|h1|/|ws|/]: _lws_change_pollfd: fd 8 events 5 -> 1
[2025/01/30 23:33:36:2763] D: [wsisrv|1|adopted|h1|h1|/|ws|/]: lws_handle_POLLOUT_event: non mux: wsistate 0x20000119, ops ws
[2025/01/30 23:33:36:2782] D: [wsisrv|1|adopted|h1|h1|/|ws|/]: SSL_read says 6
[2025/01/30 23:33:36:2784] D: lws_read_h1: h1 path: wsi state 0x119
[2025/01/30 23:33:36:2784] D: lws_parse_ws: received 6 byte packet
[2025/01/30 23:33:36:2785] P: spill on http
[2025/01/30 23:33:36:2785] I: received pong
[2025/01/30 23:33:36:2785] D: (hexdump: zero length)
[2025/01/30 23:33:36:2786] I: [wsisrv|1|adopted|h1|h1|/|ws|/]: _lws_validity_confirmed_role: setting validity timer 15s (hup 0)

When I tried the same on STM32 board + FreeRTOS, I don't see lws_validity_cb getting hit at any point of time. This is causing idle websocket sessions not getting closed. Any guidance to debug further?

Note: I confirmed that retryPolicy is being used properly while creating the context.

Thanks!

@BhanuPrakash-P BhanuPrakash-P changed the title Issue with retry/idle Policy for PING PONG over wss Issue with retry/idle policy for PING PONG over wss Jan 30, 2025
@lws-team
Copy link
Member

If you're not already doing it, make sure you're using latest main lws for this, there was a patch in sept that probably solved some problems in this area https://github.com/warmcat/libwebsockets/commits/main/?after=e0c312c20248b2c7f509216e3b3463dc372fc114%2034

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants