Re: Async-unsafe functions in signal handlers

Поиск
Список
Период
Сортировка
Искать
От
Denis Smirnov
Тема
Re: Async-unsafe functions in signal handlers
Дата
Msg-id
86F918AA-AE0E-4EAB-B6C1-7000043EAB50@arenadata.io
Ответ на
Список
Дерево обсуждения
Async-unsafe functions in signal handlers Denis Smirnov <sd@arenadata.io>
Re: Async-unsafe functions in signal handlers Andrey Borodin <x4mmm@yandex-team.ru>
Re: Async-unsafe functions in signal handlers Denis Smirnov <sd@arenadata.io>
Re: Async-unsafe functions in signal handlers Robert Haas <robertmhaas@gmail.com>
Re: Async-unsafe functions in signal handlers Tom Lane <tgl@sss.pgh.pa.us>
Re: Async-unsafe functions in signal handlers Denis Smirnov <sd@arenadata.io>
Re: Async-unsafe functions in signal handlers Andres Freund <andres@anarazel.de>
Re: Async-unsafe functions in signal handlers Denis Smirnov <sd@arenadata.io>
Re: Async-unsafe functions in signal handlers Denis Smirnov <sd@arenadata.io>

> 26 авг. 2021 г., в 23:39, Tom Lane  написал(а):
> 
> (BTW, I think it's pretty silly to imagine that adding backtrace()
> calls inside ereport is making things any more dangerous.  ereport
> has pretty much always carried a likelihood of calling malloc(),
> for example.)

I have taken a look through the signal handlers and found out that many of them use malloc() via ereport() and elog(). Here is the list:

SIGUSR1
- procsignal_sigusr1_handler(): autoprewarm, autovacuum, bgworker, bgwriter, checkpointer, pgarch, startup, walwriter, walreciever, walsender
- sigusr1_handler(): postmaster

SIGFPE:
- FloatExceptionHandler(): autovacuum, bgworker, postgres, plperl

SIGHUP:
- SIGHUP_handler(): postmaster

SIGCHLD:
- reaper(): postmaster

SIGQUIT:
- quickdie(): postgres

SIGTERM:
- bgworker_die(): bgworker

SIGALRM:
- handle_sig_alarm(): autovacuum, bgworker, postmaster, startup, walsender, postgres

I suspect there are lots of potential ways to lock on malloc() inside any of this handlers. An interesting question is why there are still no evidence of such locks?

Best regards,
Denis Smirnov | Developer
sd@arenadata.io 
Arenadata | Godovikova 9-17, Moscow 129085 Russia



В списке pgsql-hackers по дате отправления
От: Peter Geoghegan
Дата:
От: Andres Freund
Дата:
FAQ