[Libwebsockets] ERROR on binding fd

Andy Green andy at warmcat.com
Fri Nov 10 10:09:14 CET 2017



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
> https://libwebsockets.org/mailman/listinfo/libwebsockets
> 



More information about the Libwebsockets mailing list