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

gunicorn dumps garbage when sendfile is enabled on virtualbox #856

Closed
trcarden opened this Issue Aug 17, 2014 · 6 comments

Comments

Projects
None yet
4 participants
@trcarden

trcarden commented Aug 17, 2014

Solution: Please add configuration option to disable sendfile support in Gunicorn

Problem:
This occurs when running on virtual box, any ubuntu > 9, and is a known issue. The workaround for about 3 years seems to be to tell your server Nginx or Apache to disable sendfile support. Gunicorn under the covers uses sendfile and there should be a configuration option to disable it and fall back to a less performant solution.

Here are some related tickets:
hashicorp/vagrant#351 (comment)
https://www.virtualbox.org/ticket/9069

Here are some SO posts with references:
http://stackoverflow.com/questions/21422426/i-add-a-line-of-text-to-my-css-file-garbage-comes-through-the-browser
http://serverfault.com/questions/269420/disable-caching-when-serving-static-files-with-nginx-for-development

Random blogs post on it:
https://coderwall.com/p/ztskha
http://abitwiser.wordpress.com/2011/02/24/virtualbox-hates-sendfile/

@benoitc benoitc added this to the R19.2 milestone Aug 21, 2014

@benoitc

This comment has been minimized.

Show comment
Hide comment
@benoitc

benoitc Aug 21, 2014

Owner

I suggest to add an environment variable USE_SENDFILE=(no|yes) instead of adding another setting. Thoughts?

Owner

benoitc commented Aug 21, 2014

I suggest to add an environment variable USE_SENDFILE=(no|yes) instead of adding another setting. Thoughts?

@tilgovi

This comment has been minimized.

Show comment
Hide comment
@tilgovi

tilgovi Aug 21, 2014

Collaborator

Seems reasonable. Otherwise, I think everyone will be adding detection of the environment around their application scripts to check for vagrant anyway, whereas vagrant/vbox can easily set an environment variable and the rest of a project can stay ignorant of this setting.

Collaborator

tilgovi commented Aug 21, 2014

Seems reasonable. Otherwise, I think everyone will be adding detection of the environment around their application scripts to check for vagrant anyway, whereas vagrant/vbox can easily set an environment variable and the rest of a project can stay ignorant of this setting.

@trcarden

This comment has been minimized.

Show comment
Hide comment
@trcarden

trcarden Aug 21, 2014

Would it be bad to do both? I personally like settings to be available explicitly as server options instead of env variables if i had to pick one.

Also doesn't it make the most sense to stay consistent and have options for controlling the server be present with all the other options? Rather than having one surprise environment variable that can change behavior without any explicit setting on the server. There might be other reasons besides virtual box for turning off sendfile (After all nginx and Apache both support disabling it and i would guess that it wasn't for the virtualbox bug).

trcarden commented Aug 21, 2014

Would it be bad to do both? I personally like settings to be available explicitly as server options instead of env variables if i had to pick one.

Also doesn't it make the most sense to stay consistent and have options for controlling the server be present with all the other options? Rather than having one surprise environment variable that can change behavior without any explicit setting on the server. There might be other reasons besides virtual box for turning off sendfile (After all nginx and Apache both support disabling it and i would guess that it wasn't for the virtualbox bug).

@tilgovi

This comment has been minimized.

Show comment
Hide comment
@tilgovi

tilgovi Aug 22, 2014

Collaborator

Fair enough to have it as an option as well, but I think an environment
variable addresses the issue better here for the reason I said. So I would
say have both?
On Aug 21, 2014 2:09 PM, "Timothy Cardenas" notifications@github.com
wrote:

Would it be bad to do both? I personally like settings to be available
explicitly as server options instead of env variables if i had to pick one.

Also doesn't it make the most sense to stay consistent and have options
for controlling the server be present with all the other options? Rather
than having one surprise environment variable that can change behavior
without any explicit setting on the server. There might be other reasons
besides virtual box for turning off sendfile (After all nginx and Apache
both support disabling it and i would guess that it wasn't for the
virtualbox bug).


Reply to this email directly or view it on GitHub
#856 (comment).

Collaborator

tilgovi commented Aug 22, 2014

Fair enough to have it as an option as well, but I think an environment
variable addresses the issue better here for the reason I said. So I would
say have both?
On Aug 21, 2014 2:09 PM, "Timothy Cardenas" notifications@github.com
wrote:

Would it be bad to do both? I personally like settings to be available
explicitly as server options instead of env variables if i had to pick one.

Also doesn't it make the most sense to stay consistent and have options
for controlling the server be present with all the other options? Rather
than having one surprise environment variable that can change behavior
without any explicit setting on the server. There might be other reasons
besides virtual box for turning off sendfile (After all nginx and Apache
both support disabling it and i would guess that it wasn't for the
virtualbox bug).


Reply to this email directly or view it on GitHub
#856 (comment).

@benoitc

This comment has been minimized.

Show comment
Hide comment
@benoitc

benoitc Aug 30, 2014

Owner

we can probably have both. Or maybe just a setting and detection of the platform? Does vagrant have an env variable we could check so it would be disable on it?

Owner

benoitc commented Aug 30, 2014

we can probably have both. Or maybe just a setting and detection of the platform? Does vagrant have an env variable we could check so it would be disable on it?

@ada-lovecraft

This comment has been minimized.

Show comment
Hide comment
@ada-lovecraft

ada-lovecraft commented Oct 2, 2014

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment