From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 889141FC43; Fri, 10 Mar 2017 21:19:07 +0000 (UTC) Date: Fri, 10 Mar 2017 21:19:07 +0000 From: Eric Wong To: Jeremy Evans Cc: unicorn-public@bogomips.org Subject: Re: [PATCH] Add worker_exec configuration option V2 Message-ID: <20170310211907.GA5022@untitled> References: <20170308184432.GA35527@jeremyevans.local> <20170308200256.GA21719@whir> <20170309194119.GD35527@jeremyevans.local> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20170309194119.GD35527@jeremyevans.local> List-Id: Jeremy Evans wrote: > Here's V2 of the patch, which I think should address all of the issues > you pointed out. Thanks. Pushed to git://80x24.org/unicorn worker_exec I can add tests, later, or you can. I also had some FreeBSD test fixes (which might apply to OpenBSD) on a VM somewhere which I'll Cc: you on: there was also just SO_KEEPALIVE fix I posted: https://bogomips.org/unicorn-public/20170310203431.28067-1-e@80x24.org/raw > worker_nr = -1 > until (worker_nr += 1) == @worker_processes > @workers.value?(worker_nr) and next > worker = Unicorn::Worker.new(worker_nr) > before_fork.call(self, worker) > - if pid = fork > - @workers[pid] = worker > - worker.atfork_parent > + > + pid = if @worker_exec > + worker_spawn(worker) > else > - after_fork_internal > - worker_loop(worker) > - exit > + fork do > + after_fork_internal > + worker_loop(worker) > + exit > + end I prefer to avoid the block with fork. The block deepens the stack for the running app, so it can affect GC efficiency. Can be fixed in a separate patch...