Class PhusionPassenger::RequestHandler
In: lib/phusion_passenger/request_handler/thread_handler.rb
lib/phusion_passenger/request_handler.rb
Parent: Object

Methods

Included Modules

DebugLogging Utils

Classes and Modules

Class PhusionPassenger::RequestHandler::ThreadHandler

Constants

HARD_TERMINATION_SIGNAL = "SIGTERM"   Signal which will cause the Rails application to exit immediately.
SOFT_TERMINATION_SIGNAL = "SIGUSR1"   Signal which will cause the Rails application to exit as soon as it‘s done processing a request.
BACKLOG_SIZE = 500

Attributes

concurrency  [R] 
connect_password  [RW]  A password with which clients must authenticate. Default is unauthenticated.
server_sockets  [R]  A hash containing all server sockets that this request handler listens on. The hash is in the form of:
  {
     name1 => [socket_address1, socket_type1, socket1],
     name2 => [socket_address2, socket_type2, socket2],
     ...
  }

name is a Symbol. socket_addressx is the address of the socket, socket_typex is the socket‘s type (either ‘unix’ or ‘tcp’) and socketx is the actual socket IO objec. There‘s guaranteed to be at least one server socket, namely one with the name +:main+.

soft_termination_linger_time  [RW]  If a soft termination signal was received, then the main loop will quit the given amount of seconds after the last time a connection was accepted. Defaults to 3 seconds.

Public Class methods

Create a new RequestHandler with the given owner pipe. owner_pipe must be the readable part of a pipe IO object.

Additionally, the following options may be given:

  • detach_key
  • connect_password
  • pool_account_username
  • pool_account_password_base64

Public Instance methods

Clean up temporary stuff created by the request handler.

If the main loop was started by main_loop, then this method may only be called after the main loop has exited.

If the main loop was started by start_main_loop_thread, then this method may be called at any time, and it will stop the main loop thread.

Enter the request handler‘s main loop.

Check whether the main loop‘s currently running.

Remove this request handler from the application pool so that no new connections will come in. Then make the main loop quit a few seconds after the last time a connection came in. This all is to ensure that no connections come in while we‘re shutting down.

May only be called while the main loop is running. May be called from any thread.

Start the main loop in a new thread. This thread will be stopped by cleanup.

[Validate]