Ticket #12597 (new defect)

Opened 5 years ago

Last modified 3 years ago

sendfile syscall returns cached content

Reported by: MaximKulkin Owned by:
Component: shared folders Version: VirtualBox 4.2.18
Keywords: sendfile Cc:
Guest type: other Host type: Linux


When using shared folder and copying file with sendfile syscall (either by just creating another file or sending content over network socket), the receiving end always gets the same content (the content that was in source file when sendfile called for the first time).

Repro steps:

  1. Setup a linux box with shared folder (tested on Ubuntu 13.04).
  2. Compile sendfile-copy.c (attached) inside VM:
    make sendfile-copy
  3. Create a file "foo" in shared folder inside VM with contents "foo".
  4. Use "sendfile-copy" app from step 2 to copy file "foo":
    ./sendfile-copy foo bar
  5. Ensure that file "bar" contains string "foo":
    cat bar
  6. Changed the contents of file "foo" to "bar". Ensure that file "foo" now contains "bar":
    cat foo
  7. Copy file "foo" to "baz" with "sendfile-copy":
    ./sendfile-copy foo baz
  8. Inspect the contents of file "baz":
    cat baz

You will see "foo" instead of "bar".


sendfile-copy.c Download (766 bytes) - added by MaximKulkin 5 years ago.

Change History

Changed 5 years ago by MaximKulkin

comment:1 Changed 4 years ago by CleanCut

This prevents me from mounting volumes into docker containers in my development environment. They work initially, but when a file changes, everything messes up. The behavior I see is this:

If the file is changed but stays the same size we will call X:

  • the container sees the original file

If the file is changed to be a shorter amount of bytes Y:

  • the container sees the first Y bytes of the original file

If the file is changed to be a longer amount of bytes Z:

  • the container sees the original file plus (Z - X) bytes of garbage.

comment:2 Changed 3 years ago by DHa


Related to #9069, which is less detailed but contains possible workaround.

comment:3 Changed 3 years ago by doozr


I created #14920 with detailed instructions on how to replicate in Docker. Also posted it to #9069.

comment:4 Changed 3 years ago by bronek

Related: #819, #9069, #14920

Note: See TracTickets for help on using tickets.
ContactPrivacy policyTerms of Use