Re: CI/windows docker vs "am a service" autodetection on windows

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
Subject: Re: CI/windows docker vs "am a service" autodetection on windows
Date: 2021-03-04 20:08:30
Message-ID: CABUevEwiiU-kzoqKbBt91UL4c2Ln8dQQmXrk1rBcKHFCpxoLcA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Mar 4, 2021 at 8:33 PM Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>
>
> On 3/4/21 2:08 PM, Andres Freund wrote:
> > [...] pgwin32_is_service() doesn't actually reliably detect if running as
> > a service - it's a heuristic that also triggers when running postgres
> > within a windows docker container (presumably because that itself is run
> > from within a service?).
> >
> >
> > ISTM that that's a problem, and is likely to become more of a problem
> > going forward (assuming that docker on windows will become more
> > popular).
> >
> >
> > My opinion is that the whole attempt at guessing whether we are running
> > as a service is a bad idea. This isn't the first time to be a problem,
> > see e.g. [1].
> >
> > Why don't we instead have pgwin32_doRegister() include a parameter that
> > indicates we're running as a service and remove all the heuristics?
>
>
>
> I assume you mean a postmaster parameter, that would be set via pg_ctl?
> Seems reasonable.

The problem with doing it at register time is that everybody who
builds an installer for PostgreSQL will then have to do it in their
own registration (I'm pretty sure most of them don't use pg_ctl
register).

The same thing in pgwin32_doRunAsService() might help with that. But
then we'd have to figure out what to do if pg_ctl fails prior to
reaching that point... There aren't that many such paths, but there
are some.

Just throwing out ideas without spending time thinking about it, maybe
log to *both* in the case when we pick by it by autodetection?

--
Magnus Hagander
Me: https://www.hagander.net/
Work: https://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2021-03-04 20:29:28 Re: PROXY protocol support
Previous Message Jacob Champion 2021-03-04 20:07:45 Re: PROXY protocol support