10 Apr
2014
10 Apr
'14
9:20 a.m.
Stefan Winter wrote:
My colleague Bruno investigated this further. It looks like the fcntl() locking doesn't catch all corner cases. He writes:
Yes. This is a surprising side-effect of locks.
We think we fixed it locally (Bruno's patch attached) by combining both strings into one write() as I suggested earlier.
That will help, but not be perfect. If we're just blocking other threads from writing at the same time, a mutex around the write() is sufficient. If we need to lock the file from readers, then the module needs to use ONE file descriptor to write to the file. That descriptor needs to be shared by ALL threads. Ugh. Sometimes posix is crazy. Alan DeKok.