unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: James Turnbull <james@lovedthanlost.net>
To: unicorn list <mongrel-unicorn@rubyforge.org>
Subject: Re: Exception `Errno::EAGAIN'
Date: Mon, 16 Nov 2009 11:08:56 +1100	[thread overview]
Message-ID: <4B009818.1020102@lovedthanlost.net> (raw)
In-Reply-To: <20091115234739.GA26275@dcvr.yhbt.net>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Eric Wong wrote:
> This is expected.  The kernel wakes up all the workers when there's
> _one_ connection and they all race to accept() one client connection.
> One wins and accepts the connection, 3 lose and go back to sleep.  With
> lots of worker processes, this can be a thundering herd problem but
> that's why we encourage Unicorn as a backend server, not as a frontend
> server.

Ah okay - makes sense.

> Do you by any chance do user switching in your application
> or config.ru?

In the application we do.

> Instead, since 0.94.0, I would do this:
> 
> 	after_fork do |server, worker|
> 	  worker.user('user', 'group') if Process.euid == 0
> 	end
> 
> That way only the worker process drops permissions.  The master really
> doesn't do anything interesting.   Of course *I* would just start
> Unicorn as a regular user and forget the complexity of user switching
> entirely...

Okay thanks - will give that a shot.

Regards

James Turnbull

- --
Author of:
* Pro Linux System Administration (http://tinyurl.com/linuxadmin)
* Pulling Strings with Puppet (http://tinyurl.com/pupbook)
* Pro Nagios 2.0 (http://tinyurl.com/pronagios)
* Hardening Linux (http://tinyurl.com/hardeninglinux)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEVAwUBSwCYGCFa/lDkFHAyAQIyPggA5XPzSOYgf4ekdBGoRcs4wp885eC8C/wY
BIjzdxilCEhA8mqBw4Hrjo5sOebglOukACFla7QaDqyk2t1velQEpxj8sR2StNEe
HHTbng/Jq3ryt4BxNucQWdKvdPTI3WJ3I9APqtGxNyh72FpY08uvAlUv02S8b/Aj
mtFqbqi2gu+tkbOoqW1AeJEabjJHd7HyPhf2YlHowBaHG61bzrFRnuhvqN8R6SAq
j3LI1kRpnTYdwKYEy3sLfR0OUSVmUuDkWjRkYt2tR2fAwCKkq2oupmcDUrvaT2Y2
fbQ8YJzoGjwVVvD1On/u6iNiTHZcOReYiHRsAhmtbaS+eHldSukHQw==
=EyRA
-----END PGP SIGNATURE-----

      reply	other threads:[~2009-11-16  0:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-15 23:21 Exception `Errno::EAGAIN' James Turnbull
2009-11-15 23:47 ` Eric Wong
2009-11-16  0:08   ` James Turnbull [this message]

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=4B009818.1020102@lovedthanlost.net \
    --to=james@lovedthanlost.net \
    --cc=mongrel-unicorn@rubyforge.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/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).