The Cult of Gary

08 Feb

Apache, CIFS and Blank Documents

This one took me a bit to figure out. Google wasn’t much help — I hope my blog post fixes that!

Our developers are using a VMware image of our server install for developing. In order to speed things up, they are mounting a Windows share of the code from the VMware image. It worked on an older image using smbfs, but not on the new one using CIFS.

In our latest build, files served from the CIFS mount over 255 bytes were sending out blank documents. PHP code worked fine.

I found an article that mislead me into thinking this was a NAT vs. Bridging network issue on the VMware side. I spent several hours with a network sniffer trying to see if there was some sort of network error going on. I didn’t find anything there.

I figured I’d take a different route this morning. I set the Apache LogLevel to debug, and found this:

(75)Value too large for defined data type: core_output_filter: writing data to the network

Which lead me to EnableSendFile. It turns out that you need to turn this off if you’re serving files off of a network mount.  

7 Responses to “Apache, CIFS and Blank Documents”

  1. 1
    Andrew Sharpe Says:

    Absolute gold – I didn’t find this post until I searched for the apache debug message and this was the only hit. I’m hoping this gets easier to find for others as time goes on, but I’m not banking on it.

    I had this problem for both a CIFS mount and a UnionFS mount, and it was interesting to see that a http connection failed to return the file, while https was able to (indicating that https doesn’t use sendfile by default)

    The EnableSendfile directive fixed the problem for both mounts.

    Cheers heaps :)

    Andrew

  2. 2
    incubi Says:

    I was just about to give up for the day on this and found your little gold nugget here.
    THANK YOU!!! for posting this. Very true not much on Google on it.

    Lee :)

  3. 3
    Eric Says:

    You spelled the magic word: “EnableSendfile”!
    Now here it works, thank you :-)

    Eric

  4. 4
    Naveed Says:

    I have spent so much time in trying to fix this issue. I decided today that if i dont fix this issue i wont come back to it again. But with this magic line i was able to fix it. Thank you very much….:)

  5. 5
    Keith Says:

    thanks for saving me hours of work. i was sharing an apple drive
    via cifs and couldn’t figure out why apache only served partial pages where images and pages were half loaded. its weird that you could press reload on firefox and it would slowly add the rest of the image. but you had to click like 10 times to get the whole page. IE would just say its broken.

    after adding EnableSendfile off to the httpd.conf file and restarting, everything was fixed!

    thank you so much.

    -keith

  6. 6
    Matt Says:

    Thanks, this has been driving me mad for hours!

  7. 7
    Brian Says:

    Thank you very much for this post… I’m not exactly new to the game, and this was a real stumper! Google has now indexed you well!

Leave a Reply

© 2012 The Cult of Gary | Entries (RSS) and Comments (RSS)

GPSwordpress logo