[Libwebsockets] Fast loop of LWS_CALLBACK_GET_THREAD_ID events.

Bruce Perens bruce at perens.com
Fri Apr 24 20:13:19 CEST 2015


My server currently catches LWS_CALLBACK_GET_THREAD_ID and returns
pthread_self(). Currently, it never
calls libwebsocket_callback_on_writable().

Using either the released version or a pull from git today, a
libwebsocket_service() loop with a long delay eats the CPU while a socket
is closing. This is what I am seeing:

Add poll FD, count = 1 fd = 6, events = 1      *Start of serving a few
files via HTML. Lots of LWS_CALLBACK_GET_THREAD_ID events happening here.*
Add poll FD, count = 2 fd = 7, events = 1
Add poll FD, count = 3 fd = 8, events = 1
Add poll FD, count = 4 fd = 9, events = 1
Delete poll FD, count = 3 fd = 7, events = 0
Delete poll FD, count = 2 fd = 8, events = 0
Delete poll FD, count = 1 fd = 9, events = 0
Add poll FD, count = 2 fd = 8, events = 1       *Start of Websocket
service.*
Connection with protocol: radio-server-1 path: /foo
Change poll FD fd = 8, events = 5                  *Service is in closing
state, CPU utilization goes to 100%, continuous LWS_CALLBACK_GET_THREAD_ID
events here.*
Delete poll FD, count = 1 fd = 8, events = 0    Service is closed, CPU
utilization goes low again.
Websocket connection closed.

Am I providing the wrong information to the LWS_CALLBACK_GET_THREAD_ID
callback?

    Thanks

    Bruce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libwebsockets.org/pipermail/libwebsockets/attachments/20150424/3ba51ed2/attachment.html>


More information about the Libwebsockets mailing list