Docker machine, Gunicorn, Flask, and corrupt files

I recently switched from using a development server to doing all development locally using docker-machine. Docker machine simplifies the process of working with docker on OSX by abstracting the process of creating and working with a virtual server created using VirtualBox.

Everything was going smoothly until I started seeing corrupt JavaScript files (illegal token errors and old cached versions of the file) being served out of Gunicorn and Flask. After losing more time that I care to admit investigating possible causes, I discovered a five year old bug with VirtualBox related to sendfile() that sounded suspiciously familiar. Sure enough, using the — no-sendfile option when starting gunicorn resolved the issue.

/usr/local/bin/gunicorn -w 4 -b — no-sendfile app:app

Hopefully this saves someone else some time in the future.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.