Обсуждение: None-reentrant function call in signal handler startup_die()

Поиск
Список
Период
Сортировка

None-reentrant function call in signal handler startup_die()

От
"samuel.coulee"
Дата:
Hi,

I found that in the PG source code function BackendInitialize(), handler for
SIGTERM was set to be startup_die().  And in startup_die(), we simply call
proc_exit to exit the process. 

What's more, early in BackendInitialize() function, we called pq_init to
setup socket_close() as a process exit callback.

The problem is: in socket_close, we have some none-reentrant calls like
free(). It may cause deadlock of this backend if we are excueting
malloc/free right before we step into the signal hander startup_die(). And I
experienced that on my local server :)

Similar to the problem in this thread:
https://www.postgresql-archive.org/PG-signal-handler-and-non-reentrant-malloc-free-calls-td3403162.html.

Is there a way to avoid this deadlock in startup_die()? Thanks.. 




--
Sent from: http://www.postgresql-archive.org/PostgreSQL-hackers-f1928748.html