[Libwebsockets] LWS assertion probably due to start/stop of a pppd daemon

Andy Green andy at warmcat.com
Wed Sep 23 10:52:40 CEST 2020

On 9/23/20 9:05 AM, thomas.spitz at hestia-france.com wrote:
> Hello Andy,
> Thanks a lot for your quick answer
> Unfortunately I have to continue looking into my code "by hand" because 
> I don't see yet how to reproduce my program issues through skeletal 
> changes. I also cannot use Valgrind because it is not available for 
> armv5 and my program is very tight to hardware (hard to make it cross 
> platform)...

I draw a line between lws issues, that I do take some responsibility to 
solve to the extent I generally want it to work so I can use it myself, 
and user code problems that are in the end nothing to do with me.

That's partly why there are so many minimal examples, so they can be 
kept working, users can base off them and avoid problems, and if there 
are mysteries like this, they can be used as a razor to try to determine 
whether it's an lws problem, lws problem just on that platform, or user 

It's extremely valuable to write your code in a way where it can largely 
operate independent of the target, and take advantage of these kind of 
tools unavailable on embedded targets that can remove days or weeks of 
debugging.  You should maybe rethink what "cross platform" means to you, 
in order to also cover this case and even write your initial 
implementation that way and proving it valgrind-clean before bothering 
building it cross.  Lws is very cross platform indeed and will work with 
you on that.

> In order to help me spot the bug, sometimes, at least with libwebsockets 
> v4.0.99 unknown-build-hash, the issue showed up in a different manner. 
> The WS server just stopped accepting new connection without trigerring 
> any assertion.

>> 2020-08-13 14:56:27,1,6,V4:, *SSL_accept says -1*
>> 2020-08-13 14:56:27,1,6,V4:, SSL_accept failed socket 2: -1

The tls library is saying it could not negotiate the tls tunnel.  But, 
it's saying it for process fd 2 (initially, always set up by the OS as 
stderr).  You really meant to close your process stderr so it could turn 
up here for reuse?  Probably not.

> Do you think this could also be due to a client connection fd my program 
> close accidentaly?

Unless you took the approach to close stderr deliberately, it does seem 
related to unexpected fd getting closed + reused by your process.

I don't think that is anything to do with lws.


More information about the Libwebsockets mailing list