[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Maposmatic-dev] [PATCH] FIXED: file-descriptor leakage.
From: |
David Decotigny |
Subject: |
Re: [Maposmatic-dev] [PATCH] FIXED: file-descriptor leakage. |
Date: |
Sun, 29 Nov 2009 13:14:33 +0100 |
User-agent: |
Thunderbird 2.0.0.23 (X11/20090817) |
Forgot to attach the patch. Sighs.
David Decotigny wrote:
Attached: another (bug fix) patch.
Tested on dev instance.
>From 38ba7167d1bc815072aa68d4ac93e772f3a01e76 Mon Sep 17 00:00:00 2001
From: MapOSMatic developers <address@hidden>
Date: Sun, 29 Nov 2009 13:06:43 +0100
Subject: [PATCH] FIXED: file-descriptor leakage.
Each time the daemon serviced a request, it would forget to close the writing
endpoint of the child-father pipe, causing it to refuse to service more than
ca. 1024 requests. This patch fixes this bug.
---
scripts/maposmaticd | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/scripts/maposmaticd b/scripts/maposmaticd
index bb5c365..8af0270 100755
--- a/scripts/maposmaticd
+++ b/scripts/maposmaticd
@@ -69,6 +69,7 @@ def render_job(job):
if pid == 0:
# Son
tell_dad = os.fdopen(pipe_write, 'w')
+ os.close(pipe_read)
retval = 1
try:
retval = render_job_process(job)
@@ -119,7 +120,14 @@ def render_job(job):
job.end_rendering(resultmsg)
return
finally:
- print "end of process %d" % pid
+ LOG.debug("end of process %d" % pid)
+
+ for fd in (pipe_read, pipe_write):
+ try:
+ os.close(fd)
+ except OSError:
+ pass
+
(pid, status) = os.waitpid(pid, 0)
resultmsg = "unknown error"
if os.WIFEXITED(status):
--
1.6.0.4