Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Edit: this has been almost entirely rewritten as I've narrowed down the issue.

I'm using a Vagrant VM to mirror the client's environment as closely as I can. I'm using VirtualBox 4.3 (with Guest Additions 4.3) with Vagrant 1.3.5, and the server is running CentOS 5.9, Apache 2.2.3-83, PHP 5.3.3, and Drupal 7.

When the server first starts the original files in the shared directory, where my application resides, are cached. When I change the file the original file +/- the filesize delta is served, leading to the image corruption I saw before. So additions add NUL characters on the end of the original, and deletions truncate the file. When I view the file using nano the contents are correct; restarting the httpd service makes no difference. I have to restart the VM for the changes to be served correctly.

Before:

// The quick brown fox

Changes:

// The quick brown fox jumps over the lazy dog

Apache serves:

// The quick brown fox\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0

Where exactly does this error lie? With Apache 2.2 or its dependencies, or with VirtualBox and its Guest Additions?

share|improve this question
    
I would download the file from the CentOS box, generate an MD5 checksum and compare that checksum to the original file before it was uploaded (after it was optimized). If they match, then I'd remember that I forgot to clear my browser's cache and do that. If they don't match, I'd generate an MD5 checksum on the file sitting on the CentOS box directly (without downloading). At this point you should be able to figure out where the problem is. If the checksum matches on both the mac and server but not what you download from apache.. the problem is likely either drupal or an apache module. –  yoonix Oct 24 '13 at 21:29
    
@yoonix, The way Vagrant works is that it adds a shared directory. I've set this shared directory up, using a symlink, as my web root. So technically, the image is the same both on the Mac and on the VM. But I'll definitely have to double-check my Apache modules; as far as I can tell, Drupal hasn't touched it. –  Robert K Oct 25 '13 at 12:57

1 Answer 1

up vote 3 down vote accepted

This is most probably the issue with VirtualBox's buggy sendfile() implementation.

Try setting:

EnableSendfile off

The equivalent for nginx:

sendfile off;
share|improve this answer
    
Disabled Sendfile, and it works. Thanks a bunch! –  Robert K Oct 25 '13 at 16:54
    
Thanks a ton!!! –  Dave C Apr 17 at 13:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.