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

From Magnus Hagander
Subject Re: Stats collection on Windows
Date
Msg-id 6BCB9D8A16AC4241919521715F4D8BCEA35256@algol.sollentuna.se
Whole thread Raw
In response to Stats collection on Windows  ("Peter Brant" <Peter.Brant@wicourts.gov>)
List pgsql-hackers
> There's a disconnect here. handles aren't process
> identifiers: they're reference counted "pointers" to the
> kernel structures for the process. If you are holding a
> handle (ie: from CreateProcess or OpenProcess) that handle
> cannot and will not be reclaimed until you call CloseHandle
> (or your process itself exits). You should never retain a
> handle after you've called CloseHandle on it.
>
> Which brings an interesting thought: are process ID's
> reclaimed while open handles remain? I'm willing to bet the
> answer is no. In that case, the stats collector could retain
> the handle until it's done with the process ID.

Since the process id lives in the kernel structure they point to, they
can't very well be recycled... (classical
handle-leak-kills-windows-system-by-running-out-of-kernel-space
scenario).

The problem is, the stats collector doesn't have the handle in the first
place. I guess it could open one upon receiving the bestart message, but
it seems like a kludge. Would be nicer if it could be done cleaner :-)

//Magnus


pgsql-hackers by date:

Previous
From: "Pavel Stehule"
Date:
Subject: Re: commit callback, request
Next
From: patrick
Date:
Subject: recover without $PGDATA/global