Skip to content

Commit

Permalink
ProcManager: SetAsChild drops inherited IPC sockets
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Eric Wong committed Aug 10, 2013
1 parent fa80d20 commit 11e3cdc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/MogileFS/ProcManager.pm
Expand Up @@ -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.
Expand Down

0 comments on commit 11e3cdc

Please sign in to comment.