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

When running scheduled tasks, the webpage cannot be opened #149

Open
NIWA-HOJI opened this issue Sep 14, 2023 · 6 comments
Open

When running scheduled tasks, the webpage cannot be opened #149

NIWA-HOJI opened this issue Sep 14, 2023 · 6 comments

Comments

@NIWA-HOJI
Copy link

Hi
I'm not sure if it's an issue on my end, but when I click the (run) button then, the page cant displayt any more, and the request is constantly pending. When viewed through the command line, the task's output seems normal.

@lucafaggianelli
Copy link
Owner

not really sure what's going on, can you share the output of the browser console and/or the python terminal output?

@Saintroi
Copy link

I want to mention that I experience this same issue if I declare my task as async. After the run button is pressed, I am directed to the run page but get "run not found" and then any attempt to browse to the main page of the site just gives me a Login button (I don't have any auth configured)

@jklimcak
Copy link

jklimcak commented Oct 25, 2023

+1, basically any time any of the runs are happening, the web UI ceases to be responsive/usable. I can only use the web UI in between runs. For clarity - the underlying runs are behaving as expected, i.e. they're doing their job. It's only the UI that becomes unresponsive until the jobs are done

@fordnox
Copy link

fordnox commented Nov 1, 2023

same for me

@VinodKumar9576
Copy link

+1, basically any time any of the runs are happening, the web UI ceases to be responsive/usable. I can only use the web UI in between runs. For clarity - the underlying runs are behaving as expected, i.e. they're doing their job. It's only the UI that becomes unresponsive until the jobs are done

same is happening for me as well.

@D3m0n1cC09n1710n
Copy link

Well, I dont usually do this (comment, lol), but this was enough of a pain that I figured maybe I should update on my findings.

So, when listening in on the web requests via devtools it is pretty obvious that "/api/auth/whoami" blocks.
I tracked down the route and found that in my case its a dummy route that gets configured if settings.auth is empty.
Its an async function named get_current_user_no_auth in api/authentication.py

Since its an async function fastapi runs it in the same event loop as all async endpoints in FastAPI.
The problem starts when you configure a pipeline with a task that isnt REALLY async but you put async on it, itll block the whole event loop till its done (yay)

On removing async from the task the issue stops occurring.

Its not just whoami though, the rest of the internal routes are async too - so if we remove async from get_current_user_no_auth it wont really help.

The really evil thing here is that regardless of if its a true async task or not - parts of it are bound to have non-async code which will cause this at when they run.

We COULD use ast to iterate over the task function's code and for every section that does not have await in it push run_in_threadpool into it - but it is so intrusive...
I think I am for simply removing async from all the internal api routes so it wont cause this issue.

I might be wrong though :P
Prove me wrong :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants