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

danpf1
Posts: 14
Joined: Mon May 10, 2021 2:59 pm

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

Postby danpf1 » Fri May 10, 2024 5:45 pm

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!

liaifat85
Posts: 200
Joined: Wed Dec 06, 2023 2:46 pm

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

Postby liaifat85 » Sat May 11, 2024 3:40 pm

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.

danpf1
Posts: 14
Joined: Mon May 10, 2021 2:59 pm

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

Postby danpf1 » Sat May 11, 2024 6:01 pm

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

Jonathan2892
Posts: 45
Joined: Tue Dec 07, 2021 4:04 pm

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

Postby Jonathan2892 » Wed May 29, 2024 10:44 am

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

danpf1
Posts: 14
Joined: Mon May 10, 2021 2:59 pm

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

Postby danpf1 » Wed May 29, 2024 10:56 am

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!

Who is online

Users browsing this forum: Google [Bot] and 189 guests