Welcome! Log In Create A New Profile

Advanced

Re: call ngx_localtime may cause deadlock?

Maxim Dounin
March 04, 2010 08:02PM
Hello!

On Thu, Mar 04, 2010 at 10:54:56PM +0300, Igor Sysoev wrote:

> On Thu, Mar 04, 2010 at 07:49:57PM +0300, Maxim Dounin wrote:

[...]

> > This isn't really relevant though as underlying problem is in
> > nginx and should be fixed anyway. Only async-signal-safe
> > functions may be used in signal handlers, anything else leads to
> > undefined behaviour.
>
> Strickly speaking the generic signal handler calls localtime/_r() too:
> ngx_time_update(0, 0);
>
> And if timer_resolution bug can be fixed easy, nevertheless, I do not
> know how to log local time in singal handler without localtime().

Well, I see 3 basic options:

1. Handle signals in the event loop (at least kqueue supports it,
for other methods we may use pipe() to deliver signals to event
loop safely). This is basically how libevent does this, btw.

2. Limit signal handlers to use only async-signal-safe functions,
and nothing more. This means that time won't be correct (no
localtime()), errno (if any) won't be translated to text (no
strerror_r()) etc.

3. Pretend we never talked about it and problems shouldn't happen
as generic signals are rare (and we already try to follow (2),
though not completely).

Maxim Dounin

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

call ngx_localtime may cause deadlock?

georgexsh March 04, 2010 05:09AM

Re: call ngx_localtime may cause deadlock?

Maxim Dounin March 04, 2010 07:18AM

Re: call ngx_localtime may cause deadlock?

Igor Sysoev March 04, 2010 07:26AM

Re: call ngx_localtime may cause deadlock?

georgexsh March 04, 2010 10:20AM

Re: call ngx_localtime may cause deadlock?

Maxim Dounin March 04, 2010 11:54AM

Re: call ngx_localtime may cause deadlock?

Igor Sysoev March 04, 2010 02:58PM

Re: call ngx_localtime may cause deadlock?

Maxim Dounin March 04, 2010 08:02PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 129
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