Page 1 of 1

ESP32S3: esp-tls couldn't get hostname, getaddrinfo returns 202

Posted: Fri May 10, 2024 5:45 pm
by danpf1
Hi,

I have a custom board with an ESP32S3 WROOM module on it.

Running wifi code I intermittently get this error:

Code: Select all

esp-tls: couldn't get hostname for :<<website>>: getaddrinfo() returns 202, addrinfo=0x0
esp-tls: Failed to open new connection
transport_base: Failed to open a new connection
HTTP_CLIENT: Connection failed, sock < 0
Getting the recent mbedtls errors I see these:

Code: Select all

Last esp error code: 0x8001
Last mbedtls failure: 0x0
I have read other posts which suggest this may be a memory problem, however before this call I checked the heap and see:

Code: Select all

 Before client open: Free heap:8009232  Internal:77495 MinFreeHeap:8005344
It seems like this should be plenty (PSRAM + Internal RAM).

Is this a memory failure? or if this is a true network error, how to solve it?

The server it's connecting to is a Google server <my site>.cloudfunctions.net.

ESP-IDF Ver 5.2.1

Thanks for your help!

Re: ESP32S3: esp-tls couldn't get hostname, getaddrinfo returns 202

Posted: Sat May 11, 2024 3:40 pm
by liaifat85
The error message esp-tls: couldn't get hostname for :<<website>>: getaddrinfo() returns 202 suggests a DNS resolution failure, meaning the ESP32S3 is unable to resolve the hostname of the server.

Re: ESP32S3: esp-tls couldn't get hostname, getaddrinfo returns 202

Posted: Sat May 11, 2024 6:01 pm
by danpf1
Thank you, that does make sense. I want to understand why though. It's a Google website so the DNS is fine. Also, it works from my ESP32S3 about half the time. (From the same location, same wifi AP, etc...).

Thanks,
Dan

Re: ESP32S3: esp-tls couldn't get hostname, getaddrinfo returns 202

Posted: Wed May 29, 2024 10:44 am
by Jonathan2892
Hi,

could you solve the problem?
I get the same error when I am connected to my WLAN, which worked just 2 days ago and I did not change anything. Today it is not working anymore with my WLAN. But it works when I use a hotspot of my phone.

So the server-address seems to be correct and the problem must have another cause...

Best

Re: ESP32S3: esp-tls couldn't get hostname, getaddrinfo returns 202

Posted: Wed May 29, 2024 10:56 am
by danpf1
Yes, I did solve it.

The end answer for my board was the power was unstable and that was only seen at the network connection.

The other things that helped mitigate it before we fixed the power stability were:

Changing TX power (re:https://github.com/espressif/arduino-esp32/issues/6767)

Changing to a WiFi 2.4GHz only network.

Now that our board's power is solid, I don't need either of the changes above. Hope that helps you!