mDNS "already freed" errors

tve
Posts: 123
Joined: Sun Feb 15, 2015 4:33 pm

mDNS "already freed" errors

Postby tve » Tue Nov 17, 2015 1:16 pm

When I enable mDNS using SDK 1.4.1_pre7 I get "already freed" errors:

Code: Select all

  5658> ip:192.168.0.151,mask:255.255.255.0,gw:192.168.0.1
  5658> Wifi got ip:192.168.0.151,mask:255.255.255.0,gw:192.168.0.1
  5660> host_name = esp-link4
  5663> server_name = _http._tcp.local
 12525> pm open phy_2,type:2 0 0
 15254> 3fff2560 already freed
 15358> Wifi check: mode=STA status=5
 15561> 3fff2560 already freed
 15566> 3fff2560 already freed
 15870> 3fff2560 already freed
 16793> 3fff2560 already freed
 18942> 3fff2560 already freed
 30922> 3fff2560 already freed
 35222> 3fff2560 already freed
 35529> 3fff2560 already freed
 35836> 3fff2560 already freed

(The number in the left column is the milliseconds since boot.)

My code is:

Code: Select all

static bool mdns_started = false;
static struct mdns_info mdns_info;

// cannot allocate the info struct on the stack, it crashes!
static ICACHE_FLASH_ATTR
void wifiStartMDNS(struct ip_addr ip) {
  if (!mdns_started) {
    os_memset(&mdns_info, 0, sizeof(struct mdns_info));
    mdns_info.host_name = flashConfig.hostname;
    mdns_info.server_name = "http", // service name
    mdns_info.server_port = 80,     // service port
    mdns_info.ipAddr = ip.addr,
    espconn_mdns_init(&mdns_info);
    mdns_started = true;
  }
}


When my module obtains an IP address I see the following packets being sent:

Code: Select all

21:07:54.382282 IP 192.168.0.151.5353 > 224.0.0.251.5353: 0*- [0q] 4/0/0 PTR esp-link4._http._tcp.local., (Cache flush) TXT "vendor = Espressif", (Cache flush) SRV esp-link4.local.:80 0 0, (Cache flush) A 192.168.0.151 (169)
21:07:55.382276 IP 192.168.0.151.5353 > 224.0.0.251.5353: 0*- [0q] 4/0/0 PTR esp-link4._http._tcp.local., (Cache flush) TXT "vendor = Espressif", (Cache flush) SRV esp-link4.local.:80 0 0, (Cache flush) A 192.168.0.151 (169)
21:07:56.382095 IP 192.168.0.151.5353 > 224.0.0.251.5353: 0*- [0q] 4/0/0 PTR esp-link4._http._tcp.local., (Cache flush) TXT "vendor = Espressif", (Cache flush) SRV esp-link4.local.:80 0 0, (Cache flush) A 192.168.0.151 (169)
21:07:57.382107 IP 192.168.0.151.5353 > 224.0.0.251.5353: 0*- [0q] 4/0/0 PTR esp-link4._http._tcp.local., (Cache flush) TXT "vendor = Espressif", (Cache flush) SRV esp-link4.local.:80 0 0, (Cache flush) A 192.168.0.151 (169)


A few seconds later, it looks like some Android devices start querying:

Code: Select all

