[Libwebsockets] sporadic connection close on Rx

Andy Green andy at warmcat.com
Sun Nov 7 11:13:22 CET 2021

On 11/5/21 13:05, Roman Nikiforov wrote:
>> What I suggest is enable the cmake option LWS_TLS_LOG_PLAINTEXT_RX and 
>> see what is actually read from the server, and if we can see the 
>> breakage, confirm what the server thinks it sent on tls for those 
>> packets.
> I recompiled with this define. In case RX fails usually there is 
> "illegal opcode" message from lws_ws_client_rx_sm. But I also had 
> "disordered continuation" and "illegal rsv bits set". I added opcode and 
> c function parameter output in log and they have different values every 
> time:

These are basically every way that the framing can be illegal, it thinks 
it has completed a fragment, but when it looks for the next ws frame, it 
is seeing your "random" data instead.

> [wsicli|0|WS/h1/default/medrepo.de|default]: lws_ws_handshake_client: hs 
> client feels it has 4096 in
> [2021/11/05 12:17:16:4626] D: 
> [wsicli|0|WS/h1/default/medrepo.de|default]: lws_ws_client_rx_sm: 
> spilling as we have the whole frame
> [2021/11/05 12:17:16:4626] D: 
> [wsicli|0|WS/h1/default/medrepo.de|default]: lws_ws_client_rx_sm: 
> starting disbursal of 2048 deframed rx

Why does it want to limit that to 2048?  Is the limit coming from your 
lws_protocols struct?  If so, upping it to 4096 might help.


More information about the Libwebsockets mailing list