Re: PATCH: pg_restore parallel-execution-deadlock issue

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Armin Schöffmann <armin(dot)schoeffmann(at)aegaeon(dot)de>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: pg_restore parallel-execution-deadlock issue
Date: 2016-05-27 07:07:03
Message-ID: CAA4eK1JZtRUzL2=heRHSfmoBtxk=4XO=ySW1CK5KRrwyCLq9zA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, May 27, 2016 at 3:05 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Michael Paquier <michael(dot)paquier(at)gmail(dot)com> writes:
> > ea274b2 has changed the way disconnection is done is is now closing
> > both the read and write pipes. So you may want to retry if things get
> > better with the next round of minor releases.
>
> Hadn't paid attention to this thread before ...
>
> It looks like there are still a few things we need to deal with before
> considering Armin's submission resolved:
>
> 1. Armin proposes using "shutdown(pipeWrite, SD_BOTH)" where the code
> committed this morning (df8d2d8c4) has "closesocket(pipeWrite)".
> I'd prefer to leave it that way since it's the same as for the Unix case,
> and Kyotaro-san says it works for him. Is there a reason we'd need
> shutdown() instead?
>
> 2. Armin proposes that WaitForTerminatingWorkers needs to do CloseHandle()
> on the various thread handles. That sounds plausible but I don't know
> enough Windows programming to know if it really matters.
>
> 3. Should we replace ExitThread() with _endthreadex()? Again, it
> seems plausible but I'm not the person to ask.
>

I think point (2) and (3) are related because using _endthreadex won't
close the thread handle explicitly [1].

[1] - https://msdn.microsoft.com/en-us/library/kdzttdcb.aspx
Refer line "*_endthread* automatically closes the thread handle, whereas
*_endthreadex* does not."

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2016-05-27 07:17:17 Re: Allow COPY to use parameters
Previous Message Piotr Stefaniak 2016-05-27 06:13:48 Re: pg_bsd_indent - improvements around offsetof and sizeof