From 11e3cdca95ad8e0621549af6a2320de24d3a6f9f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 4 Sep 2012 23:21:40 +0000 Subject: [PATCH] ProcManager: SetAsChild drops inherited IPC sockets Workers only need to inherit the minimum amount necessary from the parent ProcManager. Keeping the socket of unrelated workers in each worker is wasteful and may contribute to premature resource exhaustion. Additionally, we will be using Danga::Socket in more (possibly all) workers, not just the Monitor and Reaper. Resetting in workers that do not use Danga::Socket is harmless and will not allocate epoll/kqueue descriptors until the worker actually uses Danga::Socket. --- lib/MogileFS/ProcManager.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/MogileFS/ProcManager.pm b/lib/MogileFS/ProcManager.pm index 032cb561..44f411ce 100644 --- a/lib/MogileFS/ProcManager.pm +++ b/lib/MogileFS/ProcManager.pm @@ -362,6 +362,10 @@ sub SetAsChild { %ErrorsTo = (); %idle_workers = (); %pending_work = (); + %ChildrenByJob = (); + %child = (); + %todie = (); + %jobs = (); # we just forked from our parent process, also using Danga::Socket, # so we need to lose all that state and start afresh.