[Libwebsockets] a bug?

"Andy Green (林安廸)" andy at warmcat.com
Sat Mar 23 03:05:36 CET 2013


On 18/03/13 22:58, the mail apparently from klervi - Alex Rhatushnyak 
included:
> Hi Andy!
> I installed cmake and rebuilt everything with
> cmake .. -DCMAKE_INSTALL_PREFIX:PATH=`pwd`/usr -DWITH_SSL=0
>
> Please find the '-u' logs attached.
>
> Without '-u', after ~3 minutes:
> nothing but "PARSER: written 55 bytes to client" on the server side,
> nothing but "rx 8190  rx 8190  rx 8190  rx 8190  rx 8190..." on the
> client side.

I let it go for 5 minutes without -u but didn't see that.

Because you need t send large frames to get the problem, I think we find 
this boils down to the known issue that the OS may reject to send all of 
large packets.

To point up that being the issue, you can adapt the server code a little 
like this

         case LWS_CALLBACK_SERVER_WRITEABLE:
                 n = 8190; //sprintf((char *)p, "%d", pss->number++);
                 memset(buf, 'a', sizeof(buf));
                 m = libwebsocket_write(wsi, p, n, LWS_WRITE_TEXT);
                 if (m < n) {
                         lwsl_err("+++++++++++++++++++++++++ERROR %d 
(sent %d) writing to di socket\n", m, n);
                         return -1;
                 }

I improved this code in the test server.

I also pushed this

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

which should solve this whole class of issue.... also read the note I 
added at the end of the commit log there, you don't have to write the 
code the way your test apps are doing it atm either.

Please let me know if this helps.

-Andy

> Regards,
> Alex
>
>
>
> On Sun, Mar 17, 2013 at 1:45 AM, "Andy Green (林安廸)" <andy at warmcat.com
> <mailto:andy at warmcat.com>> wrote:
>
>     On 17/03/13 13:31, the mail apparently from "Andy Green (林安廸)"
>     included:
>
>         On 17/03/13 13:21, the mail apparently from klervi - Alex
>         Rhatushnyak
>         included:
>
>             Hi Andy!
>             I tested
>             libwebsockets-__b55451c6d20dd64c62594a91af3297__a8934b0ec4.tar.gz
>             <http://git.libwebsockets.org/__cgi-bin/cgit/libwebsockets/__snapshot/libwebsockets-__b55451c6d20dd64c62594a91af3297__a8934b0ec4.tar.gz
>             <http://git.libwebsockets.org/cgi-bin/cgit/libwebsockets/snapshot/libwebsockets-b55451c6d20dd64c62594a91af3297a8934b0ec4.tar.gz>>
>
>             Got no problems without '-u',
>             with '-u' the client is killed after ~5 seconds.
>             But there's no seg.fault, that's a good news.
>
>
>         Thanks for testing... at least one nasty thing that made the
>         segfault
>         was definitely nailed, hopefully that was that part.
>
>         I'll try these later tonight and see what happens.
>
>
>     I just tried it, in fact I can't reproduce with -u either using your
>     test code, for 2 minutes with and without logging.  Not saying
>     there's not a real problem just I can't reproduce it.
>
>     Maybe you could narrow down how the client exits on your side,
>     server is closing him?  Something else?
>
>     -Andy
>
>             Please find the modified test-server.c and test-client.c
>             attached.
>             If you could include all files in libwebsockets-...tar.gz,
>             that would be
>             nice.
>             E.g. Makefile.am, autogen.sh and configure.ac
>             <http://configure.ac> <http://configure.ac>
>             aren't included in -b55451...
>
>
>         We've removed the autotools support, things build with Cmake
>         now.  Have
>         a look at README.build.  This way I can maintain one text file and
>         update even Windows builds with the same action, which was
>         impossible
>         before.
>
>         -Andy
>
>         _________________________________________________
>         Libwebsockets mailing list
>         Libwebsockets at ml.__libwebsockets.org
>         <mailto:Libwebsockets at ml.libwebsockets.org>
>         http://ml.libwebsockets.org/__mailman/listinfo/libwebsockets
>         <http://ml.libwebsockets.org/mailman/listinfo/libwebsockets>
>
>
>




More information about the Libwebsockets mailing list