Struct.new(:app, :timeout, :worker_processes, :before_fork, :after_fork, :before_exec, :logger, :pid, :listener_opts, :preload_app, :reexec_pid, :orig_app, :init_listeners, :master_pid, :config, :ready_pipe, :user)
This is the process manager of Unicorn. This manages worker processes which in turn handle the I/O and application process. Listener sockets are started in the master process and shared with forked worker children.
prevents IO objects in here from being GC-ed
all bound listener sockets
This hash maps PIDs to Workers
We use SELF_PIPE differently in the master and worker processes:
initialized. Signal handlers in the master process will write to it to wake up the master from IO.select in exactly the same manner djb describes in cr.yp.to/docs/selfpipe.html
master and replace it with a new pipe after forking. This new pipe is also used to wakeup from IO.select from inside (worker) signal handlers. However, workers close the pipe descriptors in the signal handlers to raise EBADF in IO.select instead of writing like we do in the master. We cannot easily use the reader set for IO.select because LISTENERS is already that set, and it’s extra work (and cycles) to distinguish the pipe FD from the reader set once IO.select returns. So we’re lazy and just close the pipe when a (rare) signal arrives in the worker and reinitialize the pipe later.
signal queue used for self-piping
constant lookups are faster and we’re single-threaded/non-reentrant
We populate this at startup so we can figure out how to reexecute and upgrade the currently running instance of Unicorn This Hash is considered a stable interface and changing its contents will allow you to switch between different installations of Unicorn or even different installations of the same applications without downtime. Keys of this constant Hash are described as follows:
you originally started Unicorn.
The following example may be used in your Unicorn config file to change your working directory during a config reload (HUP) without upgrading or restarting:
Dir.chdir(Unicorn::HttpServer::START_CTX[:cwd] = path)
To change your unicorn executable to a different path without downtime, you can set the following in your Unicorn config file, HUP and then continue with the traditional USR2 + QUIT upgrade steps:
Unicorn::HttpServer::START_CTX[0] = "/home/bofh/1.9.2/bin/unicorn"
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.