Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit466c129

Browse files
committed
Fix for postmaster.c function win32_waitpid(int *exitstatus) call to
Win32 WaitForMultipleObjects:ret = WaitForMultipleObjects(win32_numChildren, win32_childHNDArray,FALSE, 0);Problem is 'win32_numChildren' could be more then 64 ( function supports), problem basically arise ( kills postgres ) when you create more then64 connections and terminate some of them sill leaving more then 64.Claudio Natoli
1 parent71fce6c commit466c129

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.421 2004/08/08 20:17:34 tgl Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.422 2004/08/29 03:16:30 momjian Exp $
4141
*
4242
* NOTES
4343
*
@@ -3736,40 +3736,40 @@ win32_RemoveChild(pid_t pid)
37363736
staticpid_t
37373737
win32_waitpid(int*exitstatus)
37383738
{
3739-
Assert(win32_childPIDArray&&win32_childHNDArray);
3740-
elog(DEBUG3,"waiting on %lu children",win32_numChildren);
3741-
3742-
if (win32_numChildren>0)
3743-
{
37443739
/*
37453740
* Note: Do NOT use WaitForMultipleObjectsEx, as we don't want to
37463741
* run queued APCs here.
37473742
*/
37483743
intindex;
37493744
DWORDexitCode;
37503745
DWORDret;
3746+
unsigned longoffset;
37513747

3752-
ret=WaitForMultipleObjects(win32_numChildren,win32_childHNDArray,
3753-
FALSE,0);
3748+
Assert(win32_childPIDArray&&win32_childHNDArray);
3749+
elog(DEBUG3,"waiting on %lu children",win32_numChildren);
3750+
3751+
for (offset=0;offset<win32_numChildren;offset+=MAXIMUM_WAIT_OBJECTS)
3752+
{
3753+
unsigned longnum=min(MAXIMUM_WAIT_OBJECTS,win32_numChildren-offset);
3754+
ret=WaitForMultipleObjects(num,&win32_childHNDArray[offset], FALSE,0);
37543755
switch (ret)
37553756
{
37563757
caseWAIT_FAILED:
37573758
ereport(LOG,
3758-
(errmsg_internal("failed to wait on %lu children: %d",
3759-
win32_numChildren, (int)GetLastError())));
3759+
(errmsg_internal("failed to wait on %lu of %lu children: %d",
3760+
num,win32_numChildren, (int)GetLastError())));
37603761
return-1;
37613762

37623763
caseWAIT_TIMEOUT:
3763-
/* No children have finished */
3764-
return-1;
3764+
/* No children(in this chunk)have finished */
3765+
break;
37653766

37663767
default:
3767-
37683768
/*
37693769
* Get the exit code, and return the PID of, the
37703770
* respective process
37713771
*/
3772-
index=ret-WAIT_OBJECT_0;
3772+
index=offset+ret-WAIT_OBJECT_0;
37733773
Assert(index >=0&&index<win32_numChildren);
37743774
if (!GetExitCodeProcess(win32_childHNDArray[index],&exitCode))
37753775
{
@@ -3787,7 +3787,7 @@ win32_waitpid(int *exitstatus)
37873787
}
37883788
}
37893789

3790-
/* No children */
3790+
/* No childrenhave finished*/
37913791
return-1;
37923792
}
37933793

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp