Tom Lane wrote:
Andrew Dunstan <[EMAIL PROTECTED]> writes:
... The second part should not be
applied - I simply include it to illustrate the hack (taken from a
recent clue on the Cygwin mailing list) that I found necessary to get
around brokenness on the latest release of Cygwin. The good news is
that they do seem to be trying to find out what broke and fix it.
You mean this?
*** src/backend/storage/file/fd.c 4 Jul 2005 04:51:48 -0000 1.118
--- src/backend/storage/file/fd.c 7 Aug 2005 13:22:00 -0000
***************
*** 327,332 ****
--- 327,334 ----
elog(WARNING, "dup(0) failed after %d successes:
%m", used);
break;
}
+ if (used >= 250)
+ break;
if (used >= size)
{
Looking at that code, I wonder why we don't make the loop stop at
max_files_per_process opened files --- the useful result will be
bounded by that anyhow. Actively running the system out of FDs,
even momentarily, doesn't seem like a friendly thing to do.
This wouldn't directly solve your problem unless you reduced the
default value of max_files_per_process, but at least that would
be something reasonable to do instead of hacking the code.
Turns out that works as is on Cygwin - no adjustment necessary, at least
for me. 250 was just a number I plucked out of the air to get me around
the crashing problem. I just ran successfully with the attached patch.
Given the problems the Cygwin people are having with the stable branch
from just this piece of code, I think this or something similar should
be applied to the 8.0 branch as well as HEAD.
cheers
andrew
Index: src/backend/storage/file/fd.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/storage/file/fd.c,v
retrieving revision 1.118
diff -c -r1.118 fd.c
*** src/backend/storage/file/fd.c 4 Jul 2005 04:51:48 -0000 1.118
--- src/backend/storage/file/fd.c 7 Aug 2005 17:00:10 -0000
***************
*** 315,321 ****
fd = (int *) palloc(size * sizeof(int));
/* dup until failure ... */
! for (;;)
{
int thisfd;
--- 315,321 ----
fd = (int *) palloc(size * sizeof(int));
/* dup until failure ... */
! for ( ; used <= max_files_per_process ; )
{
int thisfd;
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?
http://archives.postgresql.org