[Libwebsockets] libwebsocket message loop thread take 100% of the CPU

Peiffer Eric eric.peiffer at al-enterprise.com
Thu Sep 24 09:32:19 CEST 2020


I have another question about the same issue. Our application use 2 libwebsockets context in the same process, but two different threads:
The first context for a web socket server that connect about 300 clients
The second for clients web socket, some thousand client connect to a external web socket server.

For both context: info.fd_limit_per_thread = 0;
Is there any conflict for example file descriptor or memory  or socket, between the two context?
In this case which parameters I have to adjust?



De : Andy Green <andy at warmcat.com>
Envoyé : mercredi 16 septembre 2020 13:48
À : Peiffer Eric <eric.peiffer at al-enterprise.com>
Objet : EXT: Re: EXT: Re: EXT: Re: [Libwebsockets] libwebsocket message loop thread take 100% of the CPU

** External email - Please consider with caution **

On 9/16/20 12:29 PM, Peiffer Eric wrote:

> You don't mention the lws version I would definitely try master and see
> if acts the same.

Advice is still the same, try master.  v3.2 is not maintained any more,
v4.0 and v4.1 now are released after that.

> And you don't mention your platform.

What's the platform?

>> But I have activated the trace in libwebsockets. When this issue occurs
>> no more event are fired except the LWS_CALLBACK_EVENT_WAIT_CANCELLED.
> So it's still going around the event loop...
>> The remote part then close the web socket because no more data are rsend
>> from our application.
> ... it's this one connection that suffers that or everything that is
> connected drops dead?
> The problem goes away when this one connection is closed?  Or it does
> not understand it should be closed and that makes the spinning?
> The symptoms are the following;
> for a unexpected reason  our application that open a large number of
> client web socket connections to a web socket server, does not received
> any more event from libwebsockets (no LWS_CALLBACK_CLIENT_ESTABLISHED,
> LWS_CALLBACK_EVENT_WAIT_CANCELLEDis received , then none web socket
> client are notified for incoming data and can not send data. Then the
> web socket server (the remote part) close all client web socket. When
> our application try to re open the client web socket it fails and we get
> the trace below:

So can you remove your application from the isse and reproduce it just
with, eg, lws + apache or something I can try here?

But first see if the problem still exists on master...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20200924/ddb64661/attachment.htm>

More information about the Libwebsockets mailing list