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

Client not getting updated toggles in flask app when running via gunicorn with "--preload" option #216

Open
raymzag opened this issue Jul 22, 2022 · 3 comments
Assignees

Comments

@raymzag
Copy link

raymzag commented Jul 22, 2022

Describe the bug

When running unleash with flask/gunicorn, it is not getting updated with latest toggles from unleash server when it is run with option "--preload". More info on preload

gunicorn --chdir app app:app -w 2 --threads 2 -b 0.0.0.0:80 --preload

To Reproduce

I have a branch to demonstrate. using this demo toggle https://app.unleash-hosted.com/demo/projects/default/features/gunicorn

  1. From this Repo https://github.com/raymzag/Flask_Docker_App
  2. docker-compose up --build
  3. Go to http://localhost/test_unleash
  4. Try toggling on/off, give it some time 10-15s. It will not be updated.
  5. Remove the --preload option from https://github.com/raymzag/Flask_Docker_App/blob/master/gunicorn.sh
  6. Do docker-compose up --build again.
  7. Try toggling on/off, give it some time 10-15s. it will be updated.

Expected behavior
Expects the unleash toggles to be refreshed in flask/gunicorn app with --preload option.

Logs
If applicable, add logs or output to help explain your problem.

Additional context
Add any other context about the problem here.

@sighphyre
Copy link
Member

Thanks for raising this, lots of nice details in this report!

I believe I know what's happening here but give me a bit of time to double check myself

@sighphyre sighphyre moved this from New to In Progress in Issues and PRs Jul 28, 2022
@sighphyre
Copy link
Member

Just updating for folks who arrive here because this ended up on Slack. This is a currently limitation in the Python client that this won't work due to the way gunicorn spawns the underlying processes, right now it's best to not use the --preload option. This is on our backlog and I'll update this when we have something that works

@sighphyre sighphyre added the later label Nov 1, 2022
@thomasheartman thomasheartman moved this from In Progress to Todo in Issues and PRs Nov 1, 2022
@sighphyre sighphyre moved this from Todo to For later in Issues and PRs Nov 25, 2022
@diepholz
Copy link

Hi there! I wanted to check if this is on the radar or being looked at? One of our backend services is hosted on GCP Cloud Run and instance load times are important here where we need to have preload set to True. We love Unleash across our other services, but this is really blocking at the moment for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: For later
Development

No branches or pull requests

4 participants