Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session

From: Cristian Bittel <cbittel(at)gmail(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Chris Travers <chris(at)metatrontech(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session
Date: 2010-08-31 14:40:33
Message-ID: AANLkTi=-H6Ud8es4Q-kTAECf2VpbWKxvjsTGYz5eawRa@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

I am the "remote" support guy for a web developed application
(Apache+PHP+Pg. Postgres is isolated on a server, Apache runs on another
server), and installed at our client, our client is the Administrator user
on Windows Server, I just have a limited privileges Windows user for
monitoring. I have my own "support" superuser (not "postgres" user) for
Postgres database to monitor the status, logs and to perform stats queries.

To Windows Server I just can login using remote desktop, my interactive user
cannot start or stop the PostgreSQL service or other services, just
Administrators users can do it.

From inside my underprivileged session on the Windows server I can open
pgAdmin and connect to Postgres service. When I left the pgAdmin connected
to Postgres service opened into the Windows session (session connected or
disconnected) and I or someone else (Administrators) "close" my session,
then is when PostgreSQL service crash. If inside the remote session I
normally close pgAdmin using the "X" button or File>Exit or "Ctrl+Q", that
not affect PostgreSQL service.

This is the major reason to think is pgAdmin.exe when forced shutdown by
terminating Windows session which sends abnormal signal to PostgreSQL
service.

Besides the abnormal signal that pgAdmin forced shutingdown could being send
to PostgreSQL service, the service itself also could catch that behavior in
any of the aproaches you are discussing for the service itself to ignore
that signal.

To Dave's question, this behavior occurs on all Windows Server interactive
sessions, no matter if Administrators or underpriviledge users, but is
related to closing Windows interactive session while pgAdmin window is
opened and connected to service. Nobody logon to Windows using "postgres"
service user.

Regards,

Cristian.

2010/8/31 Dave Page <dpage(at)pgadmin(dot)org>

> On Sun, Aug 29, 2010 at 12:05 PM, Magnus Hagander <magnus(at)hagander(dot)net>
> wrote:
> > On Thu, Aug 26, 2010 at 22:59, Cristian Bittel <cbittel(at)gmail(dot)com>
> wrote:
> >> I still believe this "exit code 128" is related to pgAdmin opened during
> the
> >> clossing session on Remote Desktop. I have a Windows user login wich is
> not
> >> administrator just no privileged user, it cannot start/stop services,
> just
> >> monitoring. With pgAdmin window opened inside my disconected session, as
> >> Administrator if I "close" the another disconnected session, Postgres
> exit
> >> with 128 code.
> >
> > If the closing of a session on the remote desktop can affect a
> > *service* then frankly that sounds like a serious isolation bug in
> > Windows itself. The postmaster grabs the handle of the process when
> > it's started and waits on that - that should never be affected by
> > something in a different session.
> >
> > I think it's more likely that Windows just looses track when you
> > terminate a lot of processes at once, and randomly kills off something
> > - or at least *indicates* that something has been killed off.
> >
> >> Did you reproduce this behavior?
> >
> > No, AFAIK nobody has managed to reproduce this behavior in any kind of
> > consistent way. It's certainly been seen more than once in many
> > places, but not consistently reproducible.
>
> This behaviour, no - but desktop heap exhaustion is very easy to
> reproduce. That's because the heap usage is caused by user32.dll which
> uses a consistent amount with each process started, which is allocated
> as the process is created. When I was working on the issue a couple of
> years ago, it was entirely predictable - user32.dll allocates N bytes
> and as soon as N * numbackends exceeds the allocated heap size, we
> fall over.
>
> It shouldn't matter as desktop heap is allocated on a per-session
> basis, but are you logging on using the service account to run your
> admin tasks Cristian? If so, do you see the problem if you login
> interactively using a different account?
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise Postgres Company
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2010-08-31 14:46:59 Re: issue about information_schema REFERENTIAL_CONSTRAINTS
Previous Message Dave Page 2010-08-31 13:18:15 Re: [BUGS] BUG #5305: Postgres service stops when closing Windows session

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-08-31 15:09:57 Re: thousand unrelated data files in pg_default tablespace
Previous Message Dave Page 2010-08-31 14:12:29 Re: huia and moa versus old PG branches