21:08:02.737486 IP 192.168.0.86.5353 > 224.0.0.251.5353: 0 [2q] [2n] ANY (QU)? Android.local. ANY (QU)? Android.local. (81)
21:08:02.738460 IP6 fe80::22d3:90ff:feb8:9a30.5353 > ff02::fb.5353: 0 [2q] [2n] ANY (QU)? Android.local. ANY (QU)? Android.local. (81)
21:08:02.988788 IP 192.168.0.86.5353 > 224.0.0.251.5353: 0 [2q] [2n] ANY (QM)? Android.local. ANY (QM)? Android.local. (81)
21:08:02.989288 IP6 fe80::22d3:90ff:feb8:9a30.5353 > ff02::fb.5353: 0 [2q] [2n] ANY (QM)? Android.local. ANY (QM)? Android.local. (81)
21:08:03.234398 IP 192.168.0.86.5353 > 224.0.0.251.5353: 0 [2q] [2n] ANY (QM)? Android.local. ANY (QM)? Android.local. (81)
21:08:03.234831 IP6 fe80::22d3:90ff:feb8:9a30.5353 > ff02::fb.5353: 0 [2q] [2n] ANY (QM)? Android.local. ANY (QM)? Android.local. (81)
21:08:03.487912 IP 192.168.0.86.5353 > 224.0.0.251.5353: 0*- [0q] 4/0/3 (Cache flush) PTR Android.local., (Cache flush) PTR Android.local., (Cache flush) A 192.168.0.86, (Cache flush) AAAA fe80::22d3:90ff:feb8:9a30 (246)
21:08:03.488235 IP6 fe80::22d3:90ff:feb8:9a30.5353 > ff02::fb.5353: 0*- [0q] 4/0/3 (Cache flush) PTR Android.local., (Cache flush) PTR Android.local., (Cache flush) A 192.168.0.86, (Cache flush) AAAA fe80::22d3:90ff:feb8:9a30 (246)
21:08:04.496368 IP 192.168.0.86.5353 > 224.0.0.251.5353: 0*- [0q] 4/0/3 (Cache flush) PTR Android.local., (Cache flush) PTR Android.local., (Cache flush) A 192.168.0.86, (Cache flush) AAAA fe80::22d3:90ff:feb8:9a30 (246)
21:08:04.496393 IP6 fe80::22d3:90ff:feb8:9a30.5353 > ff02::fb.5353: 0*- [0q] 4/0/3 (Cache flush) PTR Android.local., (Cache flush) PTR Android.local., (Cache flush) A 192.168.0.86, (Cache flush) AAAA fe80::22d3:90ff:feb8:9a30 (246)
21:08:06.491148 IP 192.168.0.86.5353 > 224.0.0.251.5353: 0*- [0q] 4/0/3 (Cache flush) PTR Android.local., (Cache flush) PTR Android.local., (Cache flush) A 192.168.0.86, (Cache flush) AAAA fe80::22d3:90ff:feb8:9a30 (246)
21:08:06.491494 IP6 fe80::22d3:90ff:feb8:9a30.5353 > ff02::fb.5353: 0*- [0q] 4/0/3 (Cache flush) PTR Android.local., (Cache flush) PTR Android.local., (Cache flush) A 192.168.0.86, (Cache flush) AAAA fe80::22d3:90ff:feb8:9a30 (246)

Each time I see some of the above packets go by a couple of the "already freed" errors are printed.

After that, if I try to ping the hostname.local I see the queries going out but no responses from the module:

Code: Select all

21:13:36.188441 IP6 fe80::f66d:4ff:feed:62ca.5353 > ff02::fb.5353: 0 A (QM)? esp-link4.local. (33)
21:13:36.188474 IP 192.168.0.3.5353 > 224.0.0.251.5353: 0 A (QM)? esp-link4.local. (33)
21:13:37.189762 IP6 fe80::f66d:4ff:feed:62ca.5353 > ff02::fb.5353: 0 A (QM)? esp-link4.local. (33)
21:13:37.189791 IP 192.168.0.3.5353 > 224.0.0.251.5353: 0 A (QM)? esp-link4.local. (33)
21:13:39.191325 IP6 fe80::f66d:4ff:feed:62ca.5353 > ff02::fb.5353: 0 A (QM)? esp-link4.local. (33)
21:13:39.191354 IP 192.168.0.3.5353 > 224.0.0.251.5353: 0 A (QM)? esp-link4.local. (33)


If I ping the module's IP address I get this:

Code: Select all

12 packets transmitted, 12 received, 0% packet loss, time 11015ms
rtt min/avg/max/mdev = 1.114/30.990/183.175/63.164 ms

Thus it does not look like a packet loss issue to me.

If I run mdsn-scan (linux box) the module responds very quickly:

Code: Select all

$ mdns-scan
+ esp-link4._http._tcp.local
+ h [f4:6d:04:ed:62:ca]._workstation._tcp.local
+ Xerox Phaser 6010N (03:29:95)._printer._tcp.local
+ Xerox Phaser 6010N (03:29:95)._pdl-datastream._tcp.local
+ Xerox Phaser 6010N (03:29:95)._http._tcp.local


So it looks to me like there is a problem with the memory allocation and there is a problem with responding to queries correctly.

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: mDNS "already freed" errors

Postby ESP_Faye » Wed Nov 18, 2015 5:43 pm

Hi,

Here is our lib_1.4.1_pre7 as the attachment.

Sorry that we could not duplicate your problem, please update the libs. If your problem is still unsolved, please provide your test code and test steps for debugging.

Thanks for your interest in ESP8266 !
Attachments
lib_1.4.1_pre7.zip
(806.63 KiB) Downloaded 440 times

tve
Posts: 123
Joined: Sun Feb 15, 2015 4:33 pm

Re: mDNS "already freed" errors

Postby tve » Thu Nov 19, 2015 2:17 am

FYI: I was using lib1.4.1_pre7, I will see whether I can produce a small project that exhibits the problem.
NB: The lib1.4.1_pre7 archive is missing liblwip_536.a

Who is online

Users browsing this forum: No registered users and 24 guests