[Libwebsockets] ERROR on binding fd

Andy Green andy at warmcat.com
Mon Nov 13 11:54:08 CET 2017



On 11/13/2017 06:36 PM, Vijay Khurdiya wrote:

> Could you please let me know having deferred destroy after 5 second ??

... IIRC the problem is around libuv / libev / libevent objects having 
an asynchronous close...

I'm not your tech support.

If you think it can or should be changed, improve it and propose a patch.

-Andy

> On Fri, Nov 10, 2017 at 9:20 PM, Vijay Khurdiya 
> <vijay.khurdiya at gmail.com <mailto:vijay.khurdiya at gmail.com>> wrote:
> 
>     Sure,i will check after debugging.
> 
>     Could you please let me know what is use of deferred destroy after 5
>     second.I was seeing problem if i have network glitch.
> 
>     Thanks
> 
>     On Fri, Nov 10, 2017 at 3:22 PM, Andy Green <andy at warmcat.com
>     <mailto:andy at warmcat.com>> wrote:
> 
> 
> 
>         On 11/10/2017 05:46 PM, Vijay Khurdiya wrote:
> 
>             OK, Thanks.
> 
>             I am having different server started on different network
>             interface on port 443. (Ex : eth0,wlan0,wlan1).By looking
>             code snippet you have shared or from git repo i couldn't
>             figure out if i will give different vhost name than it will
>             not match the condition.
> 
> 
>         You should give a unique vhost name anyway.  Because logging
>         uses the vhost name in a lot of places, if you hope to learn
>         something more specific than default / default / default why not
>         give them each a name like "wlan0" that is easy to see what is
>         going on?
> 
>             Please let me know if i am missing something to understand.
> 
>             in this case if i tried to created again vhost than i am
>             getting return NULL,which means vhost creation failed.
> 
> 
>         So... why don't you debug it and send me a patch, or let me know
>         the problem more precisely that just "why doesn't this work"?
> 
>         -Andy
> 
>             On Fri, Nov 10, 2017 at 3:05 PM, Andy Green
>             <andy at warmcat.com <mailto:andy at warmcat.com>
>             <mailto:andy at warmcat.com <mailto:andy at warmcat.com>>> wrote:
> 
> 
> 
>                  On 11/10/2017 05:21 PM, Vijay Khurdiya wrote:
> 
>                      I am creating two server in different interface but
>             i haven't
>                      given any specific vhost name.
>                      Do you see this issue due to not giving vhost name.
> 
> 
>                  Yes.  Give an info.vhost_name that is unique.
> 
>                  The vhost_name is also used to sort out when multiple
>             vhosts bind to
>                  the same socket... the vhost name should reflect the
>             external DNS name.
> 
>                  For example https://warmcat.com and
>             https://libwebsockets.org are
>                  actually running on the same machine on the same lwsws
>             instance both
>                  on :443, but there are different vhosts defined named
>             "warmcat.com <http://warmcat.com>
>                  <http://warmcat.com>" and "libwebsockets.org
>             <http://libwebsockets.org>
>                  <http://libwebsockets.org>".  lws uses SNI to figure
>             out which TLS
>                  cert to give you and which vhost to bind to depending
>             on what you
>                  told your browser.
> 
>                      I also not getting in what case it can happen ??
> 
> 
>                  At least giving unique vhost names is going to stop the
>             related
>                  diagnostic messages being a bunch of mush, right :-)
> 
>                  -Andy
> 
> 
>                      On Fri, Nov 10, 2017 at 2:39 PM, Andy Green
>             <andy at warmcat.com <mailto:andy at warmcat.com>
>                      <mailto:andy at warmcat.com <mailto:andy at warmcat.com>>
>             <mailto:andy at warmcat.com <mailto:andy at warmcat.com>
> 
>                      <mailto:andy at warmcat.com
>             <mailto:andy at warmcat.com>>>> wrote:
> 
> 
> 
>                           On 11/10/2017 04:43 PM, Vijay Khurdiya wrote:
> 
>                               I am observing one issue when I tried to do
>                      lws_vhost_destroy()
>                               following lws_vhost_create().
> 
>                               I found vhost destroy is not happening
>             completely I am
>                      getting
>                               below log.
> 
>                               lws_vhost_destroy1: listen skt from
>             default to default
> 
>                               After that if I try to create vhost than I
>             am getting
>                      below error.
> 
>                               [2017/11/09 09:39:52:2245] NOTICE:
>             Creating Vhost
>                      'default' port
>                               443, 1 protocols, IPv6 off
> 
>                               [2017/11/09 09:39:52:2279] ERR: ERROR on
>             binding fd 21
>                      to port
>                               443 (-1 98)
> 
>                               [2017/11/09 09:39:52:2283] ERR: init
>             server failed
> 
>                               [2017/11/09 09:39:52:2751] NOTICE:
>             Creating Vhost
>                      'default' port
>                               443, 1 protocols, IPv6 off
> 
>                               [2017/11/09 09:39:52:2872] ERR: ERROR on
>             binding fd 21
>                      to port
>                               443 (-1 98)
> 
>                               [2017/11/09 09:39:52:2877] ERR: init
>             server failed
> 
>                               Could you please give me hint in what I
>             case this can
>                      occur.
> 
> 
>                           Hm... the code looks like this
> 
>                                    vh->being_destroyed = 1;
> 
>                                    /*
>                                     * Are there other vhosts that are
>             piggybacking on our
>                           listen socket?
>                                     * If so we need to hand the listen
>             socket off to
>                      one of
>                           the others
>                                     * so it will remain open.  If not,
>             leave it
>                      attached to
>                           the closing
>                                     * vhost and it will get closed.
>                                     */
> 
>                                    if (vh->lserv_wsi)
>                                            lws_start_foreach_ll(struct
>             lws_vhost *, v,
>                                                               
>               context->vhost_list) {
>                                                    if (v != vh &&
>                                                       
>             !v->being_destroyed &&
>                                                        v->listen_port ==
>                      vh->listen_port &&
>                                                        ((!v->iface &&
>             !vh->iface) ||
>                                                        (v->iface &&
>             vh->iface &&
>                                                        !strcmp(v->iface,
>             vh->iface)))) {
>                                                            /*
>                                                             * this can
>             only be a
>                      listen wsi,
>                           which is
>                                                             *
>             restricted... it has no
>                      protocol
>                           or other
>                                                             * bindings
>             or states.  So
>                      we can
>                           simply
>                                                             * swap it to
>             a vhost that
>                      has the same
>                                                             * iface +
>             port, but is
>                      not closing.
>                                                             */
>                                                           
>             assert(v->lserv_wsi == NULL);
>                                                            v->lserv_wsi
>             = vh->lserv_wsi;
>                                                            vh->lserv_wsi
>             = NULL;
>                                                            if (v->lserv_wsi)
>                                                                         
>               v->lserv_wsi->vhost = v;
> 
>                                                           
>             lwsl_notice("%s: listen
>                      skt from %s
>                           to %s\n",
>                                                                       
>             __func__,
>                      vh->name,
>                           v->name);
>                                                            break;
>                                                    }
>                                            } lws_end_foreach_ll(v,
>             vhost_next);
> 
> 
>                           but it says
> 
>                           listen skt from default to default
> 
>                           have you possibly created more than one vhost
>             called "default"?
> 
>                           -Andy
> 
> 
> 
>                              
>             _______________________________________________
>                               Libwebsockets mailing list
>             Libwebsockets at ml.libwebsockets.org
>             <mailto:Libwebsockets at ml.libwebsockets.org>
>                      <mailto:Libwebsockets at ml.libwebsockets.org
>             <mailto:Libwebsockets at ml.libwebsockets.org>>
>                               <mailto:Libwebsockets at ml.libwebsockets.org
>             <mailto:Libwebsockets at ml.libwebsockets.org>
>                      <mailto:Libwebsockets at ml.libwebsockets.org
>             <mailto:Libwebsockets at ml.libwebsockets.org>>>
>             https://libwebsockets.org/mailman/listinfo/libwebsockets
>             <https://libwebsockets.org/mailman/listinfo/libwebsockets>
>                     
>             <https://libwebsockets.org/mailman/listinfo/libwebsockets
>             <https://libwebsockets.org/mailman/listinfo/libwebsockets>>
>                                     
>             <https://libwebsockets.org/mailman/listinfo/libwebsockets
>             <https://libwebsockets.org/mailman/listinfo/libwebsockets>
>                     
>             <https://libwebsockets.org/mailman/listinfo/libwebsockets
>             <https://libwebsockets.org/mailman/listinfo/libwebsockets>>>
> 
> 
> 
> 
> 



More information about the Libwebsockets mailing list