Skip to content

Instantly share code, notes, and snippets.

@piscisaureus
Created December 9, 2013 19:12
Show Gist options
  • Save piscisaureus/7878977 to your computer and use it in GitHub Desktop.
Save piscisaureus/7878977 to your computer and use it in GitHub Desktop.
OS X threaded pwrite() bug
The issue:
Concurrent pwrite() calls from different threads cause file corruption
on OS X, even if the file regions that are being written to don't
overlap.
We're not sure whether this may have been fixed in more recent versions
of OS X. So far we've been unable to reach someone within apple that
was able to provide more information or could fix it.
Shitty workaround that is in libuv as of today:
https://github.com/joyent/libuv/blob/69d2b69647564657625a6118ba911490d0cedcca/src/unix/fs.c#L497
https://github.com/joyent/libuv/commit/cb03e3bd26587b851552ad8b54b30600e48ef829
The issue also existed in node v0.4 and earlier, before libuv existed:
https://github.com/joyent/node/commit/6aa92d5289996780834ebd5e9317718b3e55408c
https://github.com/joyent/node/issues/1506
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment