Hi,
We've found, in nodejs, that on Mac OSX, when write()ing to a disk file in a
tight loop from >= 2 threads, sometimes some write()s seem to fail to write the
data but update the fd's file pointer properly, resulting in strings of zeroes
('holes') of data.length length in the file.
Here's a test case demonstrating the problem: https://gist.github.com/703744
$ curl
'https://gist.github.com/raw/703744/1bfa3c7022995e2f6cf2452a892e1c3b0e245cb7/AppleWiteBug.c'
> bug.c
$ gcc -pthread bug.c
$ ./a.out
->
...
^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@a lo bestia
^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@a lo bestia
^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@a
lo bestia
^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@a lo bestia
^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@a lo bestia
^...@^@^...@^@^...@^@^...@^@^...@^@^...@^@a lo bestia
...
So Ryan has accepted a patch of mine to libeio so as to avoid any write()s to
happen concurrently on OSX only, with a lock/mutex. Here's what we're doing now
: https://github.com/ry/node/commit/6aa92d5289996780834ebd5e9317718b3e55408c
The thing is, Marc, can you look into this, and tell me what you think about it
?
Thanks,
--
Jorge.
_______________________________________________
libev mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev