Page 1 of 1

Shared folder (vboxsf): overwritten file still cached?

Posted: 26. Jul 2010, 22:20
by DrTanelorn
While building a small VirtualBox VM in order to do some web development (a typical LAMP stack on a Debian), I chose to host the apache DocumentRoot on a shared folder. This is quite convenient: the web site can then be edited using host (Windows) tools, while still being served by the Apache server.

Excepted that the actual behavior is the following: when a file (an image, as an example) is overwritten on this shared folder, Apache still serves the old content. I suspected some caching or timestamp issues, but I can only reproduce this behavior on a VirtualBox shared folder. The problem can also be reproduced my overwriting the file using a "cp" command while logged on the Debian guest.

If I perform the same manipulation of a "regular" guest directory, overwrites are taken into account as soon as the web page is reloaded, so this clearly seems related to shared folders. Interestingly, the only way I found to get the new content was either to reboot the VM, or to perform the following command to empty the OS cache:
sync; echo 3 > /proc/sys/vm/drop_caches
So my hypothesis is that this is a vboxsf linux module bug: when a file is overwritten, it correctly updates its disk content and its metadata (timestamp, size), but it fails to inform the OS that its cache for this file should be invalidated.

Did anyone meet something similar? Does my interpretation seem reasonable? I would prefer to discuss this issue here before logging a bug on the tracker.

Regards.

Re: Shared folder (vboxsf): overwritten file still cached?

Posted: 29. Jul 2010, 22:17
by vbox4me2
VboxSF is a poor mans way of sharing files, use real sharing stuff like samba for serious sharing.

Re: Shared folder (vboxsf): overwritten file still cached?

Posted: 29. Jul 2010, 22:41
by DrTanelorn
vbox4me2 wrote:VboxSF is a poor mans way of sharing files, use real sharing stuff like samba for serious sharing.
I beg to differ; I actually feel that not having to use samba to share files is a plus (it was one of the reasons I chose VirtualBox over other virtualization solutions, anyway).

Anyway, I posted here to discuss what to me seems like a bug, since I felt it could lead to an improvement to this feature (making it more "serious", whatever that may mean).

So what's your point in suggesting me to change the way I share files? Is vboxsf an unmaintained, unreliable feature? It definitely does not feels like it.

Regards.

Re: Shared folder (vboxsf): overwritten file still cached?

Posted: 29. Jul 2010, 23:31
by DrTanelorn
OK, I had a look at the bugtracker and found a similar issue: #819.

Following the ticket advices, I tried the following Apache directive, which solved my image updating issue:
EnableSendFile Off

So this was indeed related to the way Apache reads the file; "SendFile" seems to be an optimization not currently supported by vboxsf under Linux.

Regards.

Re: Shared folder (vboxsf): overwritten file still cached?

Posted: 14. Mar 2011, 19:38
by whatdoesitwant
I am just setting up a similar environment. Did you perhaps use git or svn and notice any problems or did version control work as expected?

Re: Shared folder (vboxsf): overwritten file still cached?

Posted: 22. Nov 2011, 12:48
by RastaFeri
fyi: i had the same problem with nginx. it has the same solution, check 'SendFile' in the nginx docs