Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Timeout when pulling information from Dockerhub #1516

Open
sg30000 opened this issue Apr 15, 2024 · 13 comments
Open

[Bug] Timeout when pulling information from Dockerhub #1516

sg30000 opened this issue Apr 15, 2024 · 13 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@sg30000
Copy link

sg30000 commented Apr 15, 2024

AxiosError: Network Error

20240415202642

what's the problem, thx

@dosubot dosubot bot added bug Something isn't working question Further information is requested labels Apr 15, 2024
Copy link

dosubot bot commented Apr 15, 2024

The AxiosError: Network Error you're encountering could be due to several reasons such as CORS configuration issues, incorrect base URL, network connectivity problems, the server not running, or a mismatch between HTTP and HTTPS protocols. Here are steps to troubleshoot and potentially resolve the issue:

  1. Check CORS Configuration: Make sure the server accepts requests from your Next.js app's domain by configuring the Access-Control-Allow-Origin header appropriately.

  2. Verify Base URL: Ensure the URL returned by getAgentaApiUrl() is correct and reachable. This function sets the baseURL for Axios requests, so its accuracy is crucial.

  3. Network Connectivity: Confirm that there's a stable network connection for both the client and server.

  4. Server Status: Verify that the server you're trying to reach is operational.

  5. Protocol Consistency: Ensure both your app and the server use the same protocol (HTTP or HTTPS) to avoid mixed content issues.

For Axios error handling, consider refining the error handling in your Axios interceptor for clearer feedback or debugging insights. The getAgentaApiUrl() function is crucial as it determines the base URL for Axios requests, so its output should be a string representing the server's base URL.

If you have further questions or need more assistance, feel free to ask.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@mmabrouk
Copy link
Member

Hi @sg30000 can you please provide more context on the error? When is it happening? Does it happen in cloud or when self-hosting? What are the logs in the network. Please check https://docs.agenta.ai/developer_guides/contributing/file-issue

@sg30000
Copy link
Author

sg30000 commented Apr 17, 2024

thx all for your reply , I will try again
It happened when self-hosting

@R-beep-AI
Copy link

Hi need help for this issue Thx

@aakrem
Copy link
Collaborator

aakrem commented Apr 18, 2024

@sg30000 @R-beep-AI

  1. Can you specify which OS are you using ?
  2. Can you paste in a comment the output of this command :
docker logs $(docker ps -q --latest --filter "ancestor=agenta-backend")

Would also be nice to go through the link that Mahmoud shared above so that we can better assist you!

@timiil
Copy link

timiil commented Apr 23, 2024

@sg30000 @R-beep-AI

1. Can you specify which OS are you using ?

2. Can you paste in a comment the output of this command :
docker logs $(docker ps -q --latest --filter "ancestor=agenta-backend")

Would also be nice to go through the link that Mahmoud shared above so that we can better assist you!

hello , same problem.

steps here in an ubuntu 22.04 server:

cd /home
git clone https://github.com/Agenta-AI/agenta/
cd agenta
docker compose -f "docker-compose.yml" up -d --build

open the http://0.0.0.0:80 page will be fault by cors,

