espressif / idf-component-manager

Tool for installing ESP-IDF components
https://components.espressif.com/
Apache License 2.0
45 stars 16 forks source link

Build with component manager fails because the API address cannot be resolved (PACMAN-699) #41

Closed M-Bab closed 1 year ago

M-Bab commented 1 year ago

Answers checklist.

IDF version.

v4.4.4

Operating System used.

Linux

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

None

What is the expected behavior?

I expected to be able to build an idf project with idf.py and added managed components.

What is the actual behavior?

On some systems the build fails because the domain name of api.components.espressif.com cannot be resolved. I have actually no idea why this only fails on our CI machines (see log below) because the address can not be resolved anywhere:

> drill -Q api.components.espressif.com
> drill -Q api.components.espressif.com @8.8.8.8
> drill -Q api.components.espressif.com @9.9.9.9
> drill -Q components.espressif.com
16.162.213.162
18.166.114.217
> drill -Q components.espressif.com @8.8.8.8
16.162.213.162
18.166.114.217
> drill -Q components.espressif.com @9.9.9.9
16.162.213.162
18.166.114.217

Unlike api.components.espressif.com the parent address components.espressif.com can be resolved.

Our CI docker works with ESP-IDF version v4.4.3 locally I work with v4.4.4 and I am aware that v4.4.5 is available. But neither should this have a large impact on the managed components nor did I find any note about changes there in the release notes.

Steps to reproduce.

  1. Try to build a project with idf.py and managed components enabled. But the managed components are not available locally or cached.

Build or installation Logs.

$ echo Building APP
Building APP
$ idf.py build
-- Found Git: /usr/bin/git (found version "2.25.1") 
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/builder/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
-- Check for working C compiler: /home/builder/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
-- Check for working C compiler: /home/builder/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/builder/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++
-- Check for working CXX compiler: /home/builder/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32
Solving dependencies requirements
CMake Error at /home/builder/esp/esp-idf/tools/cmake/build.cmake:452 (message):
  Traceback (most recent call last):
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/urllib3/connection.py", line 174, in _new_conn
      conn = connection.create_connection(
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/urllib3/util/connection.py", line 72, in create_connection
      for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
    File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
      for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
  socket.gaierror: [Errno -5] No address associated with hostname

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/urllib3/connectionpool.py", line 703, in urlopen
      httplib_response = self._make_request(
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/urllib3/connectionpool.py", line 386, in _make_request
      self._validate_conn(conn)
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
      conn.connect()
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/urllib3/connection.py", line 358, in connect
      self.sock = conn = self._new_conn()
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/urllib3/connection.py", line 186, in _new_conn
      raise NewConnectionError(
  urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection
  object at 0x7f7f7de974c0>: Failed to establish a new connection: [Errno -5]
  No address associated with hostname

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/requests/adapters.py", line 489, in send
      resp = conn.urlopen(
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/urllib3/connectionpool.py", line 815, in urlopen
      return self.urlopen(
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/urllib3/connectionpool.py", line 815, in urlopen
      return self.urlopen(
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/urllib3/connectionpool.py", line 815, in urlopen
      return self.urlopen(
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/urllib3/connectionpool.py", line 787, in urlopen
      retries = retries.increment(
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/urllib3/util/retry.py", line 592, in increment
      raise MaxRetryError(_pool, url, error or ResponseError(cause))
  urllib3.exceptions.MaxRetryError:
  HTTPSConnectionPool(host='api.components.espressif.com', port=443): Max
  retries exceeded with url: /components/espressif/json_generator/ (Caused by
  NewConnectionError('<urllib3.connection.HTTPSConnection object at
  0x7f7f7de974c0>: Failed to establish a new connection: [Errno -5] No
  address associated with hostname'))

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/idf_component_tools/api_client.py", line 158, in _base_request
      response = self.session.request(
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/requests/sessions.py", line 587, in request
      resp = self.send(prep, **send_kwargs)
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/requests/sessions.py", line 701, in send
      r = adapter.send(request, **kwargs)
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/requests/adapters.py", line 565, in send
      raise ConnectionError(e, request=request)
  requests.exceptions.ConnectionError:
  HTTPSConnectionPool(host='api.components.espressif.com', port=443): Max
  retries exceeded with url: /components/espressif/json_generator/ (Caused by
  NewConnectionError('<urllib3.connection.HTTPSConnection object at
  0x7f7f7de974c0>: Failed to establish a new connection: [Errno -5] No
  address associated with hostname'))

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
      return _run_code(code, main_globals, None,
    File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
      exec(code, run_globals)
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/idf_component_manager/prepare_components/__main__.py", line 3, in <module>
      main()
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/idf_component_manager/prepare_components/prepare.py", line 126, in main
      args.func(args)
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/idf_component_manager/prepare_components/prepare.py", line 39, in prepare_dep_dirs
      ComponentManager(args.project_dir).prepare_dep_dirs(
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/idf_component_manager/core.py", line 404, in prepare_dep_dirs
      downloaded_component_paths = download_project_dependencies(
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/idf_component_manager/dependencies.py", line 99, in download_project_dependencies
      solution = solver.solve()
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/idf_component_manager/version_solver/version_solver.py", line 29, in solve
      self.solve_manifest(manifest)
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/idf_component_manager/version_solver/version_solver.py", line 48, in solve_manifest
      self.solve_component(requirement)
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/idf_component_manager/version_solver/version_solver.py", line 51, in solve_component
      cmp_with_versions = requirement.source.versions(
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/idf_component_tools/sources/web_service.py", line 95, in versions
      cmp_with_versions = self.api_client.versions(name, spec, target)
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/idf_component_tools/api_client.py", line 196, in versions
      body = self._base_request(
    File "/home/builder/.espressif/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/idf_component_tools/api_client.py", line 178, in _base_request
      raise APIClientError('HTTP request error')
  idf_component_tools.api_client_errors.APIClientError: HTTP request error
Call Stack (most recent call first):
  /home/builder/esp/esp-idf/tools/cmake/project.cmake:384 (idf_build_process)
  CMakeLists.txt:6 (project)
-- Configuring incomplete, errors occurred!
See also "/builds/hf/gui-embedded/build/CMakeFiles/CMakeOutput.log".
Executing action: all (aliases: build)
Running cmake in directory /builds/hf/gui-embedded/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DIDF_TARGET=esp32 -DCCACHE_ENABLE=0 /builds/hf/gui-embedded"...
cmake failed with exit code 1
Cleaning up project directory and file based variables 00:01
ERROR: Job failed: exit code 1

More Information.

No response

kumekay commented 1 year ago

@M-Bab Thank you for opening the issue, it was caused by a mistake in DNS configuration, It should be fixed now.

$ nslookup api.components.espressif.com                                                                                                                                         
Server:     8.8.8.8
Address:    8.8.8.8#53

Non-authoritative answer:
Name:   api.components.espressif.com
Address: 18.166.114.217
Name:   api.components.espressif.com
Address: 16.162.213.162
M-Bab commented 1 year ago

Thanks for the fast reaction! Works well again.