Re: potential stuck lock in SaveSlotToPath()

2020-04-05 Thread Peter Eisentraut
On 2020-04-02 08:21, Michael Paquier wrote: On Wed, Apr 01, 2020 at 04:26:25PM +0200, Peter Eisentraut wrote: Good catch. How about the attached patch? WFM. Another trick would be to call LWLockRelease() after generating the log, but I find your patch more consistent with the surroundings.

Re: potential stuck lock in SaveSlotToPath()

2020-04-01 Thread Michael Paquier
On Wed, Apr 01, 2020 at 04:26:25PM +0200, Peter Eisentraut wrote: > Good catch. How about the attached patch? WFM. Another trick would be to call LWLockRelease() after generating the log, but I find your patch more consistent with the surroundings. -- Michael signature.asc Description: PGP sig

Re: potential stuck lock in SaveSlotToPath()

2020-04-01 Thread Peter Eisentraut
On 2020-03-27 08:48, Michael Paquier wrote: On Thu, Mar 26, 2020 at 02:16:05PM +0100, Peter Eisentraut wrote: committed and backpatched The patch committed does that in three places: /* rename to permanent file, fsync file and directory */ if (rename(tmppath, path) != 0) { +

Re: potential stuck lock in SaveSlotToPath()

2020-03-27 Thread Michael Paquier
On Thu, Mar 26, 2020 at 02:16:05PM +0100, Peter Eisentraut wrote: > committed and backpatched The patch committed does that in three places: /* rename to permanent file, fsync file and directory */ if (rename(tmppath, path) != 0) { + LWLockRelease(&slot->io_in_progress_lock);

Re: potential stuck lock in SaveSlotToPath()

2020-03-26 Thread Peter Eisentraut
On 2020-03-25 17:56, Robert Haas wrote: On Wed, Mar 25, 2020 at 6:13 AM Peter Eisentraut wrote: Any concerns about applying and backpatching the patch I posted? Not from me. The talk about reorganizing this code doesn't seem very concrete at the moment and would probably not be backpatch ma

Re: potential stuck lock in SaveSlotToPath()

2020-03-25 Thread Robert Haas
On Wed, Mar 25, 2020 at 6:13 AM Peter Eisentraut wrote: > Any concerns about applying and backpatching the patch I posted? Not from me. > The talk about reorganizing this code doesn't seem very concrete at the > moment and would probably not be backpatch material anyway. +1. -- Robert Haas En

Re: potential stuck lock in SaveSlotToPath()

2020-03-25 Thread Alvaro Herrera
On 2020-Mar-25, Peter Eisentraut wrote: > On 2020-03-20 16:38, Robert Haas wrote: > > On Fri, Mar 20, 2020 at 11:32 AM Peter Eisentraut > > wrote: > > > On 2020-03-19 16:38, Robert Haas wrote: > > > > Incidentally, the wait-event handling in SaveSlotToPath() doesn't look > > > > right for the ear

Re: potential stuck lock in SaveSlotToPath()

2020-03-25 Thread Peter Eisentraut
On 2020-03-20 16:38, Robert Haas wrote: On Fri, Mar 20, 2020 at 11:32 AM Peter Eisentraut wrote: On 2020-03-19 16:38, Robert Haas wrote: Incidentally, the wait-event handling in SaveSlotToPath() doesn't look right for the early-exit cases either. There appear to be appropriate pgstat_report_

Re: potential stuck lock in SaveSlotToPath()

2020-03-20 Thread Robert Haas
On Fri, Mar 20, 2020 at 11:32 AM Peter Eisentraut wrote: > On 2020-03-19 16:38, Robert Haas wrote: > > Incidentally, the wait-event handling in SaveSlotToPath() doesn't look > > right for the early-exit cases either. > > There appear to be appropriate pgstat_report_wait_end() calls. What are > yo

Re: potential stuck lock in SaveSlotToPath()

2020-03-20 Thread Peter Eisentraut
On 2020-03-19 16:38, Robert Haas wrote: Incidentally, the wait-event handling in SaveSlotToPath() doesn't look right for the early-exit cases either. There appear to be appropriate pgstat_report_wait_end() calls. What are you seeing? -- Peter Eisentraut http://www.2ndQuadrant.c

Re: potential stuck lock in SaveSlotToPath()

2020-03-19 Thread Robert Haas
On Wed, Mar 18, 2020 at 4:25 PM Andres Freund wrote: > I don't see a valid reason for that though - if anything it's dangerous, > because we're not persistently saving the slot. It should fail the > checkpoint imo. Robert, do you have an idea? Well, the comment atop SaveSlotToPath says: * This

Re: potential stuck lock in SaveSlotToPath()

2020-03-18 Thread Andres Freund
Hi, On 2020-03-18 16:54:19 -0300, Alvaro Herrera wrote: > On 2020-Mar-18, Andres Freund wrote: > > On 2020-03-18 16:46:23 +0100, Peter Eisentraut wrote: > > > When SaveSlotToPath() is called with elevel=LOG, the early exits don't > > > release the slot's io_in_progress_lock. Fix attached. > > >

Re: potential stuck lock in SaveSlotToPath()

2020-03-18 Thread Thomas Munro
On Thu, Mar 19, 2020 at 4:46 AM Peter Eisentraut wrote: > [patch] + * releaseing even in that case. Typo.

Re: potential stuck lock in SaveSlotToPath()

2020-03-18 Thread Alvaro Herrera
On 2020-Mar-18, Andres Freund wrote: > Hi, > > On 2020-03-18 16:46:23 +0100, Peter Eisentraut wrote: > > When SaveSlotToPath() is called with elevel=LOG, the early exits don't > > release the slot's io_in_progress_lock. Fix attached. > > I'm a bit confused as to why we we ever call it with elev

Re: potential stuck lock in SaveSlotToPath()

2020-03-18 Thread Andres Freund
Hi, On 2020-03-18 16:46:23 +0100, Peter Eisentraut wrote: > When SaveSlotToPath() is called with elevel=LOG, the early exits don't > release the slot's io_in_progress_lock. Fix attached. I'm a bit confused as to why we we ever call it with elevel = LOG (i.e. why we have the elevel parameter at a

potential stuck lock in SaveSlotToPath()

2020-03-18 Thread Peter Eisentraut
When SaveSlotToPath() is called with elevel=LOG, the early exits don't release the slot's io_in_progress_lock. Fix attached. This could result in a walsender being stuck on the lock forever. A possible way to get into this situation is if the offending code paths are triggered in a low disk