diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-02-13 19:18:54 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-02-13 19:18:54 +0000 |
commit | cf4cc7843c17db5142a12edddb1bd17b33ea72d8 (patch) | |
tree | 20ef33b781de4f4489bb1599edaa6dfd391b17fa /src/backend/postmaster | |
parent | b9c65aed82a487c51a7d3b8bdfb731141215ba5a (diff) |
Improve postmaster's behavior if an accept() call fails. Because the server
socket is still read-ready, the code was a tight loop, wasting lots of CPU.
We can't do anything to clear the failure, other than wait, but we should give
other processes more chance to finish and release FDs; so insert a small sleep.
Also, avoid bogus "close(-1)" in this case. Per report from Jim Nasby.
Diffstat (limited to 'src/backend/postmaster')
-rw-r--r-- | src/backend/postmaster/postmaster.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 2c54ad7010e..d0fe8451987 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -37,7 +37,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.520 2007/02/11 11:59:25 mha Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.521 2007/02/13 19:18:54 tgl Exp $ * * NOTES * @@ -1710,7 +1710,8 @@ ConnCreate(int serverFd) if (StreamConnection(serverFd, port) != STATUS_OK) { - StreamClose(port->sock); + if (port->sock >= 0) + StreamClose(port->sock); ConnFree(port); port = NULL; } |