0
@@ -39,21 +39,6 @@ module Passenger
0
# administrator maintenance overhead. These decisions are documented
0
-# === Abstract namespace Unix sockets
0
-# AbstractRequestHandler listens on a Unix socket for incoming requests. If possible,
0
-# AbstractRequestHandler will try to create a Unix socket on the _abstract namespace_,
0
-# instead of on the filesystem. If the RoR application crashes (segfault),
0
-# or if it gets killed by SIGKILL, or if the system loses power, then there
0
-# will be no stale socket files left on the filesystem.
0
-# Unfortunately, abstract namespace Unix sockets are only supported by Linux.
0
-# On systems that do not support abstract namespace Unix sockets,
0
-# AbstractRequestHandler will automatically fallback to using regular Unix socket files.
0
-# It is possible to force AbstractRequestHandler to use regular Unix socket files by
0
-# setting the environment variable PASSENGER_NO_ABSTRACT_NAMESPACE_SOCKETS
0
# Because only the web server communicates directly with a request handler,
0
@@ -111,15 +96,16 @@ class AbstractRequestHandler
0
X_POWERED_BY = 'X-Powered-By' # :nodoc:
0
# The name of the socket on which the request handler accepts
0
- # new connections. This is either a Unix socket filename, or
0
- # the name for an abstract namespace Unix socket.
0
+ # new connections. At this moment, this value is always the filename
0
+ # of a Unix domain socket.
0
- # If +socket_name+ refers to an abstract namespace Unix socket,
0
- # then the name does _not_ contain a leading null byte.
0
- # See also using_abstract_namespace?
0
+ # See also #socket_type.
0
attr_reader :socket_name
0
+ # The type of socket that #socket_name refers to. At the moment, the
0
+ # value is always 'unix', which indicates a Unix domain socket.
0
+ attr_reader :socket_type
0
# Specifies the maximum allowed memory usage, in MB. If after having processed
0
# a request AbstractRequestHandler detects that memory usage has risen above
0
# this limit, then it will gracefully exit (that is, exit after having processed
0
@@ -142,14 +128,8 @@ class AbstractRequestHandler
0
# Additionally, the following options may be given:
0
# - memory_limit: Used to set the +memory_limit+ attribute.
0
def initialize(owner_pipe, options = {})
0
- if abstract_namespace_sockets_allowed?
0
- @using_abstract_namespace = create_unix_socket_on_abstract_namespace
0
- @using_abstract_namespace = false
0
- if !@using_abstract_namespace
0
- create_unix_socket_on_filesystem
0
+ create_unix_socket_on_filesystem
0
@socket.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
0
@owner_pipe = owner_pipe
0
@previous_signal_handlers = {}
0
@@ -174,14 +154,7 @@ class AbstractRequestHandler
0
@socket.close rescue nil
0
@owner_pipe.close rescue nil
0
- if !using_abstract_namespace?
0
- File.unlink(@socket_name) rescue nil
0
- # Returns whether socket_name refers to an abstract namespace Unix socket.
0
- def using_abstract_namespace?
0
- return @using_abstract_namespace
0
+ File.unlink(@socket_name) rescue nil
0
# Check whether the main loop's currently running.
0
@@ -268,33 +241,6 @@ class AbstractRequestHandler
0
- def create_unix_socket_on_abstract_namespace
0
- # I have no idea why, but using base64-encoded IDs
0
- # don't pass the unit tests. I couldn't find the cause
0
- # of the problem. The system supports base64-encoded
0
- # names for abstract namespace unix sockets just fine.
0
- @socket_name = generate_random_id(:hex)
0
- @socket_name = @socket_name.slice(0, NativeSupport::UNIX_PATH_MAX - 2)
0
- fd = NativeSupport.create_unix_socket("\x00#{socket_name}", BACKLOG_SIZE)
0
- @socket.instance_eval do
0
- fd = NativeSupport.accept(fileno)
0
- rescue Errno::EADDRINUSE
0
- # Do nothing, try again with another name.
0
- # Abstract namespace sockets not supported on this system.
0
def create_unix_socket_on_filesystem
0
@@ -432,11 +378,6 @@ private
0
- def abstract_namespace_sockets_allowed?
0
- value = ENV['PASSENGER_NO_ABSTRACT_NAMESPACE_SOCKETS']
0
- return value.nil? || value.empty?
0
def self.determine_passenger_version
0
rakefile = "#{File.dirname(__FILE__)}/../../Rakefile"
0
if File.exist?(rakefile)