[Libwebsockets] lws_client_connect_via_info() blocks for 30 seconds

Andy Green andy at warmcat.com
Thu Mar 3 22:06:18 CET 2016



On March 4, 2016 12:46:58 AM GMT+08:00, "Goldby, Ian" <Ian.M.Goldby at uniper.energy> wrote:
>I'm evaluating libwebsockets for a websockets client in an embedded
>hardware project and I've quickly run into difficulties.
>
>I'm using version 1.7.3 and trying to run the libwebsockets-test-client
>on an ARMLinux board to connect to libwebsockets-test-server on an
>Ubuntu Linux machine. For the time being I am not using SSL (but I
>ultimately this will be required).
>
>The server works fine. I've tested it from Firefox and also from
>libwebsockets-test-client running on Ubuntu and Windows 7.
>
>But when I run the test client on the ARMLinux system then it blocks in
>lws_client_connect_via_info() for 30 seconds. It then calls
>lws_service() twice, and each time it returns after 0.5 seconds as
>expected. But the third time it calls lws_service() it blocks for 30
>seconds and during this time the server times out the connection,
>sending a TCP RST packet. At the end of the 30 seconds the client
>detects the closed connection (LWS_CALLBACK_CLIENT_CONNECTION_ERROR).
>
>If I increase the server timeout to (say) 500 seconds then the client
>connects successfully (albeit taking a minute to do so) and then runs
>as expected from that point onwards.

Generally, network app sitting there for 20 - 30s, the first suspect is name resolution broken, either dns or rdns.

>(I'm using just the dumb-increment-protocol; I've completely removed
>the lws-mirror-protocol code from the client to keep things simple but
>it was failing for the same reason before I made any changes.)
>
>The ARMLinux system uses Kernel 2.6.28, BusyBox v1.18.4 and
>uClibc-0.9.29.
>
>Are there any known issues with libwebsockets on this configuration?

No... Arm is a first-class citizen for lws.  Libwebsockets.org and his lws test server runs on a Cortex A7, although on Fedora / glibc.

>If not, please would you suggest where I could start looking for the
>cause of the 30 seconds blocking?
>
>Thanks in anticipation for whatever suggestions you can offer.

Check your target's /etc/resolv.conf and /etc/nsswitch.conf, and if it has it, ping (what's the rdns name like?) or dig the server address from the commandline to see if also delayed.  I would guess first this is something related to platform configuration, not lws itself.

-Andy

>Ian
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
>http://libwebsockets.org/mailman/listinfo/libwebsockets




More information about the Libwebsockets mailing list