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

Prefect Worker Fails to Log Connection Errors to Server #17160

Open
archi-max opened this issue Feb 17, 2025 · 1 comment
Open

Prefect Worker Fails to Log Connection Errors to Server #17160

archi-max opened this issue Feb 17, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@archi-max
Copy link

archi-max commented Feb 17, 2025

Bug summary

Description
When deploying a Prefect worker via Helm with a misconfigured serverApiConfig.apiUrl, the worker fails to establish a connection but only logs debug-level messages about the connection attempt without surfacing an explicit error. This occurs despite debug: true in the worker configuration.

01:53:36.933 | DEBUG | prefect.profiles - Using profile 'ephemeral'
01:53:38.718 | DEBUG | prefect.client - Connecting to API at http://prefect-server.prefect.svc.cluster.local/api/

Expected Behavior
The worker should log a clear error (e.g., ConnectionError, Timeout, or InvalidURL) when unable to reach the Prefect server, including retry attempts if applicable.

Version info

Version:             3.2.2
API version:         0.8.4
Python version:      3.11.11
Git commit:          d982c69a
Built:               Thu, Feb 13, 2025 10:53 AM
OS/Arch:             linux/x86_64
Profile:             ephemeral
Server type:         server
Pydantic version:    2.10.6
Integrations:
  prefect-redis:     0.2.2
  prefect-kubernetes: 0.5.3

Additional context

I am using the default prefect server service from the helm charts.

@archi-max archi-max added the bug Something isn't working label Feb 17, 2025
@desertaxle
Copy link
Member

Thanks for the issue @archi-max! We log to stderr for connection errors and they look like this:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 101, in map_httpcore_exceptions
    yield
  File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 394, in handle_async_request
    resp = await self._pool.handle_async_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 256, in handle_async_request
    raise exc from None
  File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 236, in handle_async_request
    response = await connection.handle_async_request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection.py", line 101, in handle_async_request
    raise exc
  File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection.py", line 78, in handle_async_request
    stream = await self._connect(request)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection.py", line 124, in _connect
    stream = await self._network_backend.connect_tcp(**kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpcore/_backends/auto.py", line 31, in connect_tcp
    return await self._backend.connect_tcp(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/httpcore/_backends/anyio.py", line 113, in connect_tcp
    with map_exceptions(exc_map):
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/usr/local/lib/python3.12/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ConnectError: [Errno -2] Name or service not known

I can see output like that when deploying a worker using the Helm chart with a bad API URL, so I'm unsure why you aren't seeing this in your setup. Do you have any custom handling for stderr?

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

2 participants