libwebsockets icon indicating copy to clipboard operation
libwebsockets copied to clipboard

Receiving many large data results in disconnect

Open moo1 opened this issue 1 year ago • 1 comments

I encountered unexpected disconnect when receiving several large data simultaneously (8+ 100-300KB messages). Debugging this and found the disconnect was initiated in ops-ws.c rops_handle_POLLIN_ws() where sanity went more than 10. I modified the initial sanity to be larger like 100 and no issue in receiving those large data.

My questions are;

  • Why the limit so low? Is intended usage dealing with smaller data?
  • Are there any config to avoid this issue or modifying code to increase the initial sanity only solution?
  • Why it treats as disconnect instead of processing remaining data in the next polling?

moo1 avatar Jul 16 '24 17:07 moo1

hi @moo1 I just realized my issue https://github.com/warmcat/libwebsockets/issues/3185 is the same cause as yours :)

davehorton avatar Jul 18 '24 23:07 davehorton

I pushed a patch increasing sanity to 100.

The reason this exists is that depending on your platform, it's possible for the tls library to lose the underlying socket connection and act badly, eg, spin forever delivering 0 length reads without error.

lws-team avatar Sep 25 '24 07:09 lws-team