Repository navigation
Three 3.x migration traps that cost a compile (FS namespace, NTPClient, DNS cache lock) #13057
Esmail-sarhadi
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Three things that bite when moving a project to arduino-esp32 3.x. Each one produces an error message that points at the wrong place, so they are worth collecting.
1.
FSmoved into thefsnamespaceWebServer.h,ESPmDNS.handHTTPClient.hall expectFS.hto have been included before them - that is what bringsusing namespace fs;into scope. If a translation unit includesWebServer.hfirst, the core's own header fails, not the user's code.Fix, in that file or in the header that declares the class:
The error names
WebServer.h, which makes it look like a core bug rather than a missing include in your file.2.
NTPClienttakes a reference, not a pointerNTPClient 3.2 changed the constructor to
NTPClient(UDP& udp, const char* poolServerName = "pool.ntp.org", long timeOffset = 0, unsigned long updateInterval = 60000);. Every 3.1-era example that passesWiFiUDP*now fails.3. The DNS cache is cleared without the TCPIP lock
This one is a runtime crash rather than a compile error, so it is here as a warning rather than a fix:
NetworkManager::hostByName()callsdns_clear_cache()from the caller's task when it notices the IPv4/IPv6 state changed.dns_clear_cache()runs every pending lookup's callback on that thread, and lwIP expects them on the tcpip thread.The symptom is an assert in
udp_new_ip_typeor a crash right after a reconnect, most often when SNTP has a lookup in flight during a Wi-Fi state change. Tracked in #13055 with a proposedtcpip_callback()fix.If you hit it before that lands: keep SNTP from starting until the first connection has settled, so the lookup is not in flight when the interface state changes.
If there is a canonical place for "3.x migration notes" beyond the migration guide, this would be a good start for it. Add anything else that belongs in the list.
All reactions