[Libwebsockets] Failed to create default vhost

Andy Green andy at warmcat.com
Thu Nov 17 13:02:25 CET 2016


On Thu, 2016-11-17 at 07:00 +0800, Andy Green wrote:
> 
> On November 17, 2016 1:52:49 AM GMT+08:00, satya gowtham kudupudi <sa
> tyagowtham.k at gmail.com> wrote:
> > b(my code) is working when the libwebsockets library is 6 months
> > old.
> > now
> > I've deployed my server 'b' on new ubuntu machine with latest
> > libwebsocktes
> > pulled from GitHub.
> > 
> > my server runs in a thread. It worked with the old library. what i
> > did
> > is I
> > have renamed the main function of test-server.c to int WSServer()
> > and
> > from
> > my new main function I am doing new Thread(WSServer,args). I swear
> > this
> > worked well with old libwebsockets but broken in new libwebsockets.
> > 
> > Please give me any suggestions.
> 
> README.coding.md:
> 
> @section evtloop Libwebsockets is singlethreaded
> 
> Libwebsockets works in a serialized event loop, in a single thread.
> 
> Directly performing websocket actions from other threads is not
> allowed. Aside from the internal data being inconsistent in forked()
> processes, the scope of a wsi (struct websocket) can end at any time
> during service with the socket closing and the wsi freed.
> 
> 
> What you seem to be doing is calling the service functions of lws
> somehow before the vhost init is complete.  I dunno why or how.
> 
> Anyway - THIS IS YOUR PROBLEM, NOT MINE.  If you can explain
> something that is an lws problem, I will be happy to look at it.

So you solved this on your side or what?

You are bothering > 100 people with your "needs" when you post here,
it's a normal level of courtesy to explain to them how your issue you
bothered them with turned out.

-Andy

> -Andy
> 
> > Thank you
> > gowtham
> > 
> > On Wed, Nov 16, 2016 at 10:39 PM, Andy Green <andy at warmcat.com>
> > wrote:
> > 
> > > 
> > > 
> > > On November 16, 2016 10:58:22 PM GMT+08:00, satya gowtham
> > > kudupudi <
> > > satyagowtham.k at gmail.com> wrote:
> > > > Hi,
> > > > 
> > > > I have pulled and installed latest libwebsockets. made changes
> > > > to my
> > > > server
> > > > according to the latest test-server.c
> > > > 
> > > > when I ran my  server.c i am having following errors
> > > > 
> > > > lwsts[6144]: libwebsockets echo test - (C) Copyright 2010-2013
> > > > Andy
> > > > Green <
> > > > andy at warmcat.com> - licensed under LGPL2.1
> > > > 
> > > > lwsts[6144]: Running in server mode
> > > > 
> > > > lwsts[6144]: Initial logging level 65535
> > > > 
> > > > lwsts[6144]: Libwebsockets version: 2.0.3
> > > 
> > > When you say 'latest libwebsockets' you mean v2.0-stable, is it?
> > > 
> > > > gowtham at ubuntu-v2.0.2-31-gb40c0b8
> > > > 
> > > > lwsts[6144]: IPV6 not compiled in
> > > > 
> > > > lwsts[6144]: libev support not compiled in
> > > > 
> > > > lwsts[6144]: libuv support not compiled in
> > > > 
> > > > lwsts[6144]:  LWS_DEF_HEADER_LEN    : 1024
> > > > 
> > > > lwsts[6144]:  LWS_MAX_PROTOCOLS     : 5
> > > > 
> > > > lwsts[6144]:  LWS_MAX_SMP           : 32
> > > > 
> > > > lwsts[6144]:  SPEC_LATEST_SUPPORTED : 13
> > > > 
> > > > lwsts[6144]:  sizeof (*info)        : 280
> > > > 
> > > > lwsts[6144]:  SYSTEM_RANDOM_FILEPATH: '/dev/urandom'
> > > > 
> > > > lwsts[6144]:  default timeout (secs): 5
> > > > 
> > > > lwsts[6144]:  Threads: 1 each 1024 fds
> > > > 
> > > > lwsts[6144]:  mem: context:          9512 bytes (5416 ctx + (1
> > > > thr x
> > > > 4096))
> > > > 
> > > > lwsts[6144]:  mem: http hdr rsvd:   68224 bytes (1 thr x (1024
> > > > +
> > 
> > 3240)
> > > > x
> > > > 16))
> > > > 
> > > > lwsts[6144]:  mem: pollfd map:       8192
> > > > 
> > > > lwsts[6144]:  mem: platform fd map:  8192 bytes
> > > > 
> > > > lwsts[6144]:  Compiled with OpenSSL support
> > > > 
> > > > lwsts[6144]:  SSL disabled: no
> > > > LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT
> > > > 
> > > > lwsts[6144]: Creating Vhost 'default' port 80, 2 protocols
> > > > 
> > > > lwsts[6144]: insert_wsi_socket_into_fds: 0x7f86a0017ab0: tsi=0,
> > 
> > sock=7,
> > > > pos-in-fds=1
> > > 
> > > Hm.
> > > 
> > > What about if you run the test server without any changes?  That
> > 
> > doesn't
> > > do this then?
> > > 
> > > > lwsts[6144]: lws_http_transaction_completed: wsi 0x7f86a0017ab0
> > > 
> > > Have you done something with threads?
> > > 
> > > > lwsts[6144]: lws_http_transaction_completed: 0x7f86a0017ab0:
> > > > close
> > > > connection
> > > > 
> > > > lwsts[6144]: Failed to create default vhost
> > > > 
> > > > lwsts[6144]: libwebsocket init failed
> > > > 
> > > > Any help is much appreciated
> > > 
> > > If the unchanged test server is also broken, try change the
> > > listen
> > 
> > port to
> > > 81 and see if acts the same way.
> > > 
> > > If
> > > 
> > >  - the unchanged test server works ok
> > > 
> > >  - your changed version breaks
> > > 
> > >  - you are the only guy with the changes
> > > 
> > > then
> > > 
> > >  - why are you asking me?
> > > 
> > >  - it's your job to debug your code
> > > 
> > >  - since you have a working 'a' (unchanged test server) and a
> > > broken
> > 
> > 'b'
> > > (your code), and the diff, you can identify what breaks it by
> > 
> > restarting at
> > > 'a' version and adding back the diff piece by piece until it
> > > breaks
> > > 
> > > If there's a better question to ask then, like "when I do xxx I
> > > break
> > > vhost init", I might stand a chance.
> > > 
> > > -Andy
> > > 
> > > > --
> > > > Gowtham
> > > > 
> > > > 
> > > 
> > > ---------------------------------------------------------------
> > > ---------
> > > > 
> > > > _______________________________________________
> > > > Libwebsockets mailing list
> > > > Libwebsockets at ml.libwebsockets.org
> > > > http://libwebsockets.org/mailman/listinfo/libwebsockets
> > > 
> > > 



More information about the Libwebsockets mailing list