Thread: PostgreSQL and Windows2000 and defunct processes

PostgreSQL and Windows2000 and defunct processes

From
Steven Vajdic
Date:

Problem:

Win2000 and Cygwin/postgresql-7.1 produce
"defunct" processes after each run which can ONLY be killed
by Win Task Manager. If you allow too many "defunct" processes
your database requests slow down and your number of connections
increases, i.e. if you
have 32 connections specified in your postgresql.conf file and
and 32 "defunct" processes and try to run again
the connection will be refused.
When you are killing "defunct" processes and reach the one which was
first formed
the postmaster restarts postgresql.

How to get read of those "defunct" processes?

Much obliged.

Steven.

P.S. You do not have these "defunct" processes under Win98!!!???


Re: PostgreSQL and Windows2000 and defunct processes

From
Yutaka tanida
Date:
Hi.

On Thu, 06 Jun 2002 16:23:29 +0930
Steven Vajdic <svajdic@asc.corp.mot.com> wrote:

> How to get read of those "defunct" processes?

What version of cygipc and cygwin do you use?

---
Yutaka tanida<yutaka@hi-net.zaq.ne.jp>
謎のWebsite http://www.hi-net.zaq.ne.jp/yutaka/


Re: PostgreSQL and Windows2000 and defunct processes

From
"SHELTON,MICHAEL (Non-HP-Boise,ex1)"
Date:
Steven,

I found the following snippet in MSDN under CreateProcess:

"The created process remains in the system until all threads within the
process have terminated and all handles to the process and any of its
threads have been closed through calls to CloseHandle. The handles for both
the process and the main thread must be closed through calls to CloseHandle.
If these handles are not needed, it is best to close them immediately after
the process is created."

If this is your case, what is unknown is why it is "not" happening in
win98??  Can you run a test and close the PROCESS_INFORMATION HANDLEs for
the main thread and the process itself and see if that makes a difference
(and any other HANDLEs that you might have gotten through OpenProcess()
calls...)?

Mike Shelton


-----Original Message-----
From: Steven Vajdic [mailto:svajdic@asc.corp.mot.com]
Sent: Thursday, June 06, 2002 12:53 AM
To: pgsql-general@postgresql.org; pgsql-hackers@postgresql.org;
svajdic@asc.corp.mot.com; steven_vajdic@yahoo.com.au
Subject: [HACKERS] PostgreSQL and Windows2000 and defunct processes




Problem:

Win2000 and Cygwin/postgresql-7.1 produce
"defunct" processes after each run which can ONLY be killed
by Win Task Manager. If you allow too many "defunct" processes
your database requests slow down and your number of connections
increases, i.e. if you
have 32 connections specified in your postgresql.conf file and
and 32 "defunct" processes and try to run again
the connection will be refused.
When you are killing "defunct" processes and reach the one which was
first formed
the postmaster restarts postgresql.

How to get read of those "defunct" processes?

Much obliged.

Steven.

P.S. You do not have these "defunct" processes under Win98!!!???


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Re: PostgreSQL and Windows2000 and defunct processes

From
Steven Vajdic
Date:
Hi Michael/Yutaka,

Thanks for your reply.

I discovered the cause of the problem (I think) - I just do not know why
it happens.

PROBLEM (again): DEFUNCT processes under Win2K not seen under Win98.

I am running cygwin-2.125.2.10 (postgresql 7.1) and cigipc-1.11-1
installed in Jan 2002.

Prior to that I struggled with prior cygwin version - no proper
postgresql run at all.

In April/May I tried then new version of cygwin (postgresql 7.2) and
cigipc BUT
cygwin environment was very poor and without some essential unix
commands
and I gave up.

I can try again with now latest versions if that will help (!!!???).

The problem is in closing pgSQL database. Somehow the process does not
finish.
Under Win98 cygwin does not show (ps -ef) defunct processes BUT if you
run a program which
opens/closes pgSQL 2 times in succession the second time the connection
will be refused - like it
was not properly closed the first time!!!???

Under Win2K (same version og cygwin/cigipc) this does not happen BUT a
defunct process remains
and accumulates/multiplies after each run

I'll try with Michael's suggestion RE: threads and process closure but I
do not think I'll discover
anything new - the "postgresql" process does not finish for some reason
- the question is why:
bad cygwin/cigipc, or bad postgresql.conf
parameters or bad postmaster/postgresql run or .. .

Please, do not ask why I run under Win2K/Win98 - I normally run my
HTML/PHP/pgSQL
application under linux (redhat, mandrake, SuSe) and it works fine BUT
Win is a much more used
OS and one has to take that into account.

More advice/help would be appreciated.

Cheers,

Steven.


--
***********************************************

Steven Vajdic (BSc/Hon, MSc)
Senior Software Engineer
Motorola Australia Software Centre (MASC)
2 Second Avenue, Technology Park
Adelaide, South Australia  5095
email:  Steven.Vajdic@motorola.com
email:  svajdic@asc.corp.mot.com
Ph.:  +61-8-8168-3543
Fax:    +61-8-8168-3501
Front Office (Ph): +61-8-8168-3500

----------------------------------------
mobile: +61 (0)419 860 903
AFTER WORK email:  steven_vajdic@ivillage.com
Home address: 6 Allawah Av., Glen Osmond SA 5064, Australia
----------------------------------------

***********************************************