Re: Stats collection on Windows

From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, <mark(at)mark(dot)mielke(dot)cc>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Stats collection on Windows
Date: 2006-04-05 10:57:01
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCEA35246@algol.sollentuna.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > It's no different from a file descriptor on UNIX.
> >
> > Neither UNIX nor Windows promise that a process identifier is valid
> > beyond the life of the process. UNIX avoids it from
> happening, as it
> > is necessary to avoid races with system calls such as
> kill(). Windows
> > does not have this problem.
>
> But consider, why is the process id there? (Amongst other
> reasons) so that users can monitor pg_stat_activity and kill
> a backend that's out of control. The equivalent to this in
> windows would be to.
>
> 1. Get HANDLE from the process ID.
> 2. TerminateProcess with that HANDLE.
>
> Presumably users have a little GUI app that displays
> processes on the system with the process ID so they can kill
> it. If a process ID is quickly reused, they may end up
> killing the wrong one.

Actualy, not quite. That's the equivalent of kill -9. What you'd do is
"pg_ctl kill TERM <pid>". Or whatever other signal you want to send. But
you still need the pid, there is no way to get the required information
from a plain handle when you're not in that process.

Though I'd say I'm usually more interested in noticing what process it
is, rather than killing it. Possibly canceling it, but very seldomly
actually kill it. But it still needs the process id, yes.

(BTW, the GUI would generaelly be Task Manager, so it's not like it's a
special tool)

<snip rest>

//Magnus

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2006-04-05 10:58:50 Re: Stats collection on Windows
Previous Message mark 2006-04-05 10:35:34 Re: Stats collection on Windows