3

I'm hosting a Flask built website with Gunicorn and Nginx through Supervisor, which works perfectly well. In my supervisord.conf file I run gunicorn as follows:

command=/home/beta/imd/venv/bin/gunicorn --worker-class eventlet -b 127.0.0.1:5000 -w 1 app:app

I now tried running Gunicorn directly without Nginx in front of it using the following command (to include logging)

sudo /home/beta/imd/venv/bin/gunicorn \
    --worker-class eventlet \
    -b 0.0.0.0:80 \
    -w 1 \
    --access-logfile /home/beta/gunicorn_access.log \
    --error-logfile /home/beta/gunicorn_error.log \
    app:app

but when opening a webpage, two of the 20 requests the page consists of (an image and Twitter Bootstrap css file) give an ERR_CONTENT_LENGTH_MISMATCH. I checked out the gunicorn logs, but in there nothing strange seems to happen. I get no error and the access logs report regular 200 status codes. I get the error in Chrome, Opera and Safari, but not in Firefox.

I find it so strange that it doesn't happen when also using Nginx, which suggests that Nginx adjusts the content-length headers.

Does anybody know what could cause this problem?

kramer65
  • 50,427
  • 120
  • 308
  • 488
  • This is likely caused by a caching issue. Nginx retrieves the correct cached version of the content but gunicorn doesn't, which results in the error – Keenan Lawrence Jul 03 '16 at 19:40
  • I experience the same error. I can 'solve' it by removing '--worker-class eventlet' from the command (but this is not what I want). – compie Aug 29 '16 at 21:09
  • 1
    It might mean your disk is full, make sure it has free space. – Arad Feb 06 '17 at 16:19

0 Answers0