[Libwebsockets] a bug?

"Andy Green (林安廸)" andy at warmcat.com
Thu Mar 7 01:37:21 CET 2013


On 07/03/13 04:07, the mail apparently from klervi - Alex Rhatushnyak 
included:
> Hi Andy!
> Please find attached slightly modified test-server.c and test-client.c
> from libwebsockets 1.22.
> When you run them like this:
>
> *> ./libwebsockets-test-server*
> *> ./libwebsockets-test-client* localhost
>
> there is no problem, but if deflate is disabled, an error will be
> reported almost immediately:
>
> *> ./libwebsockets-test-client* localhost -u
>  > ...
>  > ERROR!!! Only the first 7686 of 8190 bytes are 'a'.  The remainder:
>  > ...
>
> The following appears on the server side:
>  > [1362599624:3931] DEBUG: ERROR writing len 8194 to skt 7682
>
> (log level defaults to (1<<LLL_COUNT)-1  in the attached code).
> At least, that's what I observe on Mac OSX 10.8.2.
> Please advise whether you can reproduce the issue, and whether you think
> it's really caused by a bug.
> Thank you!
>
> Doesn't it look a bit odd that if send() was unable to send all bytes,
> function lws_issue_raw() doesn't care how many were actually sent:
>
>          n = send(wsi->sock, buf, len, MSG_NOSIGNAL);
>          lws_latency(context, wsi, "send lws_issue_raw", n, n == len);
>          if (n != len) {
>              lwsl_debug("ERROR writing len %d to skt %d\n", len, n);
>              return -1;
>          }

Please make sure you're running the latest version from

http://git.libwebsockets.org/cgi-bin/cgit/libwebsockets/

looking at the diff with the files you sent, it seems you started from 
an older version.  We did work on this recently, eg

http://git.libwebsockets.org/cgi-bin/cgit/libwebsockets/commit/?id=fc7c5e453920ad8ce163f618cd8d65abc78c9901

We have more to do, eg, force the send buffer size by socket options, 
but the current version should hopefully remove the symptom.

-Andy




More information about the Libwebsockets mailing list