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

Stop responding in a few days in wsgi mode #383

Closed
vooon opened this issue Aug 20, 2024 · 4 comments
Closed

Stop responding in a few days in wsgi mode #383

vooon opened this issue Aug 20, 2024 · 4 comments
Labels
wsgi Issue related to WSGI protocol

Comments

@vooon
Copy link

vooon commented Aug 20, 2024

I've set to run OpenStack Placement API to be run by Granian. But sees that it stop's responding in a day or two.
Unfortunately i do not see any logs, process looks alive, port are in netstat...
But if i curl -v http://192.168.50.91:18778 it just hangs.

I see the same problem for other components as well, Heat API, Barbican...
But Placement is very simple compared to others, it do not use eventlets or rabbitmq. Just WebOb and SQLAlchemy.
So it probably easier to debug.

I suppose that the problem somewhere in WSGI handling part, as Skyline APIserver (which is written on FastAPI, and so deployed in ASGI mode) working without a problem for months.

@gi0baro
Copy link
Member

gi0baro commented Aug 20, 2024

@vooon can you also provide the full granian parameters/config you're using?

@gi0baro gi0baro added the wsgi Issue related to WSGI protocol label Aug 20, 2024
@vooon
Copy link
Author

vooon commented Aug 20, 2024

@gi0baro it's similar to other services, since use same template, just app factory is placement.wsgi:init_application:

/usr/bin/granian /etc/granian/openstack_placement_api.py:application \
	--host 192.168.50.91 \
	--port 18778 \
	--interface wsgi \
	--workers 2 \
	--threads 4 \
	--log-level debug

@gi0baro
Copy link
Member

gi0baro commented Aug 22, 2024

@gi0baro it's similar to other services, since use same template, just app factory is placement.wsgi:init_application:

/usr/bin/granian /etc/granian/openstack_placement_api.py:application \
	--host 192.168.50.91 \
	--port 18778 \
	--interface wsgi \
	--workers 2 \
	--threads 4 \
	--log-level debug

My guess is that something is blocking the Python threads and thus Granian runs out of working threads to process requests (it could also be the Rust runtime gets blocked, but I would expect connection refused/timeouts in that case).

I'd suggest to configure --backpressure, as with your configuration you can end up with 512 threads per workers interacting with Python code, I guess that just too much. Also, as per documentation, you won't benefit at all from --threads 4, I would just remove that.
In the end, I would change your run command with something like this (where N is the maximum Python concurrency you expect):

/usr/bin/granian /etc/granian/openstack_placement_api.py:application \
	--host 192.168.50.91 \
	--port 18778 \
	--interface wsgi \
	--workers 2 \
	--backpressure N \
	--log-level debug

@gi0baro
Copy link
Member

gi0baro commented Sep 4, 2024

Closing this as stale

@gi0baro gi0baro closed this as completed Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wsgi Issue related to WSGI protocol
Projects
None yet
Development

No branches or pull requests

2 participants