ngx_write_fd

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


Hi,

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 gmail.com> 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 nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>



-- 




*Regard,Soshnikov Vasily mailto:dedok.mad at gmail.com <dedok.mad at gmail.com>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20180329/c2d225d6/attachment-0001.html>


More information about the nginx-devel mailing list