Re: core dumps in auto_prewarm, tests succeed

Поиск
Список
Период
Сортировка
От Nathan Bossart
Тема Re: core dumps in auto_prewarm, tests succeed
Дата
Msg-id 20240122211936.GA1952414@nathanxps13
обсуждение исходный текст
Ответ на Re: core dumps in auto_prewarm, tests succeed  (Nathan Bossart <nathandbossart@gmail.com>)
Ответы Re: core dumps in auto_prewarm, tests succeed  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
On Mon, Jan 22, 2024 at 02:44:57PM -0600, Nathan Bossart wrote:
> On Mon, Jan 22, 2024 at 12:41:17PM -0800, Andres Freund wrote:
>> I noticed that I was getting core dumps while executing the tests, without the
>> tests failing. Backtraces are vriations of this:
> 
> Looking, thanks for the heads-up.

I think this is because the autoprewarm state was moved to a DSM segment,
and DSM segments are detached before the on_shmem_exit callbacks are called
during process exit.  Moving apw_detach_shmem to the before_shmem_exit list
seems to resolve the crashes.

diff --git a/contrib/pg_prewarm/autoprewarm.c b/contrib/pg_prewarm/autoprewarm.c
index 9ea6c2252a..88c3a04109 100644
--- a/contrib/pg_prewarm/autoprewarm.c
+++ b/contrib/pg_prewarm/autoprewarm.c
@@ -165,7 +165,7 @@ autoprewarm_main(Datum main_arg)
         first_time = false;
 
     /* Set on-detach hook so that our PID will be cleared on exit. */
-    on_shmem_exit(apw_detach_shmem, 0);
+    before_shmem_exit(apw_detach_shmem, 0);
 
     /*
      * Store our PID in the shared memory area --- unless there's already

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Matthias van de Meent
Дата:
Сообщение: Re: Optimizing nbtree ScalarArrayOp execution, allowing multi-column ordered scans, skip scan
Следующее
От: Andres Freund
Дата:
Сообщение: Re: core dumps in auto_prewarm, tests succeed