Re: Autovacuum launcher occurs error when cancelled by SIGINT

From: Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com>
To: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Autovacuum launcher occurs error when cancelled by SIGINT
Date: 2017-06-21 13:20:58
Message-ID: CAGz5QC+9rV3rSuOtYgxy6d_iwb6MNtMaapNFPvujiUkOP96tsQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 21, 2017 at 5:45 PM, Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> wrote:
> Hi,
>
> As I report in another thread[1], I found the autovacuum launcher occurs
> the following error in PG 10 when this received SIGINT. I can repuroduce
> this by pg_cancel_backend or `kill -2 <pid of autovacuum laucher>`.
>
> 2017-06-21 13:56:07.010 JST [32483] ERROR: canceling statement due to user request
> 2017-06-21 13:56:08.022 JST [32483] ERROR: can't attach the same segment more than once
> 2017-06-21 13:56:09.034 JST [32483] ERROR: can't attach the same segment more than once
> 2017-06-21 13:56:10.045 JST [32483] ERROR: can't attach the same segment more than once
> ...
>
> This errors continue until this process is terminated or the server is restarted.
>
> When SIGINT is issued, the process exits from the main loop and returns
> to sigsetjmp, and calls dsa_attach() before entering into the loop again,
> this causes the error.
>
> We can fix it by calling dsa_attach() before sigsetjmp. Attached is the patch.
>
I think we can just check dsm_find_mapping() to check whether the dsm
handle is already attached. Something like,

}
- else
+ else if(!dsm_find_mapping(AutoVacuumShmem->av_dsa_handle))
{
AutoVacuumDSA = dsa_attach(AutoVacuumShmem->av_dsa_handle);
dsa_pin_mapping(AutoVacuumDSA);

Thoughts?

--
Thanks & Regards,
Kuntal Ghosh
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2017-06-21 13:37:44 Re: Autovacuum launcher occurs error when cancelled by SIGINT
Previous Message Albe Laurenz 2017-06-21 13:02:16 Logical replication: stuck spinlock at ReplicationSlotRelease