[Libwebsockets] Problem with libwebsocket and keepalive

Andy Green andy at warmcat.com
Wed Oct 21 01:10:22 CEST 2015



On 21 October 2015 04:52:43 GMT+08:00, Ben Wittmeyer <bwit30562 at gmail.com> wrote:
>I am currently having an issue with libwebsocket  crashing whenever I
>issue wget -r   to my simple
>webserver built with  the libwebsocket.  I have attached a simple
>example
>made out of the test-server included in the distribution.
>
>if I disable keepalive in wget the server does not crash. This crash
>occurs
>on the first file sent and randomly after that.

I can't reproduce this here on the test server itself.

Can you see if the test server itself acts the same way for you?

I'm a bit suspicious that we fixed something stopping http1.1 keepalive working properly yesterday and the next day hear this.  But it would be nice to be able to reproduce it with the actual test server.

-Andy

>
>Any suggestions   would be greatly appreciated.
>version of libwebsocket :  latest as of 10/20/2015
>libev:  not compiled in.
>
>here is stack trace:
>
>Setting resource path to "/opt/www"
>lwsts[903]: libwebsockets test server - (C) Copyright 2010-2015 Andy
>Green <
>andy at warmcat.com> - licensed under LGPL2.1
>Using resource path "/opt/www"
>lwsts[903]: Initial logging level 7
>lwsts[903]: Library version: 1.4 d256194
>lwsts[903]: IPV6 not compiled in
>lwsts[903]: libev support compiled in but disabled
>lwsts[903]:  static allocation: 4532 + (12 x 1024 fds) = 16820 bytes
>lwsts[903]:  canonical_hostname = dmx814x
>lwsts[903]:  per-conn mem: 336 + 2140 headers + protocol rx buf
>lwsts[903]:  Listening on port 8080
>    get  = /index.html
>    host: = 192.168.1.1:8080
>    connection: = Keep-Alive
>    http/1.1  = HTTP/1.1
>    accept: = */*
>    user-agent: = Wget/1.13.4 (linux-gnu)
>
>Program received signal SIGSEGV, Segmentation fault.
>0x00010ed4 in libwebsocket_parse (context=0x2e008, wsi=0x2f318, c=32 '
>')
>at /home/test/libwebsockets/lib/parsers.c:451
>451
>wsi->u.hdr.ah->frag_index[
>(gdb) where
>#0  0x00010ed4 in libwebsocket_parse (context=0x2e008, wsi=0x2f318,
>c=32 '
>') at /home/test/libwebsockets/lib/parsers.c:451
>#1  0x00017cce in lws_handshake_server (context=0x2e008, wsi=0x2f318,
>buf=0xbedb912c, len=126) at /hometest/libwebsockets/lib/server.c:343
>#2  0x000196e2 in libwebsocket_read (context=0x2e008, wsi=0x2f318,
>    buf=0x2e180 "/robots.txt HTTP/1.1\r\nUser-Agent: Wget/1.13.4
>(linux-gnu)\r\nAccept: */*\r\nHost: 192.168.1.1:8080\r\nConnection:
>Keep-Alive\r\n\r\nt/ngPopup.min.js\"></script> -->\n    <script
>src=\"bower_components/ng-popup"..., len=130) at
>/home/test/libwebsockets/lib/handshake.c:107
>#3  0x0001853c in lws_server_socket_service (context=0x2e008,
>wsi=0x2f318,
>pollfd=0x30828) at /home/test/libwebsockets/lib/server.c:720
>#4  0x0000eb64 in libwebsocket_service_fd (context=0x2e008,
>pollfd=0x30828)
>at /home/test/libwebsockets/lib/service.c:490
>#5  0x00016f8e in lws_plat_service (context=0x2e008, timeout_ms=50) at
>/home/test/libwebsockets/lib/lws-plat-unix.c:179
>#6  0x0000edd6 in libwebsocket_service (context=0x2e008, timeout_ms=50)
>at
>/home/test/libwebsockets/lib/service.c:667
>#7  0x0000d4ea in main (argc=5, argv=0xbedb9c94) at
>/home/test/libwebsockets/test-server/test-server.c:788
>(gdb) list
>446
>lextable[wsi->u.hdr.lextable_pos +
>1];
>
>447
>
>448                             lwsl_parser("known hdr %d\n",
>n);
>
>449                             for (m = 0; m < ARRAY_SIZE(methods);
>m++)
>
>450                                     if (n == methods[m]
>&&
>
>451
>wsi->u.hdr.ah->frag_index[
>
>452
>methods[m]])
>{
>
>453                                             lwsl_warn("Duplicated
>method\n");
>
>454                                             return
>-1;
>
>455
>}
>
>(gdb) print
>wsi->u.hdr
>
>$1 = {*ah = 0x0*, lextable_pos = 64, current_token_limit = 0,
>parser_state
>= 84 'T', ups = 13396, ues = URIES_SEEN_PERCENT, esc_stash = 1 '\001'}
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
>http://ml.libwebsockets.org/mailman/listinfo/libwebsockets




More information about the Libwebsockets mailing list