httpd_stop() hangs

steeveone
Posts: 10
Joined: Fri Jan 10, 2020 10:17 pm

httpd_stop() hangs

Postby steeveone » Fri Jan 10, 2020 10:25 pm

Hello, i need to stop an http server instance, so I have following code:

Code: Select all

static void app_prov_stop_service(void)
{

	httpd_unregister_uri(g_prov->server, "/status");
	httpd_unregister_uri(g_prov->server, "/provisioning");
	ESP_LOGI(TAG, "stopping httpd");
	if (g_prov->server)
	{	httpd_stop(g_prov->server);
		g_prov->server = NULL;
	}
	ESP_LOGI(TAG, "httpd stopped");
	[...]
this function is called inside a task triggered by a timer.
When called httpd_stop() the task hangs (do nothing) and I don't know why or how to debug...
esp continue listening on port 80 and urls get correctly unregistered.
In logs I see
I (66029) app_prov: stopping httpd
and not "http stopped".
Thanks

httpstophang
Posts: 1
Joined: Sat Mar 07, 2020 8:43 pm

Re: httpd_stop() hangs

Postby httpstophang » Sat Mar 07, 2020 8:48 pm

I had the same strange problem and after hours of debugging I found that it was some defines missing (http_server/simple example has these):

CONFIG_LWIP_NETIF_LOOPBACK=y
CONFIG_LWIP_LOOPBACK_MAX_PBUFS=1

Add this to sdkconfig and it works somehow...

Who is online

Users browsing this forum: Gaston1980, Google [Bot], Majestic-12 [Bot] and 246 guests