Vasily Soshnikov dedok.mad at
Thu Mar 29 09:11:00 UTC 2018


The UNIX-like system does not guarantee atomic write to a file (i.e.
regular file). Actual, it works sometimes and for some system with tons of
limitation. I prefer to avoid this practice.

What can you do? You can lock (i.e. flock() and so on) file for writing,
It's synchronization of concurrent access.

Also, I suggest reading about fsync(), fdatasync() and kernel cache, if you
wish to avoid the power-off problem.

On 29 March 2018 at 11:51, Antonio Nappa <jeppojeps at> wrote:

> Hi,
> I was wondering what happens with ngx_write_fd function and multiple
> workers, I have made some tests and it doesn't look like they are
> interfering with each other and writing in the middle of a line. However I
> am not sure, that's the reason of my question. The file was opened with the
> ngx_conf_open_file.
> Thanks,
> Antonio
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at


*Regard,Soshnikov Vasily mailto:dedok.mad at <dedok.mad at>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx-devel mailing list