Rack env rack.multiprocess true with single worker

Eric Wong normalperson at yhbt.net
Thu Oct 18 07:53:02 UTC 2012


Petteri Räty <betelgeuse at gentoo.org> wrote:
> Hi,
> unicorn unconditionally sets rack.multiprocess to true in the Rack
> environment. The Rack spec [0] says the following about the variable:
> 
> "true if an equivalent application object may be simultaneously invoked
> by another process, false otherwise."
> 
> When unicorn is running with a single worker this does not hold so what
> do you think about setting the variable to false when only a single
> worker is configured? I want to use the variable to check if I can do a
> HTTP call back to the application (long story) but currently with
> unicorn and single worker this is not possible.

We cannot safely set rack.multiprocess=false.

Even if unicorn is started with a single worker, it is possible
to start more workers via SIGTTIN, and the first worker would
never see the change.


However, if you're certain nobody on your server will use SIGTTIN,
you can set the following anywhere in your unicorn config file:

	Unicorn::HttpRequest::DEFAULTS["rack.multiprocess"] = false

Changing the DEFAULTS constant has been and will remain supported
for as long as this project supports Rack 1.x (forever? :)


Since a single process deployment is a corner-case in production
deployments, I don't think it's worth the effort to jump through hoops
and set rack.multiprocess=false automatically.


More information about the mongrel-unicorn mailing list