Re: Should we nonblocking open FIFO files in COPY?

From: Andres Freund <andres(at)anarazel(dot)de>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Adam Lee <ali(at)pivotal(dot)io>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Heikki Linnakangas <hlinnakangas(at)pivotal(dot)io>, Daniel Gustafsson <dgustafsson(at)pivotal(dot)io>, Ming Li <mli(at)pivotal(dot)io>
Subject: Re: Should we nonblocking open FIFO files in COPY?
Date: 2017-12-29 19:20:08
Message-ID: 20171229192008.wubxztqt7roh2idk@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2017-12-26 22:30:08 -0800, Robert Haas wrote:
> On Tue, Dec 26, 2017 at 7:51 PM, Michael Paquier
> <michael(dot)paquier(at)gmail(dot)com> wrote:
> >> > Hmm. What about the case where we try to open a plain file that's on
> >> > an inaccessible filesystem, e.g. due to a disk failure? Allowing
> >> > cancel to work just for FIFOs would be OK, I guess, but allowing it
> >> > for other open() calls that hang would be better. I'm not sure if we
> >> > can make it work that way, but it would be nice if we could.

I doubt it's realistic to make pg resilient in case of FS problems like
that. Partially because the OS level handling usually is very haphazard
and inconsistent, and partially because the amount of work to get there
seems quite significant with only a small payoff.

> >> That is doable, just stat() and check before open().
> >
> > I think TOCTOU when I read such things.. The data folder is a trusted
> > environment but any patches doing things like that ought to be careful.
>
> Yeah. I was more wondering whether an ostensibly non-blocking open()
> would nevertheless block on an inaccessible file.

It very likely would, depending on the type of error. Or stat() would
end up being stuck somewhere in the kernel while it's retrying IO for a
lengthy amount of time.

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2017-12-29 19:24:19 Re: Deadlock in multiple CIC.
Previous Message Vladimir Svedov 2017-12-29 18:57:51 Re: array_ndims never returns zero