Re: windows doesn't notice backend death

Поиск
Список
Период
Сортировка
От Magnus Hagander
Тема Re: windows doesn't notice backend death
Дата
Msg-id 49FEAE86.8080300@hagander.net
обсуждение исходный текст
Ответ на Re: windows doesn't notice backend death  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane wrote:
> Andrew Dunstan <andrew@dunslane.net> writes:
>> Well, I can tell you that it is getting an exit code of 1, which is why 
>> the postmaster isn't restarting.
> 
> Blech.  Count on Windows to find a way to break things.

Yup. A quick search gives this:
http://support.microsoft.com/kb/155075

which clearly states that task manager simply uses TerminateProcess().
And it's probably hard-coded with an exit code.

Which really means this can't have worked, and my memory was wrong.

I still claim it works when the process actually *crashes* though -
since that will give you one of those funky huge exit numbers.


>> That raises two questions in my mind. First, is that the behaviour we 
>> expect when we kill the backend this way? And second, why is it still 
>> showing up in the output of pg_stat_activity?
> 
> Well, if the process is being hard-killed without an opportunity to run
> through proc_exit(), then yes it is going to still show up in
> pg_stat_activity.  It's pgstat_beshutdown_hook that removes that entry.

That's certainly what task manager does. TerminateProcess() just stops
all threads and removes the process. No chance for atexit() stuff to run.

> The problem here is that we need to be able to distinguish a task
> manager kill from a voluntary exit(1).  Have M$ really been stupid
> enough to make an external kill look just like an exit() call?

It certainly looks that way. It probably goes back to the "use threads,
not processes, on this platform" design...

//Magnus



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

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: high shared buffer and swap
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: windows doesn't notice backend death