docker logs $(docker ps -q --latest --filter "ancestor=agenta-backend")
INFO:     Will watch for changes in these directories: ['/app']
INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [1] using StatReload
INFO:     Started server process [8]
INFO:     Waiting for application startup.
ERROR:    Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/httpcore/_backends/anyio.py", line 114, in connect_tcp
    stream: anyio.abc.ByteStream = await anyio.connect_tcp(
  File "/usr/local/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 221, in connect_tcp
    await event.wait()
  File "/usr/local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 597, in __aexit__
    raise exceptions[0]
  File "/usr/local/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 167, in try_connect
    stream = await asynclib.connect_tcp(remote_host, remote_port, local_address)
  File "/usr/local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 1627, in connect_tcp
    await get_running_loop().create_connection(
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1050, in create_connection
    sock = await self._connect_sock(
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 961, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 500, in sock_connect
    return await fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
    yield
  File "/usr/local/lib/python3.9/site-packages/httpcore/_backends/anyio.py", line 121, in connect_tcp
    stream._raw_socket.setsockopt(*option)  # type: ignore[attr-defined] # pragma: no cover
  File "/usr/local/lib/python3.9/site-packages/anyio/_core/_tasks.py", line 119, in __exit__
    raise TimeoutError
TimeoutError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
    yield
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 262, in handle_async_request
    raise exc
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 245, in handle_async_request
    response = await connection.handle_async_request(request)
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 92, in handle_async_request
    raise exc
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 69, in handle_async_request
    stream = await self._connect(request)
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 117, in _connect
    stream = await self._network_backend.connect_tcp(**kwargs)
  File "/usr/local/lib/python3.9/site-packages/httpcore/_backends/auto.py", line 31, in connect_tcp
    return await self._backend.connect_tcp(
  File "/usr/local/lib/python3.9/site-packages/httpcore/_backends/anyio.py", line 121, in connect_tcp
    stream._raw_socket.setsockopt(*option)  # type: ignore[attr-defined] # pragma: no cover
  File "/usr/local/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/usr/local/lib/python3.9/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ConnectTimeout

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 734, in lifespan
    async with self.lifespan_context(app) as maybe_state:
  File "/usr/local/lib/python3.9/contextlib.py", line 181, in __aenter__
    return await self.gen.__anext__()
  File "/app/agenta_backend/main.py", line 56, in lifespan
    await templates_manager.update_and_sync_templates(cache=cache)
  File "/app/agenta_backend/services/templates_manager.py", line 32, in update_and_sync_templates
    templates = await retrieve_templates_from_dockerhub_cached(cache)
  File "/app/agenta_backend/services/templates_manager.py", line 86, in retrieve_templates_from_dockerhub_cached
    response = await retrieve_templates_from_dockerhub(
  File "/usr/local/lib/python3.9/site-packages/backoff/_async.py", line 151, in retry
    ret = await target(*args, **kwargs)
  File "/app/agenta_backend/services/templates_manager.py", line 143, in retrieve_templates_from_dockerhub
    response = await client.get(f"{url}/{repo_name}/tags", timeout=10)
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1757, in get
    return await self.request(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1530, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1617, in send
    response = await self._send_handling_auth(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects
    response = await self._send_single_request(request)
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1719, in _send_single_request
    response = await transport.handle_async_request(request)
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/usr/local/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectTimeout

ERROR:    Application startup failed. Exiting.

@timiil
Copy link

timiil commented Apr 23, 2024

图片

@mmabrouk
Copy link
Member

Thanks a lot @timiil for the logs!

The issue is that our backend is attempting to download the images for the templates from docker hub yet the connection is timing out. I guess where you are, the connection to docker hub is not very stable.

I have increased the timeout from 10 seconds to 90 seconds in the new release (should be online one hour or so after this commment is published). Please try pulling the latest image for agenta and deploy again, hopefully, if you have access to docker hub, then the problem would be resolved.

@mmabrouk mmabrouk changed the title [Bug] [Bug] Timeout when pulling information from Dockerhub Apr 23, 2024
@mmabrouk mmabrouk self-assigned this Apr 23, 2024
@mmabrouk
Copy link
Member

I published the new release which should fix the problem
@timiil @sg30000 @R-beep-AI can you please run:

docker compose -f docker-compose.gh.yml up -d --pull always

To pull the latest versions and deploy again. Can you please let me know if that resolves the issue. Thank you!

@timiil
Copy link

timiil commented Apr 23, 2024

I published the new release which should fix the problem @timiil @sg30000 @R-beep-AI can you please run:

docker compose -f docker-compose.gh.yml up -d --pull always

To pull the latest versions and deploy again. Can you please let me know if that resolves the issue. Thank you!

thanks for your kindly reply, but, seems the new version get a 502 bad gateway error on the startup page

图片
图片

@mmabrouk
Copy link
Member

@timiil I think you are using an old version of the docker-compose.gh.yml

Can you please download the latest version and try again:
curl -L https://raw.githubusercontent.com/agenta-ai/agenta/main/docker-compose.gh.yml -o docker-compose.gh.yml

@timiil
Copy link

timiil commented Apr 24, 2024

@timiil I think you are using an old version of the docker-compose.gh.yml

Can you please download the latest version and try again: curl -L https://raw.githubusercontent.com/agenta-ai/agenta/main/docker-compose.gh.yml -o docker-compose.gh.yml

i had rm -rf source code folder and git clone again, failed like this:
图片

@mmabrouk
Copy link
Member

@timiil We were not able to reproduce the issue. I see that you are using 192.168.1.246 and not running this on localhost. What set up are you using there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants