Re: Stats collection on Windows - Mailing list pgsql-hackers

From Magnus Hagander
Subject Re: Stats collection on Windows
Date
Msg-id 6BCB9D8A16AC4241919521715F4D8BCEA35246@algol.sollentuna.se
Whole thread Raw
In response to Stats collection on Windows  ("Peter Brant" <Peter.Brant@wicourts.gov>)
List 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


pgsql-hackers by date:

Previous
From: mark@mark.mielke.cc
Date:
Subject: Re: Stats collection on Windows
Next
From: "Magnus Hagander"
Date:
Subject: Re: Stats collection on Windows