VirtualBox Hates Sendfile

I’ve begun using Vagrant with Virtualbox for Web Development, specifically for Rails development. This allows me to spin up an environment as close to production as possible, and it keeps my host system clean from various projects’ clutter. It’s quite lovely, and I’ll definitely devote a separate post to that topic. However:

Recently, I ran into an issue with Sendfile and Virtualbox’s shared folder support. It seems that the use of Kernel sendfile by either Apache (both debian and centos flavors) or Nginx to serve static files doesn’t work if you update those files at all once they’ve been served. Needless to say, this doesn’t work for doing any Javascript development…

After digging, the fix is simply to disable sendfile support in your HTTP server of choice. A quick search for ‘sendfile’ in your httpd.conf, apache.conf or nginx.conf will reveal an ‘On/Off’ toggle:

#
# EnableSendfile: Control whether the sendfile kernel support is
# used to deliver files (assuming that the OS supports it).
# The default is on; turn this off if you serve from NFS-mounted
# filesystems. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#enablesendfile
#
EnableSendfile off

The solution to the issue can be found in the VirtualBox forums: http://forums.virtualbox.org/viewtopic.php?f=1&t=24905

More info about Sendfile can be found in the Apache documentation: http://httpd.apache.org/docs/2.0/mod/core.html#enablesendfile

Advertisements

14 thoughts on “VirtualBox Hates Sendfile

  1. I’ve been nearly ripping my hair out over this issue for weeks now. Unfortunately this solution does not work for me, but seems to be the only solution available! Is there anyone else out there for which this solution just DOES NOT work?!?!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s