Questions tagged [uwsgi]

uWSGI is a fast, self-healing and developer/sysadmin-friendly application container server coded in pure C.

The uWSGI project

The uWSGI project aims at developing a full stack for building (and hosting) clustered/distributed network applications.

Mainly targeted at the web and its standards, it has been successfully used in a lot of different contexts.

Thanks to its pluggable architecture it can be extended without limits to support more platforms and languages. Currently, you can write plugins in C, C++ and Objective-C.

The “WSGI” part in the name is a tribute to the namesake Python standard, as it has been the first developed plugin for the project.

Versatility, performance, low-resource usage and reliability are the strengths of the project (and the only rules followed).

The uwsgi Protocol

The uwsgi (lowercase!) protocol is the native protocol used by the uWSGI server.

It is a binary protocol that can carry any type of data. The first 4 bytes of a uwsgi packet describe the type of the data contained by the packet.

Every uwsgi request generates an response in the uwsgi format.

Even the web server handlers obey this rule, as an HTTP response is a valid uwsgi packet (look at the modifier1 = 72).

The protocol works mainly via TCP but the master process can bind to a UDP Unicast/Multicast for The embedded SNMP server or cluster management/messaging requests.

2938 questions
56
votes
3 answers

uWSGI request timeout in Python

Trying to set the timeout for requests in uWSGI, I'm not sure of the correct setting. There seem to be multiple timeout options (socket, interface, etc.) and it's not readily evident which setting to configure or where to set it. The behavior I'm…
Juan Carlos Coto
  • 11,900
  • 22
  • 62
  • 102
56
votes
8 answers

Nginx uwsgi (104: Connection reset by peer) while reading response header from upstream

Environment is Nginx + uwsgi. Getting a 502 bad gateway error from Nginx on certain GET requests. Seems to be related to the length of the URL. In our particular case, it was a long list of GET parameters. Shorten the GET parameters and no 502…
user3470130
  • 1,661
  • 2
  • 11
  • 8
55
votes
6 answers

How do I run uwsgi with virtualenv

I'm currently developing my first real python flask project and am about to set up the build server to deploy the "Latest Build" which is built on every check-in. I have set up a startup script where I start the application using uwsgi and this part…
Asken
  • 7,679
  • 10
  • 45
  • 77
54
votes
3 answers

How to debug python application under uWSGI?

When I'm trying to use python pdb debugger under uWSGI, the execution doesn't stop on breakpoint, it just return trackback. here is the code: def application(env, start_response): import pdb; pdb.set_trace() start_response('200 OK',…
Anderson
  • 573
  • 1
  • 4
  • 9
53
votes
3 answers

Bad Django / uwsgi performance

I am running a django app with nginx & uwsgi. Here's how i run uwsgi: sudo uwsgi -b 25000 --chdir=/www/python/apps/pyapp --module=wsgi:application --env DJANGO_SETTINGS_MODULE=settings --socket=/tmp/pyapp.socket --cheaper=8 --processes=16 …
Maverick
  • 1,458
  • 2
  • 21
  • 35
51
votes
4 answers

uWSGI, Flask, sqlalchemy, and postgres: SSL error: decryption failed or bad record mac

I'm trying to setup an application webserver using uWSGI + Nginx, which runs a Flask application using SQLAlchemy to communicate to a Postgres database. When I make requests to the webserver, every other response will be a 500 error. The error…
frnsys
  • 2,404
  • 3
  • 21
  • 25
50
votes
6 answers

Internal Server Error with Django and uWSGI

I am trying to follow the steps in this guide: http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html Before I even get to the nginx part I am trying to make sure that uWSGI works correctly my folder structure is…
tareq
  • 1,329
  • 2
  • 11
  • 16
49
votes
1 answer

nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argument

I'm working through https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-uwsgi-and-nginx-on-ubuntu-16-04. I've completed the tut but I'm getting a 502 error. My nginx server block configuration file: server…
user1592380
  • 34,265
  • 92
  • 284
  • 515
49
votes
4 answers

Nginx timeouts when uWSGI takes long to process request

I have Nginx + uWSGI for Python Django app. I have the following in my nginx.conf: location / { include uwsgi_params; uwsgi_pass 127.0.0.1:9001; uwsgi_read_timeout 1800; uwsgi_send_timeout 300; client_header_timeout 300; …
anishek
  • 1,675
  • 2
  • 13
  • 19
46
votes
7 answers

uWSGI: No request plugin is loaded, you will not be able to manage requests

I've loaded uWSGI v 1.9.20, built from source. I'm getting this error, but how do I tell which plugin is needed? !!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!! no request plugin is loaded, you will not be able to manage requests. you may need to install the…
101010
  • 14,866
  • 30
  • 95
  • 172
46
votes
4 answers

Your server socket listen backlog is limited to 100 connections

I run a flask app on uwsgi. I use supervisor to manage uwsgi process. I find the log saying that your server socket listen backlog is limited to 100 connections. How to overcome 100 connections limitation? My running script is as…
shoujs
  • 1,113
  • 1
  • 11
  • 24
45
votes
2 answers

How to read uwsgi stats output

I'm on this page http://uwsgi-docs.readthedocs.org/en/latest/StatsServer.html and using uwsgitop but I have no idea how to interpret the output. The docs aren't giving too much away too. So how would one go about understanding this:
super9
  • 29,181
  • 39
  • 119
  • 172
44
votes
1 answer

Running asyncio loop engine using external python plugin

I have an installation of uWSGI that is running in emperor mode. Vassals are using different python versions, so I can't have a Python plugin embedded in uWSGI binary. Having said that, I want to use asyncio loop engine in one of vassals, but I…
GwynBleidD
  • 20,081
  • 5
  • 46
  • 77
42
votes
2 answers

Invalid transaction persisting across requests

Summary One of our threads in production hit an error and is now producing InvalidRequestError: This session is in 'prepared' state; no further SQL can be emitted within this transaction. errors, on every request with a query that it serves, for the…
Vanessa Phipps
  • 2,205
  • 1
  • 18
  • 22
42
votes
1 answer

Difference between workers and processes in uwsgi

I am trying to be careful and understand every setting in my nginx configuration. I have seen a configuration example that has something like: workers = 8 processes = 10 But the uWSGI docs do not seem to differentiate. Are they synonyms? If so,…
scottmrogowski
  • 2,063
  • 4
  • 23
  • 32