Question

I have a flask server running on top of uWSGI, with the following configuration:

[uwsgi]
http-socket    = :9000
plugin         = python
wsgi-file      = /.../whatever.py
enable-threads = true

The flask server has a background thread which makes periodic calls to another server, using the following command:

r = requests.get(...)

I've added logging before and after this command, and it seems that the command never returns, and the thread just stops there.

Any idea why the background thread is hanging? Note that I've added enable-threads = true to the configuration.

Updates

  • I've added a timeout parameter to requests.get(). Now the behaviour is unexpected - the background thread works in one server, but fails in another.
Was it helpful?

Solution

killing all the uWSGI instances and restarting them using sudo service uwsgi restart solved the problem.

It seems that sudo service uwsgi stop does not actually stop all the instances of uwsgi.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top