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

[Root cause found] Async function problem on Docker #4457

Open
ArthurMro opened this issue Nov 29, 2024 · 1 comment
Open

[Root cause found] Async function problem on Docker #4457

ArthurMro opened this issue Nov 29, 2024 · 1 comment
Labels
bug Something isn't working need repro example Need an example that can be copy/pasted to reproduce the issue immediately

Comments

@ArthurMro
Copy link

ArthurMro commented Nov 29, 2024

Describe the bug
When running the app in a Docker container, the app keeps have async problem issue. The problem comes from Reflex's internal HTTPX client wrapper is trying to access a _state attribute that doesn't exist.
On the front-end side, the app just stops running the async function and display a message prompting to "Contact the website administrator". The app still works for the rest, only the change supposedly done by the async function do no have effect.

A typical error message print this way through logging: ERROR - asyncio - Task exception was never retrieved future: <Task finished name='Task-2506' coro=<AsyncClient.aclose() done, defined at /app/.venv/lib/python3.11/site-packages/httpx/_client.py:1980> exception=AttributeError("'AsyncHttpxClientWrapper' object has no attribute '_state'")> Traceback (most recent call last): File "/app/.venv/lib/python3.11/site-packages/httpx/_client.py", line 1984, in aclose if self._state != ClientState.CLOSED: ^^^^^^^^^^^ AttributeError: 'AsyncHttpxClientWrapper' object has no attribute '_state'

[EDIT] After a week of research we found out that the problem comes from the new decorator rx.event(background=True). When it has an "async with self:" it causes the app to execution in a Docker container. Without this, it works all good.

To Reproduce
Run an app from a Docker Container. The issue occurred both locally (running the container with Docker Windows and in remotely by using DockerHub deployed on Linode.
System: Windows 10
OS: WSL, Ubuntu

  • Code/Link to Repo: Private company repo which cannot be shared.

Expected behavior
The async function should be redirecting to another page of the app. But it just does not run the function.

Screenshots
Not applicable

Specifics (please complete the following information):

  • Python Version: 3.12.3
  • Reflex Version: 0.6.5
  • OS: Windows 10
  • Browser (Optional): Chrome

Additional context
None

Copy link

linear bot commented Nov 29, 2024

@ArthurMro ArthurMro changed the title Async function problem on Docker [Root cause found] Async function problem on Docker Dec 6, 2024
@Lendemor Lendemor added bug Something isn't working need repro example Need an example that can be copy/pasted to reproduce the issue immediately labels Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need repro example Need an example that can be copy/pasted to reproduce the issue immediately
Projects
None yet
Development

No branches or pull requests

2 participants