Re: SIGUSR1 pingpong between master na autovacum launcher causes crash

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SIGUSR1 pingpong between master na autovacum launcher causes crash
Date: 2009-08-21 19:40:14
Message-ID: 20090821194014.GK5487@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Zdenek Kotala wrote:

> The problem what I see here is that StartAutovacuumWorker() fails and
> send SIGUSR1 to the postmaster, but it send it too quickly and signal
> handler is still active. When signal mask is unblocked in
> sigusr1_handler() than signal handler is run again...
>
> The reason why StartAutovacuumWorker() is interesting. Log says:
>
> LOG: could not fork autovacuum worker process: Not enough space

Does this mean that the machine is out of swap space?

> It is strange and I don't understand it. May be too many nested signal
> handlers call could cause it.
>
> Strange also is that 100ms is not enough to protect this situation, but
> I think that sleep could interrupted by signal.
>
> My suggestion is to set for example gotUSR1=true in sigusr1_handler()
> and in the server loop check if we got a USR1 signal. It avoids any
> problems with signal handler which is not currently POSIX compliant
> anyway.

What 100ms? The pg_usleep call you see in ServerLoop is only there
during shutdown; normally it would be the select() call that would be
blocking the process.

If sigusr1_handler needs rewriting, don't all the other sighandler as
well? Note that the process is supposed to be running with signals
blocked all the time except during those sleep/select calls, which is
what (according to comments) let the sighandlers do nontrivial tasks.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zdenek Kotala 2009-08-21 20:01:23 Re: SIGUSR1 pingpong between master na autovacum launcher causes crash
Previous Message Josh Berkus 2009-08-21 19:14:12 Re: Feedback about Drupal SQL debugging