libwebsockets
libwebsockets copied to clipboard
Receiving many large data results in disconnect
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
sanityonly solution? - Why it treats as disconnect instead of processing remaining data in the next polling?
hi @moo1 I just realized my issue https://github.com/warmcat/libwebsockets/issues/3185 is the same cause as yours :)
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.