From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS15169 74.125.0.0/16 X-Spam-Status: No, score=-1.8 required=3.0 tests=AWL,BAYES_00,FREEMAIL_FROM, SPF_PASS,URIBL_BLOCKED shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: unicorn-public@bogomips.org Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com [74.125.82.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 0A07E633805 for ; Wed, 9 Mar 2016 14:06:11 +0000 (UTC) Received: by mail-wm0-f45.google.com with SMTP id l68so72390797wml.1 for ; Wed, 09 Mar 2016 06:06:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=KyIA6BGKDeiz681/f5FJ03BHXlFIKXUtMEUmX7TLJQQ=; b=LHupkfxrYqbP7taq+iUOZwcnk1P21lb8XLF+MN3Gnn6egvyIYee2OHPjY3ewg48KZP FJUnLbZ6nhwtiQIu3dbqHs2CUcgqfRI4O08ctuPEMv+TE/Rn7cW2kgrlCjJFWt1nOyyq uBm28Oy5lTokWmqD5ZKRIg5mqnr+ofthTnmDkW8Nj0Hhp33Ho7igfCUgPvE9PcNwVSuS lzf1G8YWasu3DFAv3DC/uTJbjhWFeLwmepfBIzk17D2ueAMMTRFQadJbGKSPHsl5gyUT Y7vTAP5fDaQlKvtoY48AD9DMYX/YC313K3BEZS9plVdOu5xpvTzgyj9Gf8M+vIqiHHXW cCtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=KyIA6BGKDeiz681/f5FJ03BHXlFIKXUtMEUmX7TLJQQ=; b=ha9vqjCE4XTqL/DAlIiWpV4KzdzNw7IufkX/uF8dM6ITooz+8Nh9/KmwBBdwH+wPJx ZDYKW5AwnrLqUjAxpskMg1LKau3yJXYAuNK28JT8BM/cMsHmnMbVLbxImOSGrIsi44+2 Ul9sTi2BhexNbMYjGU8DLvrfs7C2sF+NMWrHDQcu8IYNEnU7UM505F/xjkYYNTMXEc/G L0bNmU/jwVZWnZ5en7nuPZZfFEmza55FoV7u/qJ746NHYbjXi7kUR3Uwr1XY4leB0T1z lK2dPDNmjkJsblGArBsfCSbXrwmfzPY9XmvaKAmqTpaMt+sE5uVdbmO8LVJsBwW3xWDo uRUA== X-Gm-Message-State: AD7BkJKIFm8XDj8TNVQ84Ttgwh5Fn3DpqC34i613j72q+P/4oLp93xXL0EmxVD76iTIRhQ== X-Received: by 10.28.140.11 with SMTP id o11mr25110294wmd.81.1457532369658; Wed, 09 Mar 2016 06:06:09 -0800 (PST) Received: from luke.ws.skroutz.gr (luke.ws.skroutz.gr. [185.6.78.148]) by smtp.gmail.com with ESMTPSA id za6sm8124505wjc.18.2016.03.09.06.06.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Mar 2016 06:06:08 -0800 (PST) Sender: Trochalakis Christos Date: Wed, 9 Mar 2016 16:06:04 +0200 From: Christos Trochalakis To: Eric Wong Cc: Amir Yalon , unicorn-public@bogomips.org Subject: Re: Systemd socket inheritance =?utf-8?Q?f?= =?utf-8?Q?ails_with_=E2=80=9Cnot_a_socket_file_descriptor=E2=80=9D?= Message-ID: <20160309140604.GB25830@luke.ws.skroutz.gr> References: <1457392131.48974.542407130.6981D79B@webmail.messagingengine.com> <20160308033141.GA10218@dcvr.yhbt.net> <1457423146.164433.542706346.5085E10D@webmail.messagingengine.com> <20160308173710.GA534@dcvr.yhbt.net> <1457469175.1318763.543399970.5DA44188@webmail.messagingengine.com> <20160309035157.GA23507@dcvr.yhbt.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20160309035157.GA23507@dcvr.yhbt.net> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: On Wed, Mar 09, 2016 at 03:51:57AM +0000, Eric Wong wrote: >Amir Yalon wrote: >> Yes, everything looks as expected, one inherited socket starting at fd >> number 3: >> >> I=[3] PID=4869 FDS=1 >> >> Also tried with Ruby 2.2.1, same results. FWIW, my rubies are compiled >> by system-wide RVM with no special options given to it. > >Interesting. Can you try using some other non-Ruby daemon >which uses sd_listen_fds, too? I can't think of any off >the top of my head, but I'm sure there's some. > >It seems like systemd is mis-setting FD_CLOEXEC on socket, >even. > Ok, this is my theory, systemd correctly passes the sockets and the environment to the process, but Amir is using rvm which probably runs one more exec than usual. In this extra step rvm/ruby closes the fds for security reasons but the ENV variables remain. In the newly forked ruby process the timer gets fd=3 (which is now consider internal) and when unicorn tries to example fd=3 breaks.