unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Amir Yalon <amiryal@yxejamir.net>
To: Christos Trochalakis <yatiohi@ideopolis.gr>, Eric Wong <e@80x24.org>
Cc: unicorn-public@bogomips.org
Subject: Re: Systemd socket inheritance fails with “not a socket file descriptor”
Date: Sun, 13 Mar 2016 01:19:08 +0200	[thread overview]
Message-ID: <1457824748.3666627.547425122.2A828B07@webmail.messagingengine.com> (raw)
In-Reply-To: <20160309140604.GB25830@luke.ws.skroutz.gr>

Hi all,
 
After isolating the problem with the following one-liner in bash:
 
$ /usr/local/rvm/bin/rvm default exec ruby -e 'puts
IO.for_fd(3).inspect' 3<<<test
#<IO:fd 3>
 
$ bundle exec ruby -e 'puts IO.for_fd(3).inspect' 3<<<test
-e:1:in `for_fd': The given fd is not accessible because RubyVM reserves
it (ArgumentError)
        from -e:1:in `<main>'
 
$ /usr/local/rvm/rubies/default/bin/ruby -r bundler/setup -e 'puts
IO.for_fd(3).inspect' 3<<<test
#<IO:fd 3>
 
It became obvious that RVM is not to blame, and the real culprit was
Bundler’s `bundle exec` script.  From here it was just a matter of
figuring out how to launch the unicorn script from within the bundle
using the correct ruby without calling `bundle exec`.  There are a
number of ways to do that, here is what worked for me:
 
ExecStart = /usr/local/rvm/gems/ruby-2.0.0-p645/wrappers/ruby -r
bundler/setup vendor/bundle/ruby/2.0.0/bin/unicorn -c
config/unicorn/unicorn.rb -E staging -s myapp@%i
 
Thanks again to all participants, your input was invaluable.
 
 
P.S.  Notice how I abuse the -s no-op parameter to identify which
template instance is running in systemd (in the output of ps, for
example), maybe worth documenting it as a feature?
 
Regards,
Amir

  parent reply	other threads:[~2016-03-12 23:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-07 23:08 Amir Yalon
2016-03-08  3:31 ` Eric Wong
2016-03-08  7:45   ` Amir Yalon
2016-03-08 17:39     ` Eric Wong
2016-03-08 20:32       ` Amir Yalon
2016-03-09  3:51         ` Eric Wong
2016-03-09 13:19           ` Systemd socket inheritance fails with “not a socket file descriptor” [take2] Christos Trochalakis
2016-03-09 14:06           ` Systemd socket inheritance fails with “not a socket file descriptor” Christos Trochalakis
2016-03-10  9:48             ` Amir Yalon
2016-03-12  5:30               ` Eric Wong
2016-03-12 23:19             ` Amir Yalon [this message]
2016-03-17  0:27               ` [PATCH] doc: reference --keep-file-descriptors for "bundle exec" Eric Wong
2016-03-17 13:09                 ` Amir Yalon
2016-03-17 16:37                   ` Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1457824748.3666627.547425122.2A828B07@webmail.messagingengine.com \
    --to=amiryal@yxejamir.net \
    --cc=e@80x24.org \
    --cc=unicorn-public@bogomips.org \
    --cc=yatiohi@ideopolis.gr \
    --subject='Re: Systemd socket inheritance fails with “not a socket file descriptor”' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	../../unicorn.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).