[Libwebsockets] lws + libuv ( mac/freebsd ), explicit_vhosts

Andy Green andy at warmcat.com
Sun Nov 27 21:22:52 CET 2016



On November 28, 2016 1:26:18 AM GMT+08:00, Aleksey Zhukovskiy <beetle at gambler.ru> wrote:
>Hi all,
>I've got working soft, using pure libwebsockets for HTTP-serving,
>ws-serving, HTTP- and websocket- clients. Using
>LWS_SERVER_OPTION_EXPLICIT_VHOSTS

OK.

>Now Im trying to plug libuv _only_ for better perfomance.
>There are problems when creating second vhost (for listening
>ssl-websockets). Segmentation fault at freebsd/mac on. gdb shows
>
>#0  0x000000080112d8fc in uv_fileno () from /usr/local/lib/libuv.so.1

Is there any interesting lws logging before this?

>#1  0x00000008011329bc in uv_poll_start () from
>/usr/local/lib/libuv.so.1
>#2  0x0000000800895391 in lws_libuv_io (wsi=0x8037e0200, flags=5) at
>/home/beetle/lws/libwebsockets/lib/libuv.c:332
>#3  0x000000080088ad97 in lws_plat_insert_socket_into_fds
>(context=0x8033eb000, wsi=0x8037e0200)
>    at /home/beetle/lws/libwebsockets/lib/lws-plat-unix.c:566
>#4  0x0000000800874a64 in insert_wsi_socket_into_fds
>(context=0x8033eb000,
>wsi=0x8037e0200)
>    at /home/beetle/lws/libwebsockets/lib/pollfd.c:163
>#5  0x000000080088b68b in lws_context_init_server (info=0x647a20,
>vhost=0x80392a200) at /home/beetle/lws/libwebsockets/lib/server.c:156
>#6  0x000000080087bb1a in lws_create_vhost (context=0x8033eb000,
>info=0x647a20) at /home/beetle/lws/libwebsockets/lib/context.c:512
>
>I tried different parameters, the same. I dont understand last two
>calls,
>cant find proper sources. Should I dig deeper or maybe before it you
>can
>help with only 2 questions
>
>1. It there a reason to use libuv/ev for better perfomance at all?

Yes, it will use epoll() rather than poll().  If you have many connections, this is faster.

>2. Between these two should I choose libev because it was tested
>better and embedded
>in a larger number of projects?

Actually uv is preferred here... lwsws the lws web server requires it, and since I run my web services on it for a long time now, I am very sensitive to problems.  Since it runs a dozen vhosts listening on multiple ports using libuv, I'm pretty confident no general problem with this.

One thing libuv has a long history, older libuv has important things missing.  Maybe check your libuv is reasonably recent.

-Andy

>Thank you for answers,
>and for lws specially
>Alex
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
>http://libwebsockets.org/mailman/listinfo/libwebsockets




More information about the Libwebsockets mailing list