[Libwebsockets] lws_serve_http_file()

Srikar Vadlamani SrikarVadlamani at trafficware.com
Thu Jan 28 21:09:14 CET 2016


Test server also crashes, when libev and ssl are enabled, here is the core dump

Core was generated by `./libwebsockets-test-server --resource_path=/opt/naztec/cxu/ssl/conf -e -s'.
Program terminated with signal 11, Segmentation fault.
#0  0x00000000 in ?? ()
(gdb) bt full
#0  0x00000000 in ?? ()
No symbol table info available.
#1  0x1000216c in test_server_fops_open ()
No symbol table info available.
#2  0x0ffda754 in lws_plat_file_open (wsi=0x1004bac0, filename=0x7fc968dc "/opt/naztec/cxu/ssl/conf/test.html", filelen=0x1004bb5c, flags=0) at /home/srikar/target/libwebsockets-v1.6-stable/lib/libwebsockets.h:1620
No locals.
#3  0x0ffda470 in lws_serve_http_file (wsi=0x1004bac0, file=0x7fc968dc "/opt/naztec/cxu/ssl/conf/test.html", content_type=0x10003d1c "text/html", other_headers=0x0, other_headers_len=0)
    at /home/srikar/target/libwebsockets-v1.6-stable/lib/server.c:921
        context = (struct lws_context *) 0x10016010
        response = (
    unsigned char *) 0x10016218 " 192.168.103.158:7681\r\nConnection: keep-alive\r\nCache-Control: max-age=0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\r\nUpgrade-Insecure-Requests: 1\r\nUser-Agent: M"...
        p = (
    unsigned char *) 0x10016218 " 192.168.103.158:7681\r\nConnection: keep-alive\r\nCache-Control: max-age=0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\r\nUpgrade-Insecure-Requests: 1\r\nUser-Agent: M"...
        end = (unsigned char *) 0x10017204 ""
        ret = 0
#4  0x10002d78 in callback_http ()
No symbol table info available.
#5  0x0ffd9330 in lws_http_action (wsi=0x30) at /home/srikar/target/libwebsockets-v1.6-stable/lib/server.c:304
        connection_type = 1835794432
        request_version = 1949198452
        content_length_str = "\000\000\000\b\020\002kl\177▒j<B\000BB\017▒▒▒\177▒iT\000\000\000\203\020\002~\206"
        n = 796157299
        count = 1668247142
        http_version_str = "\177▒k<\000\000\000\000\017▒"
        http_conn_str = "▒▒\000\000\000\200\177▒i▒\017▒V\230\000\000\000\000\000"
        http_version_len = 1936944175
        uri_ptr = 0x6378752f <Address 0x6378752f out of bounds>
        uri_len = 1952801583
        methods = {0 '\0', 1 '\001', 2 '\002', 74 'J', 73 'I', 75 'K'}
        method_names = {0xffddce0 "GET", 0xffddce4 "POST", 0xffddcec "OPTIONS", 0xffddcf4 "PUT", 0xffddcf8 "PATCH", 0xffddd00 "DELETE"}
#6  0x0ffd95ec in lws_handshake_server (wsi=0x1004bac0, buf=0x7fc970ac, len=0) at /home/srikar/target/libwebsockets-v1.6-stable/lib/server.c:399
        context = (struct lws_context *) 0x10016010
        ah = (struct allocated_headers *) 0x1004bcc0
        protocol_len = 18432
        n = 268741984
        hit = 2143907792
        protocol_list = "\000\000\000\027\017▒▒\020\000\000\001▒\177▒pp\017▒CT\000\000\000\020\017▒ڼ\177▒o▒\000\000\000\003\000\000\000 \017▒▒\220\177▒p\b\020▒▒\227\017▒fP\177▒p\000\177▒p\220\017▒▒▒\002\000\000\000\177▒p\230\177▒p\030\020\000:\230\000\000\000 \020\001\000\000\000\000\001▒\000\000\001▒\000\000\000\030\000\000\000\b\017▒۠\n\r\nA\017▒i▒\177▒p@\177▒p▒"
        protocol_name = "\017▒▒▒\002\000\000\001\177▒p▒\177▒pX\020\001A▒\000\000\000\020\020\001\000\000\017▒▒▒"
        p = 0xc85f49a8 <Address 0xc85f49a8 out of bounds>
        __PRETTY_FUNCTION__ = "lws_handshake_server"
        __func__ = "lws_handshake_server"
#7  0x0ffcdbd4 in lws_read (wsi=0x1004bac0, buf=0x100163c2 "", len=446) at /home/srikar/target/libwebsockets-v1.6-stable/lib/handshake.c:107
        last_char = (
    unsigned char *) 0x10016204 "ET / HTTP/1.1\r\nHost: 192.168.103.158:7681\r\nConnection: keep-alive\r\nCache-Control: max-age=0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\r\nUpgrade-Insecure-Reques"...
        body_chunk_len = 268526084
        n = 2143908000
        __func__ = "lws_read"
#8  0x0ffd9fd4 in lws_server_socket_service (context=0x10016010, wsi=0x1004bac0, pollfd=0x10018818) at /home/srikar/target/libwebsockets-v1.6-stable/lib/server.c:756
        accept_fd = -1
        cli_addr = {sin_family = 2, sin_port = 62854, sin_addr = {s_addr = 3232262017}, sin_zero = {127 '\177', 201 '▒', 113 'q', 0 '\0', 0 '\0', 0 '\0', 0 '\0', 0 '\0'}}
        clilen = 16

-----Original Message-----
From: Andy Green [mailto:andy.green at linaro.org] On Behalf Of Andy Green
Sent: Thursday, January 28, 2016 11:41 AM
To: Srikar Vadlamani <SrikarVadlamani at trafficware.com>; libwebsockets at ml.libwebsockets.org
Subject: RE: [Libwebsockets] lws_serve_http_file()



On January 29, 2016 1:32:18 AM GMT+08:00, Srikar Vadlamani <SrikarVadlamani at trafficware.com> wrote:
>The test server doesn’t crash, how to build the library with debug 
>enabled to see where it is crashing?

It's mentioned in README.build.md now

NOTE5: To build with debug info and _DEBUG for lower priority debug messages compiled in, use

$ cmake .. -DCMAKE_BUILD_TYPE=DEBUG

Then set lws debug level to, eg, 79 or 65535 for everything.

>I have gdb on my application and I know it is crashing in 
>lws_serve_http_file().
>All the inputs to the function look good.

The test server uses it to serve several things, it means something that has no problem.  But it could just mean it's not enough to trigger our bug.  So a backtrace will be interesting.

-Andy

>
>-----Original Message-----
>From: Andy Green [mailto:andy.green at linaro.org] On Behalf Of Andy Green
>Sent: Tuesday, January 26, 2016 6:15 PM
>To: Srikar Vadlamani <SrikarVadlamani at trafficware.com>;
>libwebsockets at ml.libwebsockets.org
>Subject: Re: [Libwebsockets] lws_serve_http_file()
>
>
>
>On January 27, 2016 6:25:27 AM GMT+08:00, Srikar Vadlamani 
><SrikarVadlamani at trafficware.com> wrote:
>>I just updated to 1.6.2 and serving a file using lws_serve_http_file()
>
>>is crashing,
>>
>>
>>
>>In the documentation I did not see any difference in the way it should
>
>>be used, any ideas?
>
>Does the test server crash?
>
>Can you stick gdb on it and get a backtrace?
>
>-Andy
>
>>
>>
>>Srikar
>>
>>
>>
>>----------------------------------------------------------------------
>>-
>>-
>>
>>_______________________________________________
>>Libwebsockets mailing list
>>Libwebsockets at ml.libwebsockets.org
>>http://ml.libwebsockets.org/mailman/listinfo/libwebsockets



More information about the Libwebsockets mailing list