3 ms·
This VirtualBox bug was the reason that I started reading more about sendfile and encountered this article about nginx optimizations. The bug actually causes re
by dirtyaura 12y ago
This VirtualBox bug was the reason that I started reading more about sendfile and encountered this article about nginx optimizations. The bug actually causes really weird behavior, in which extra bytes are added at the end of the file.
- defen 12y agoIt doesn't really add extra bytes - it "remembers" the original size of the file. So if you update the file to be larger, you only get the first N bytes. If you update it to be smaller, you get the full file + zero bytes at the end to fill out the remainder. If you can't turn off sendfile for some reason, the workaround is to delete the file every time before saving it.
- dirtyaura 12y agoThanks, enlightening. And is this because due to some implementation difficulties for sendfile when using shared file system between the box and the host machine?
- lsaferite 12y agoI JUST ran into this issue this weekend! Glad to know I'm not going insane. Do you have any links specifically discussing the issue?
- dirtyaura 12y agoYes, this StackOverflow answer solved the mystery for me http://stackoverflow.com/questions/12719859/syntaxerror-unexpected-token-illegal/23487194#23487194 http://stackoverflow.com/questions/12719859/syntaxerror-unex... I then found out that it is actually mentioned in the Vagrant docs also: https://docs.vagrantup.com/v2/synced-folders/virtualbox.html https://docs.vagrantup.com/v2/synced-folders/virtualbox.html
- falcolas 12y agohttps://www.virtualbox.org/ticket/9069 https://www.virtualbox.org/ticket/9069 Google for 'virtualbox sendfile' and there's a lot of discussion. Worth noting, and this bit me recently, Go's http file handler also uses sendfile beneath the covers.
- developer1 12y agoHaha omg this issue. I came across this about a year ago, and it took forever to diagnose the problem. Who would think to look for a specific declaration in the web server config? I thought for the longest time it was a problem with my host<->guest mount. Glad to see other people suffering similarly :p