[Libwebsockets] Fast loop with callback LWS_CALLBACK_GET_THREAD_ID

Andy Green andy at warmcat.com
Sat May 28 01:47:46 CEST 2016

On 05/28/2016 07:19 AM, Roger Schreiter wrote:
> Hello,
> I have a websocket server using libwebsockets. It sends some webpages
> using HTTP, but it also serves websocket connections.
> Using firefox as client, everything is fine.
> Using konqueror, with HTTP also everything is fine. But when the client
> (konqueror) opens the websocket connection, libwebsocket starts to fire
> LWS_CALLBACK_GET_THREAD_ID in the HTTP callback, thausends per second,
> endlessly. The websocket connection is never established.

I tried it here on Fedora 22 Konqueror (4.14.11), he is also OK for HTTP 
but cannot succeed to make a ws connection, in fact looking with tcpdump 
it does not even try to go out on the network to do so.

The only option for "view mode" other than text is KHTML.  So I think 
that's due to my Konqueror anyway being too old to do ws (but Fedora 22 
is not that old...)

(Nor could I find a way to open a js console on Konqueror).

> I cannot name the difference in opening a websocket between konqueror
> and firefox, and maybe it is a fault by konqueror. However, no client
> imho should be able to cause such behaviour.
> I tried to understand, what's happing, but with no success yet.
> May I ask, if this is a known behaviour?
> Is there any idea, what is causing it?
> And how to avoid it?

I can't reproduce it with my konqueror.

Somebody reported before that on one platform, they met a situation on 
socket close where recv() would just return 0 length to indicate the 
other side had closed.

But recv() can return 0 length under normal conditions (the api itself 
is ambiguous in more than one way about it).  I never met this situation 
myself and I think all platforms should return POLLERR that will handle 
it.  I took his patch but then reverted it when I found it destroyed ab 

Anyway since that would make a similar situation you might want to check 
if that is what's happening, it's in output.c in 


> Regards,
> Roger.
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> http://libwebsockets.org/mailman/listinfo/libwebsockets

More information about the Libwebsockets mailing list