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]: Task celery_worker.process_integration_brain_sync[5304c7fe-c2d3-4267-934a-61d2b14fcf81] raised unexpected: ConnectError('[Errno -2] Name or service not known') #2401

Open
chen-42 opened this issue Apr 2, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@chen-42
Copy link

chen-42 commented Apr 2, 2024

What happened?

A bug happened!

Relevant log output

beat          | [2024-04-02 07:15:00,014: INFO/MainProcess] Scheduler: Sending due task process_integration_brain_sync (celery_worker.process_integration_brain_sync)
worker        | [2024-04-02 07:15:00,058: INFO/MainProcess] Task celery_worker.process_integration_brain_sync[5304c7fe-c2d3-4267-934a-61d2b14fcf81] received
worker        | [2024-04-02 07:15:05,315: ERROR/ForkPoolWorker-2] Task celery_worker.process_integration_brain_sync[5304c7fe-c2d3-4267-934a-61d2b14fcf81] raised unexpected: ConnectError('[Errno -2] Name or service not known')
worker        | Traceback (most recent call last):
worker        |   File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 66, in map_httpcore_exceptions
worker        |     yield
worker        |   File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 228, in handle_request
worker        |     resp = self._pool.handle_request(req)
worker        |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
worker        |   File "/usr/local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 216, in handle_request
worker        |     raise exc from None
worker        |   File "/usr/local/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 196, in handle_request
worker        |     response = connection.handle_request(
worker        |                ^^^^^^^^^^^^^^^^^^^^^^^^^^
worker        |   File "/usr/local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 99, in handle_request
worker        |     raise exc
worker        |   File "/usr/local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 76, in handle_request
worker        |     stream = self._connect(request)
worker        |              ^^^^^^^^^^^^^^^^^^^^^^
worker        |   File "/usr/local/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 122, in _connect
worker        |     stream = self._network_backend.connect_tcp(**kwargs)
worker        |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
worker        |   File "/usr/local/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 205, in connect_tcp
worker        |     with map_exceptions(exc_map):
worker        |   File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__
worker        |     self.gen.throw(typ, value, traceback)
worker        |   File "/usr/local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
worker        |     raise to_exc(exc) from exc
worker        | httpcore.ConnectError: [Errno -2] Name or service not known
worker        |
worker        | The above exception was the direct cause of the following exception:
worker        |
worker        | Traceback (most recent call last):
worker        |   File "/usr/local/lib/python3.11/site-packages/celery/app/trace.py", line 477, in trace_task
worker        |     R = retval = fun(*args, **kwargs)
worker        |                  ^^^^^^^^^^^^^^^^^^^^
worker        |   File "/usr/local/lib/python3.11/site-packages/celery/app/trace.py", line 760, in __protected_call__
worker        |     return self.run(*args, **kwargs)
worker        |            ^^^^^^^^^^^^^^^^^^^^^^^^^
worker        |   File "/code/celery_worker.py", line 187, in process_integration_brain_sync
worker        |     integrations = integration.get_integration_brain_by_type_integration("notion")
worker        |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
worker        |   File "/code/modules/brain/repository/integration_brains.py", line 110, in get_integration_brain_by_type_integration
worker        |     .execute()
worker        |      ^^^^^^^^^
worker        |   File "/usr/local/lib/python3.11/site-packages/postgrest/_sync/request_builder.py", line 58, in execute
worker        |     r = self.session.request(
worker        |         ^^^^^^^^^^^^^^^^^^^^^
worker        |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 814, in request
worker        |     return self.send(request, auth=auth, follow_redirects=follow_redirects)
worker        |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
worker        |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 901, in send
worker        |     response = self._send_handling_auth(
worker        |                ^^^^^^^^^^^^^^^^^^^^^^^^^
worker        |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 929, in _send_handling_auth
worker        |     response = self._send_handling_redirects(
worker        |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
worker        |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 966, in _send_handling_redirects
worker        |     response = self._send_single_request(request)
worker        |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
worker        |   File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1002, in _send_single_request
worker        |     response = transport.handle_request(request)
worker        |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
worker        |   File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 227, in handle_request
worker        |     with map_httpcore_exceptions():
worker        |   File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__
worker        |     self.gen.throw(typ, value, traceback)
worker        |   File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 83, in map_httpcore_exceptions
worker        |     raise mapped_exc(message) from exc
worker        | httpx.ConnectError: [Errno -2] Name or service not known

Twitter / LinkedIn details

No response

@chen-42 chen-42 added the bug Something isn't working label Apr 2, 2024
Copy link

dosubot bot commented Apr 2, 2024

Hey there, @chen-42! Great to see you diving into the intricacies again. Hope you're doing well amidst these digital conundrums. 🚀

Based on the error message and the context you've provided, it seems like the ConnectError('[Errno -2] Name or service not known') error is related to a DNS resolution issue. This typically happens when the hostname of the service your task is trying to connect to cannot be resolved to an IP address.

In your case, the celery_worker.process_integration_brain_sync task is trying to connect to the Notion service when this error occurs. This is evident from the use of the NotionConnector class within the process_integration_brain_sync_user_brain function, which is called by the process_integration_brain_sync task for syncing operations.

To resolve this issue, you can consider the following steps:

  1. Verify the Hostname: Ensure that the hostname of the Notion service you're trying to connect to is correct. Check for any typos or inaccuracies.

  2. Check Network Connectivity: Ensure that the server running the Celery worker has proper network connectivity and can resolve DNS queries. You can test this by running ping or nslookup commands against the Notion service's hostname from the server.

  3. DNS Configuration: Check the DNS configuration of the server to ensure it's correctly set up to resolve external hostnames. This might involve checking the /etc/resolv.conf file on Linux systems or equivalent DNS settings on other operating systems.

  4. HTTPX Client Configuration: If the NotionConnector uses the httpx library for making HTTP requests, ensure that it's configured correctly. For instance, if you're using a proxy, make sure the proxy settings are correct.

  5. Retry Mechanism: Implement a retry mechanism in the NotionConnector's network request logic to handle transient network issues gracefully.

  6. Logging and Debugging: Enhance logging within the NotionConnector class, especially around the network request part, to capture more details about the error. This can help in pinpointing the exact cause.

Additionally, there's a similar open issue [Bug]: backend-core | httpx.ConnectError: [Errno -2] Name or service not known which suggests that this issue might be due to docker engine on Linux not adding host.docker.internal to the container hosts, which leads to a DNS failure. You can try adding the host by yourself in the docker-compose.yml file as follows:

backend-core:
  ...
  extra_hosts:
      - "host.docker.internal:host-gateway"

Please try these steps and let me know if the issue persists.

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.

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

No branches or pull requests

1 participant