@@ -67,3 +67,167 @@ Also, the cygnus-bindir has to be placed in the path before the
6767NT-directories, because the sort.exe has to be take for cygnus, not
6868NT.
6969
70+ ---------------------------------------------------------------------------
71+
72+ FIX FOR POSTGRESQL FREEZING ON NT MACHINES
73+
74+
75+ From: "Hiroshi Inoue" <Inoue@tpf.co.jp>
76+ To: "Horak Daniel" <horak@mmp.plzen-city.cz>, "'Tom Lane'" <tgl@sss.pgh.pa.us>
77+ Cc: <pgsql-hackers@postgreSQL.org>
78+ Subject: RE: [HACKERS] backend freezeing on win32 fixed (I hope ;-) )
79+ Date: Wed, 18 Aug 1999 08:45:28 +0900
80+ Message-ID: <000301bee90a$95d40f00$2801007e@cadzone.tpf.co.jp>
81+ MIME-Version: 1.0
82+ Content-Type: text/plain;
83+ charset="iso-8859-1"
84+ Content-Transfer-Encoding: 7bit
85+ X-Priority: 3 (Normal)
86+ X-MSMail-Priority: Normal
87+ X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0
88+ X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
89+ In-reply-to: <2E7F82FAC1FCD2118E1500A024B3BF907DED3F@exchange.mmp.plzen-city.cz>
90+ Importance: Normal
91+ Sender: owner-pgsql-hackers@postgreSQL.org
92+ Precedence: bulk
93+ Status: RO
94+
95+ > -----Original Message-----
96+ > From: owner-pgsql-hackers@postgreSQL.org
97+ > [mailto:owner-pgsql-hackers@postgreSQL.org]On Behalf Of Horak Daniel
98+ > Sent: Tuesday, August 17, 1999 9:06 PM
99+ > To: 'Tom Lane'
100+ > Cc: 'pgsql-hackers@postgreSQL.org'
101+ > Subject: RE: [HACKERS] backend freezeing on win32 fixed (I hope ;-) )
102+
103+ Yutaka Tanida [yutaka@marin.or.jp] and I have examined IPC
104+ library.
105+
106+ We found that postmaster doesn't call exec() after fork() since v6.4.
107+
108+ The value of static/extern variables which cygipc library holds may
109+ be different from their initial values when postmaster fork()s child
110+ backend processes.
111+
112+ I made the following patch for cygipc library on trial.
113+ This patch was effective for Yutaka's test case.
114+
115+ Regards.
116+
117+ Hiroshi Inoue
118+ Inoue@tpf.co.jp
119+
120+ *** sem.c.origTue Dec 01 00:16:25 1998
121+ --- sem.cTue Aug 17 13:22:06 1999
122+ ***************
123+ *** 58,63 ****
124+ --- 58,78 ----
125+ static int GFirstSem = 0;/*PCPC*/
126+ static int GFdSem ;/*PCPC*/
127+
128+ + static pid_tGProcessId = 0;
129+ +
130+ + static voidinit_globals(void)
131+ + {
132+ + pid_t pid;
133+ +
134+ + if (pid=getpid(), pid != GProcessId)
135+ + {
136+ + GFirstSem = 0;
137+ + used_sems = used_semids = max_semid = 0;
138+ + sem_seq = 0;
139+ + GProcessId = pid;
140+ + }
141+ + }
142+ +
143+ /************************************************************************/
144+ /* Demande d'acces a la zone partagee de gestion des semaphores*/
145+ /************************************************************************/
146+ ***************
147+ *** 77,82 ****
148+ --- 92,98 ----
149+ {
150+ int LRet ;
151+
152+ + init_globals();
153+ if( GFirstSem == 0 )
154+ {
155+ if( IsGSemSemExist() )
156+ *** shm.c.origTue Dec 01 01:04:57 1998
157+ --- shm.cTue Aug 17 13:22:27 1999
158+ ***************
159+ *** 59,64 ****
160+ --- 59,81 ----
161+ static int GFirstShm = 0;/*PCPC*/
162+ static int GFdShm ;/*PCPC*/
163+
164+ + /*****************************************/
165+ + /*Initialization of static variables */
166+ + /*****************************************/
167+ + static pid_t GProcessId = 0;
168+ + static void init_globals(void)
169+ + {
170+ + pid_t pid;
171+ +
172+ + if (pid=getpid(), pid != GProcessId)
173+ + {
174+ + GFirstShm = 0;
175+ + shm_rss = shm_swp = max_shmid = 0;
176+ + shm_seq = 0;
177+ + GProcessId = pid;
178+ + }
179+ + }
180+ +
181+ /************************************************************************/
182+ /* Demande d'acces a la zone partagee de gestion des shm*/
183+ /************************************************************************/
184+ ***************
185+ *** 82,87 ****
186+ --- 99,105 ----
187+ {
188+ int LRet ;
189+
190+ + init_globals();
191+ if( GFirstShm == 0 )
192+ {
193+ if( IsGSemShmExist() )
194+ *** msg.c.origTue Dec 01 00:16:09 1998
195+ --- msg.cTue Aug 17 13:20:04 1999
196+ ***************
197+ *** 57,62 ****
198+ --- 57,77 ----
199+ static int GFirstMsg = 0;/*PCPC*/
200+ static int GFdMsg ;/*PCPC*/
201+
202+ + /*****************************************/
203+ + /*Initialization of static variables */
204+ + /*****************************************/
205+ + static pid_t GProcessId = 0;
206+ + static void init_globals(void)
207+ + {
208+ + pid_t pid;
209+ +
210+ + if (pid=getpid(), pid != GProcessId)
211+ + {
212+ + GFirstMsg = 0;
213+ + msgbytes = msghdrs = msg_seq = used_queues = max_msqid = 0;
214+ + GProcessId = pid;
215+ + }
216+ + }
217+ /************************************************************************/
218+ /* Demande d'acces a la zone partagee de gestion des semaphores*/
219+ /************************************************************************/
220+ ***************
221+ *** 79,84 ****
222+ --- 94,100 ----
223+ {
224+ int LRet ;
225+
226+ + init_globals();
227+ if( GFirstMsg == 0 )
228+ {
229+ if( IsGSemMsgExist() )
230+
231+
232+
233+