[Libwebsockets] CPU 100% usage due to constant writeable callbacks

Tom Gallagher tegteg at gmail.com
Fri Jul 27 22:41:17 CEST 2018


Hi All,

I have a websocket client application based on the test app.

Once I connect to the server I need to send it a subscription message
telling it what data to send me.

So in the LWS_CALLBACK_CLIENT_ESTABLISHED callback I call
lws_callback_on_writeable

I then immediately get a  LWS_CALLBACK_CLIENT_WRITEABLE callback and I call
lws_write which succeeds.

After this I am done writing for the duration of the process.

But I continue to constantly get writeable callbacks which I ignore as I
have nothing more to write.

so the program works fine but it pegs the CPU at 100% because it is
constantly calling writeable callback.

Do I have to cancel the writeable callback somehow?  I am calling
lws_service with 1000 ms timeout but this function is returning immediately.

Thanks,

Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20180727/09e20077/attachment.html>


More information about the Libwebsockets mailing list