ESP8266 Developer Zone The Official ESP8266 Forum 2015-11-19T02:17:17+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=1395 2015-11-19T02:17:17+08:00 2015-11-19T02:17:17+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1395&p=4655#p4655 <![CDATA[Re: mDNS "already freed" errors]]> NB: The lib1.4.1_pre7 archive is missing liblwip_536.a

Statistics: Posted by tve — Thu Nov 19, 2015 2:17 am


]]>
2015-11-18T17:43:30+08:00 2015-11-18T17:43:30+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1395&p=4648#p4648 <![CDATA[Re: mDNS "already freed" errors]]>
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 !
lib_1.4.1_pre7.zip

Statistics: Posted by ESP_Faye — Wed Nov 18, 2015 5:43 pm


]]>
2015-11-17T13:16:56+08:00 2015-11-17T13:16:56+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1395&p=4628#p4628 <![CDATA[mDNS "already freed" errors]]>

Code:

  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:

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:

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:

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:

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:

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:

$ 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.

Statistics: Posted by tve — Tue Nov 17, 2015 1:16 pm


]]>