-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Enabling mDNS causes hang, then reboot of Teensy 4.1 #23
Comments
Shortly after posing this I continued my due diligence in trying to track the problem down and may have found it. I was originally testing on a very busy university LAN. There's close to 1000 machines on this subnet, and over 50 different mDNS services being advertised, many with dozens of hosts per service. In an effort to better debug this, I direct attached the Teensy to the second ethernet on my workstation, fired up dnsmasq on that port (for DHCP and DNS I control), started Wireshark to see what was going on, and the problem went away! I suspect that the heavy mDNS traffic eventually ran the Teensy out of memory trying to keep track of so many machines/services coming and going. I'm currently only announcing presence of my service, but may want to later add finding the client via mDNS. Is there a way to tell the mDNS server to ignore all service types except the ones I'm interested in? Filtering/ignoring irrelevant services seems a necessity for memory constrained systems like microcontrollers. A method like subscribeService() or some such mechanism to only track services of interest is likely going to be a necessity for many situations. |
The mDNS code does not allocate any more memory by itself no matter how many clients try to send to it since it does not store anything about said clients. That being said, if there is a ton of network traffic it may be running out of memory in the stack, there's no way around that if it's happening before it reaches the mDNS server. As far as the stack knows everything coming into the mDNS port is valid data that you want which it very well could be. You can easily check FNET's stack size every so often in your code, if there are any memory leaks in the stack you will see it start to dwindle. Serial.printf("FNET_Free: %d FNET_Max: %d \n", fnet_free_mem_status(), fnet_malloc_max());
Serial.send_now(); |
Memory leaks didn't seem to be the issue as memory use seemed more or less stable, but moving the Teensy to an isolate network stopped the crashing. There's quite a bit of hash on the public network fuzzing away at the FNET stack, so maybe the problem is there. Once I get out from under this deadline, I'm going to dig into it deeper by capturing traffic until it crashes, then try drip feeding the capture back until I can isolate whats causing the crash. If it's in FNET, I'll follow up with a closing comment and take the issue over there. Thanks for getting back so quickly. |
I have the exact same issue, however it's at home so the network is much smaller than a University. Were you able to investigate this further ? |
Also I tested with the lines you suggested to check free memory and there doesn't seem to be a leak so it's probably blocking somewhere... |
I have not had a chance to look deeper into it, although it would be fairly easy to set up. What would be useful is a mechanism to detect the crash so I can stop Wireshark. Captures on this network get very big, very fast. |
I'm putting together a device that reads two ADCs (simultaneous sampling) and sends the values over TouchOSC. I originally had all the networking stuff worked out on the esp32, but switched to the Teensy because of more flexible SPI hardware, plus availability of the esp32 boards with onboard ethernet wasn't great so it looked like getting them wouldn't meet my deadline.
I stripped my original code down to the bare minimum.
The number of iterations before the hang varies, and occasionally it won't reboot at all, requiring manual intervention.
The text was updated successfully, but these errors were encountered: