[Libwebsockets] new ws timeout on sleep

Andy Green andy at warmcat.com
Fri Nov 27 16:46:28 CET 2020



On 11/27/20 3:21 PM, Per Bothner wrote:

> There seems to be a difference between version 4.1.0 (as installed on 
> Fedora 33)
> and the git master in whether a websocket connection times out on laptop 
> sleep.
> 
> This applies to a local connection between a domterm server and a browser
> window on the same laptop running Fedora 33.
> 
> In 4.1.0 I can sleep the laptop briefly (haven't tested extended sleep),
> and on resume the websocket connection is still live.
> 
> In master, the websocket connection times out after a brief (1-minute) 
> pause.
> 
> I don't know if this is an expected change, or an unexpected regression.
> If this is unexpected, I can try to bisect to narrow down when the 
> regression.
> If this is expected (or unavoidable for some reason), it is not a problem,
> since I have (mostly) implemented logic for re-establishing a new 
> connection.

It doesn't quite sound like what I would have expected, but on main 
there's a lot of new code on Linux around opening a NETLINK_ROUTE 
netlink socket and tracking available source addresses and network 
interfaces.

When it sees an interface go down now, it goes through all active client 
socket fds checking if the original connection route is invalidated by 
the change, if it is, it will close the connection immediately.

This is partly aimed at gathering the data to implement RFC6724 ipv4/v6 
DNS results sorting that also exists now, but also at various requests 
over the years for smarter route awareness, so that if a network 
interface links down, apps can respond quicker to the change and retry 
immediately on a new route, eg, wifi out of range and switch to a 
different IP and route on LTE.

If it's actually on 127.0.0.1 I don't know that should actually go down 
from userland perspective during suspend... and if it is closed, it 
should close immediately.  So maybe this is something else... if you can 
try main from October at 915f888f3e78be3a42e66a627bcc6ce1d679d5d3 just 
before the netlink role was added that might give a hint.

-Andy


More information about the Libwebsockets mailing list