Re: pg_ctl behavior on Windows

Поиск
Список
Период
Сортировка
От Amit Kapila
Тема Re: pg_ctl behavior on Windows
Дата
Msg-id CAA4eK1+zwF3oXMVFy8shsAEG7aGVtg8jGGfwk4Lc_5eHVUywTg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pg_ctl behavior on Windows  (Chapman Flack <chap@anastigmatix.net>)
Список pgsql-hackers
On Sat, Jul 18, 2020 at 6:31 PM Chapman Flack <chap@anastigmatix.net> wrote:
>
> On 07/18/20 05:46, Amit Kapila wrote:
> > I don't think so.  I think you can use 'pg_ctl start' to achieve that.
> > I think the JOBS stuff is primarily required when we use 'register'
> > operation (aka runs server via service). For example, if you see one
> > of the Job options "JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION", it
> > suppresses dialog box for a certain type of errors and causes a
> > termination of the process with the exception code as the exit status
>
> Thanks very much, that helps a lot. I still wonder, though, about some
> of the other limits also placed on that job object, such as
> JOB_OBJECT_SECURITY_NO_ADMIN | JOB_OBJECT_SECURITY_ONLY_TOKEN
>
> Those seem closely related to the purpose of CreateRestrictedProcess.
> Does the NOTE! mean that, when not running as a service, the job object
> disappears as soon as pg_ctl exits,
>

From the comments in that part of code, it seems like Job object will
be closed as soon as pg_ctl exits.  However, as per my understanding
of specs [1], it will be closed once the process with which it is
associated is gone which in this case should be the new process
created with "CreateProcessAsUser".  This has been added by the below
commit, so Magnus might remember something about this.

commit a25cd81007e827684343a53a80e8bc90f585ca8e
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date:   Fri Feb 10 22:00:59 2006 +0000

    Enable pg_ctl to give up admin privileges when starting the server under
    Windows (if newer than NT4, else works same as before).

    Magnus


[1] - https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createjobobjecta

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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Fujii Masao
Дата:
Сообщение: Re: Is it useful to record whether plans are generic or custom?
Следующее
От: Fujii Masao
Дата:
Сообщение: Re: max_slot_wal_keep_size and wal_keep_segments