Welcome! Log In Create A New Profile

Advanced

Re: NGX error logging - Race condition possible?

September 03, 2018 02:16AM
> On 2 Sep 2018, at 21:44, Slawitscheck Stefan via nginx-devel <nginx-devel@nginx.org> wrote:
>
> Dear Development Team,
>
> I have one question about the logging mechanism of nginx with more worker processes under Windows.
>
> In ngx_log.c is the function ngx_write_console() which calls the systemcall WriteFile().
>
> How is do you ensures that there is no race condition while using this function to write into the error.log file with multiple working processes?
>
> From my understanding, each worker process writes into the error.log file by itself. So it could be that there are two processes (worker) trying to write at the same time?
> So usually you need some locking, semaphore, mutex or something like that?
>
> If you ensure that there will be no race condition, how do you guarantee it?
>
> I am looking forward to your answer.

It should be guaranteed by CreateFile options: FILE_APPEND_DATA | SYNCHRONIZE.


--
Igor Sysoev
http://nginx.com

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

NGX error logging - Race condition possible?

Slawitscheck Stefan via nginx-devel 391 September 02, 2018 02:46PM

Re: NGX error logging - Race condition possible?

Igor Sysoev 360 September 03, 2018 02:16AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 60
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready