Re: Fixing order of resowner cleanup in 12, for Windows

2019-05-16 Thread Thomas Munro
On Thu, May 9, 2019 at 10:23 PM Thomas Munro wrote: > The reason the patch didn't solve the problem is that > AtEOXact_Parallel() calls DestroyParallelContext(). So DSM segments > that happen to belong to ParallelContext objects are already gone by > the time resowner.c gets involved. This was l

Re: Fixing order of resowner cleanup in 12, for Windows

2019-05-09 Thread Thomas Munro
On Tue, May 7, 2019 at 6:08 AM Robert Haas wrote: > On Mon, May 6, 2019 at 1:58 PM Tom Lane wrote: > > Robert Haas writes: > > > Right. That's why I favor applying the change to move DSM cleanup to > > > the end for now, and seeing how that goes. It could be that we'll > > > eventually discove

Re: Fixing order of resowner cleanup in 12, for Windows

2019-05-06 Thread Robert Haas
On Mon, May 6, 2019 at 1:58 PM Tom Lane wrote: > Robert Haas writes: > > Right. That's why I favor applying the change to move DSM cleanup to > > the end for now, and seeing how that goes. It could be that we'll > > eventually discover that doing it before all of the AtEOXact_BLAH > > functions

Re: Fixing order of resowner cleanup in 12, for Windows

2019-05-06 Thread Tom Lane
Robert Haas writes: > Right. That's why I favor applying the change to move DSM cleanup to > the end for now, and seeing how that goes. It could be that we'll > eventually discover that doing it before all of the AtEOXact_BLAH > functions have had a short at doing their thing is still too early,

Re: Fixing order of resowner cleanup in 12, for Windows

2019-05-06 Thread Robert Haas
On Mon, May 6, 2019 at 1:32 PM Tom Lane wrote: > Robert Haas writes: > > I have a thought about this. It seems to me that when it comes to > > backend-private memory, we release it even later: aborting the > > transaction does nothing, and we do it only later when we clean up the > > transaction

Re: Fixing order of resowner cleanup in 12, for Windows

2019-05-06 Thread Tom Lane
Robert Haas writes: > I have a thought about this. It seems to me that when it comes to > backend-private memory, we release it even later: aborting the > transaction does nothing, and we do it only later when we clean up the > transaction. So I wonder whether we're going to find that we actuall

Re: Fixing order of resowner cleanup in 12, for Windows

2019-05-06 Thread Robert Haas
On Thu, May 2, 2019 at 10:15 AM Tom Lane wrote: > Thomas Munro writes: > > A while back I posted a patch[1] to change the order of resowner > > cleanup so that DSM handles are released last. That's useful for the > > error cleanup path on Windows, when a SharedFileSet is cleaned up (a > > mechan

Re: Fixing order of resowner cleanup in 12, for Windows

2019-05-06 Thread Amit Kapila
On Mon, May 6, 2019 at 4:41 PM Thomas Munro wrote: > > On Mon, May 6, 2019 at 9:26 PM Amit Kapila wrote: > > > If so, I am getting it both before and after your patch. > > Huh. I thought the only problem here was the phenomenon demonstrated > by [1]. I'm a bit stumped... if we've closed all the

Re: Fixing order of resowner cleanup in 12, for Windows

2019-05-06 Thread Thomas Munro
On Mon, May 6, 2019 at 9:26 PM Amit Kapila wrote: > On Mon, May 6, 2019 at 3:43 AM Thomas Munro wrote: > > Here's a way to produce an error which might produce the log message > > on Windows. Does anyone want to try it? > > I can give it a try. Thanks! > > If it does produce the log message, t

Re: Fixing order of resowner cleanup in 12, for Windows

2019-05-06 Thread Amit Kapila
On Mon, May 6, 2019 at 3:43 AM Thomas Munro wrote: > > On Fri, May 3, 2019 at 2:15 AM Tom Lane wrote: > > Thomas Munro writes: > > > A while back I posted a patch[1] to change the order of resowner > > > cleanup so that DSM handles are released last. That's useful for the > > > error cleanup pa

Re: Fixing order of resowner cleanup in 12, for Windows

2019-05-05 Thread Thomas Munro
On Mon, May 6, 2019 at 3:44 PM Tom Lane wrote: > Thomas Munro writes: > > On Mon, May 6, 2019 at 11:07 AM Tom Lane wrote: > >> ... You're not doing future > >> hackers any service by failing to include a comment that explains that > >> DSM detach MUST BE LAST, and explaining why. > > > Ok, here'

Re: Fixing order of resowner cleanup in 12, for Windows

2019-05-05 Thread Tom Lane
Thomas Munro writes: > On Mon, May 6, 2019 at 11:07 AM Tom Lane wrote: >> ... You're not doing future >> hackers any service by failing to include a comment that explains that >> DSM detach MUST BE LAST, and explaining why. > Ok, here's a version that provides a specific reason (the Windows file

Re: Fixing order of resowner cleanup in 12, for Windows

2019-05-05 Thread Thomas Munro
On Mon, May 6, 2019 at 11:07 AM Tom Lane wrote: > One thing I don't care for about this patch is that the original code > looked like it didn't matter what order we did the resource releases in, > and the patched code still looks like that. You're not doing future > hackers any service by failing

Re: Fixing order of resowner cleanup in 12, for Windows

2019-05-05 Thread Tom Lane
Thomas Munro writes: > If it does produce the log message, then the attached patch should > make it go away. One thing I don't care for about this patch is that the original code looked like it didn't matter what order we did the resource releases in, and the patched code still looks like that.

Re: Fixing order of resowner cleanup in 12, for Windows

2019-05-05 Thread Thomas Munro
On Fri, May 3, 2019 at 2:15 AM Tom Lane wrote: > Thomas Munro writes: > > A while back I posted a patch[1] to change the order of resowner > > cleanup so that DSM handles are released last. That's useful for the > > error cleanup path on Windows, when a SharedFileSet is cleaned up (a > > mechani

Re: Fixing order of resowner cleanup in 12, for Windows

2019-05-02 Thread Tom Lane
Thomas Munro writes: > A while back I posted a patch[1] to change the order of resowner > cleanup so that DSM handles are released last. That's useful for the > error cleanup path on Windows, when a SharedFileSet is cleaned up (a > mechanism that's used by parallel CREATE INDEX and parallel hash

Fixing order of resowner cleanup in 12, for Windows

2019-05-02 Thread Thomas Munro
Hi all, A while back I posted a patch[1] to change the order of resowner cleanup so that DSM handles are released last. That's useful for the error cleanup path on Windows, when a SharedFileSet is cleaned up (a mechanism that's used by parallel CREATE INDEX and parallel hash join, for spilling fi