[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Make run in parallel mode with output redirected to a regular file c

From: Eli Zaretskii
Subject: Re: Make run in parallel mode with output redirected to a regular file can randomly drop output lines
Date: Mon, 27 May 2013 22:13:34 +0300

> From: Paul Smith <address@hidden>
> Cc: Frank Heckenbach <address@hidden>, address@hidden,
>   address@hidden
> Date: Mon, 27 May 2013 14:09:42 -0400
> The original issue reported is that if you do something like this:
>     make -j >make.out
> and your make environment is recursive so you invoke one or more
> sub-makes, your output may not just be interspersed (that is output
> between multiple jobs are mixed together) but you will actually lose
> some output: it will never appear at all.
> The reason is that when you have multiple processes trying to update the
> same file at the same time using standard output file mode, there is a
> race condition between when the output is written to the file and when
> the "current offset" value is updated, where multiple processes could be
> overwriting the same part of the file.

It sounds strange to me that the filesystem doesn't serialize the
writes.  Maybe I'm naive.

> POSIX guarantees that if you open a file in O_APPEND mode, the above
> race can never happen because the kernel updates the file offset as the
> file is being written.
> Frank's question is whether other, non-POSIX systems have the same
> behavior with O_APPEND.

I will have to try that to know for sure.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]