[Libwebsockets] lws + libuv ( mac/freebsd ), explicit_vhosts
beetle at gambler.ru
Tue Nov 29 10:31:36 CET 2016
First thing I found when trying lwsws on freebsd - error at linking.
Freebsd does not have libdl (included in std), CMakeLists.txt doesn't have
to add target_link_libraries(websockets dl). This occured when I activated
lwsws and it follows LWS_WITH_PLUGINGS. Simply commenting this line solved
After some time my testing pointed to core of problem: I can not add vhost
just after initializing libuv loop. If I add vhost before it all is ok.
Howewer its important to me to have this possibility. I can start listen
for some ports when only another instance of my daemon frees it. So maybe
is there some way to initialize but "sleep" some vhost? Then I can create
it before main cycle. Or maybe its better to provide feature of adding
vhost on working loop.
How do you do hot reload of configuration of lwsws without restart if added
new listening ports in config?
2016-11-28 23:31 GMT+02:00 Andy Green <andy at warmcat.com>:
> On November 29, 2016 4:42:02 AM GMT+08:00, Aleksey Zhukovskiy <
> beetle at gambler.ru> wrote:
> >thanx for answers, thats what I thought about libuv. My version of it
> >1.10 (seems ok?)
> If you run the libuv test server instead of your code, is it still broken?
> How about if you run lwsws?
> Both of these implement lws + libuv and don't crash here... if they don't
> crash for you either it looks like you might not be initing the libuv loop
> correctly in you code. If they do crash, can you install debuginfo for
> libuv so we can see more detail?
> If all you want is a generic server with your own protocols you can use
> lwsws out of the box with no code changes, configuring it with JSON (eg,
> multiple vhosts) and making your protocol a standalone plugin
> This model is serving https://libwebsockets.org + https://warmcat.com ,
> eg the test ws server is done entirely with protocol plugins... this is
> much cleaner, eg
> >I made new tests. I've switched off SSL, excess protocols, all
> >I do not make some connects now, dont create vhosts. I've simplified
> >names and parameters. I've built libws with switching off some
> >And I am still crashing. At first call to
> >lws_create_vhost( lwscontext, &info ) - gdb backtrace is the same I
> >This is dump of libwebsockets (freebsd, Apple is the same)
> >[2016/11/28 22:28:27:2159] NOTICE: Initial logging level 7
> >[2016/11/28 22:28:27:2159] NOTICE: Libwebsockets version: 2.1.0
> >beetle at B10.1-v2.0.0-188-ge67dfe1
> >[2016/11/28 22:28:27:2159] NOTICE: IPV6 not compiled in
> >[2016/11/28 22:28:27:2159] NOTICE: libev support not compiled in
> >[2016/11/28 22:28:27:2159] NOTICE: libuv support compiled in and
> >[2016/11/28 22:28:27:2160] NOTICE: Threads: 1 each 13950 fds
> >[2016/11/28 22:28:27:2161] NOTICE: mem: platform fd map: 111600 bytes
> >[2016/11/28 22:28:27:2161] NOTICE: Compiled with OpenSSL support
> >[2016/11/28 22:28:27:2161] NOTICE: SSL disabled: no
> >[2016/11/28 22:28:27:2161] NOTICE: mem: per-conn: 688 bytes +
> >protocol rx buf
> >[2016/11/28 22:28:27:2161] NOTICE: canonical_hostname = B10.1
> >[2016/11/28 22:28:27:2162] NOTICE: Creating Vhost 'localhost' port
> >60000, 1
> >protocols, IPv6 off
> >After clearing LWS_SERVER_OPTION_EXPLICIT_VHOSTS added two lines
> >[2016/11/28 22:29:40:3383] NOTICE: Creating Vhost 'default' port 0, 1
> >protocols, IPv6 off
> >[2016/11/28 22:29:40:3400] NOTICE: Listening on port 60815
> >but finally segfault catched us. Seems to be my vhost has some problem.
> >"Segfaulty" problem.
> >at this moment I have no more time for experiments, tomorrow will try
> >2016-11-27 23:45 GMT+02:00 Andy Green <andy at warmcat.com>:
> >> On November 28, 2016 4:22:52 AM GMT+08:00, Andy Green
> ><andy at warmcat.com>
> >> wrote:
> >> >
> >> >
> >> >On November 28, 2016 1:26:18 AM GMT+08:00, Aleksey Zhukovskiy
> >> ><beetle at gambler.ru> wrote:
> >> >>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.
> >> Well, on bsd, kqueue. Basically libuv has backends for the best
> >> event wait on the platform and converts to generic libuv events.
> >> -Andy
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libwebsockets