diff -Nru ruby-passenger-4.0.8/NEWS ruby-passenger-4.0.10/NEWS --- ruby-passenger-4.0.8/NEWS 2013-07-09 07:55:25.000000000 +0000 +++ ruby-passenger-4.0.10/NEWS 2013-07-16 14:52:50.000000000 +0000 @@ -1,3 +1,17 @@ +Release 4.0.10 +-------------- + + * Fixed a crash in PassengerWatchdog which occurs on some OS X systems. + * Fixed exception reporting to Union Station. + * Improved documentation. + + +Release 4.0.9 +------------- + + * [Enterprise] Fixed a problem with passenger-irb. + + Release 4.0.8 ------------- diff -Nru ruby-passenger-4.0.8/README.md ruby-passenger-4.0.10/README.md --- ruby-passenger-4.0.8/README.md 2013-06-20 16:00:50.000000000 +0000 +++ ruby-passenger-4.0.10/README.md 2013-07-15 21:00:31.000000000 +0000 @@ -1,4 +1,6 @@ -# Introduction +# Phusion Passenger: a fast and robust web server and application server for Ruby, Python and Node.js + +[Phusion Passenger](https://www.phusionpassenger.com/) is a web server and application server, designed to be fast, robust and lightweight. It runs your web apps with the least amount of hassle by taking care of almost all administrative heavy lifting for you. Advanced administration tools allow you to gain deep insight into your web applications' operations and to keep your servers healthy. Phusion Passenger is polyglot by design, and currently supports Ruby (Rack), Python (WSGI) and Node.js. This is the [Phusion Passenger web application server](https://www.phusionpassenger.com/). diff -Nru ruby-passenger-4.0.8/debian/changelog ruby-passenger-4.0.10/debian/changelog --- ruby-passenger-4.0.8/debian/changelog 2013-07-09 10:21:27.000000000 +0000 +++ ruby-passenger-4.0.10/debian/changelog 2013-07-29 21:53:57.000000000 +0000 @@ -1,3 +1,9 @@ +ruby-passenger (1:4.0.10-1bbox1~raring1) raring; urgency=low + + * New upstream release, 4.0.10 + + -- John Leach Mon, 29 Jul 2013 22:51:53 +0100 + ruby-passenger (1:4.0.8-1bbox1~raring1) raring; urgency=high * New upstream release, 4.0.8 diff -Nru ruby-passenger-4.0.8/dev/run_travis.sh ruby-passenger-4.0.10/dev/run_travis.sh --- ruby-passenger-4.0.8/dev/run_travis.sh 2013-07-05 09:48:54.000000000 +0000 +++ ruby-passenger-4.0.10/dev/run_travis.sh 2013-07-13 07:57:06.000000000 +0000 @@ -21,6 +21,10 @@ "$@" } +run uname -a +run lsb_release -a +sudo tee /etc/dpkg/dpkg.cfg.d/02apt-speedup >/dev/null <<<"force-unsafe-io" + if [[ "$TEST_RUBY_VERSION" != "" ]]; then echo "$ rvm use $TEST_RUBY_VERSION" if [[ -f ~/.rvm/scripts/rvm ]]; then @@ -58,6 +62,7 @@ fi if [[ "$TEST_APACHE2" = 1 ]]; then + run sudo apt-get update run sudo apt-get install -y --no-install-recommends \ apache2-mpm-worker apache2-threaded-dev run rake test:install_deps RAILS_BUNDLES=no DOCTOOLS=no @@ -67,6 +72,7 @@ fi if [[ "$TEST_DEBIAN_PACKAGING" = 1 ]]; then + run sudo apt-get update run sudo apt-get install -y --no-install-recommends \ devscripts debhelper rake apache2-mpm-worker apache2-threaded-dev \ ruby1.8 ruby1.8-dev ruby1.9.1 ruby1.9.1-dev libev-dev gdebi-core \ diff -Nru ruby-passenger-4.0.8/doc/Users guide Apache.html ruby-passenger-4.0.10/doc/Users guide Apache.html --- ruby-passenger-4.0.8/doc/Users guide Apache.html 2013-07-09 08:23:38.000000000 +0000 +++ ruby-passenger-4.0.10/doc/Users guide Apache.html 2013-07-14 12:27:42.000000000 +0000 @@ -1283,6 +1283,7 @@
14. Appendix D: About environment variables
14.1. Working with environment variables
14.2. The PATH environment variable
+
14.2.1. Adding Phusion Passenger’s administration tools to PATH
14.3. Making environment variables permanent
14.3.1. bash
14.3.2. Apache
@@ -7078,6 +7079,75 @@ # => success! +
+

14.2.1. Adding Phusion Passenger’s administration tools to PATH

+

If you get a "command not found" error when invoking one of the Phusion Passenger administration tools (e.g. passenger-status or passenger-memory-stats then that means the tools are not in PATH, so you need to add them.

+
    +
  • +

    +If you installed Phusion Passenger with RubyGems, then the tools are in your RubyGems executable path. You can view the gem path using the command gem env: +

    +
    +
    +
    $ gem env
    +RubyGems Environment:
    +  - RUBYGEMS VERSION: 1.8.15
    +  - RUBY VERSION: 1.8.7 (2011-12-28 patchlevel 357) [i686-darwin10.8.0]
    +  - INSTALLATION DIRECTORY: /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8
    +  - RUBY EXECUTABLE: /opt/ruby-enterprise-1.8.7-2010.01/bin/ruby
    +  - EXECUTABLE DIRECTORY: /opt/ruby-enterprise-1.8.7-2010.01/bin    <--------- !!
    +  - RUBYGEMS PLATFORMS:
    +    - ruby
    +    - x86-darwin-10
    +  - GEM PATHS:
    +     - /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8
    +     - /Users/hongli/.gem/ruby/1.8
    +  - GEM CONFIGURATION:
    +     - :update_sources => true
    +     - :verbose => true
    +     - :benchmark => false
    +     - :backtrace => false
    +     - :bulk_threshold => 1000
    +     - "gem" => "--no-ri --no-rdoc"
    +  - REMOTE SOURCES:
    +     - http://rubygems.org/
    +
    +
    +

    As you can see, the RubyGems executable path in the example happens to be /opt/ruby-enterprise-1.8.7-2010.01/bin. So that directory must be added to PATH.

    +
  • +
  • +

    +If you installed Phusion Passenger using the tarball, then the tools are in the bin subdirectory of the Phusion Passenger tarball directory that you extracted. For example, if you extracted passenger-4.9.0.tar.gz inside /opt, then the tools are located in /opt/passenger-4.0.9/bin. In that case, you need to add /opt/passenger-4.0.9/bin to your PATH. +

    +
  • +
  • +

    +If you installed Phusion Passenger using native OS packages, then some Phusion Passenger administration tools are in /usr/bin, while others are in /usr/sbin. If you are not logged in as root, then /usr/sbin may not be in PATH, which would explain why you get a "command not found" when trying to invoke some of the tools. You should /usr/sbin to PATH. +

    +
  • +
  • +

    +If you are unsure where your Phusion Passenger directory is then you can use the find command to look them up. Go to the root directory and invoke find with sudo: +

    +
    +
    +
    $ cd /
    +$ sudo find . -name passenger-status
    +/usr/local/passenger/bin/passenger-status
    +
    +
    +

    In this example, the administration tools happen to be in /usr/local/passenger/bin, so you must add that to PATH.

    +
  • +
+
+ + + +
+Note +You may still get a "command not found" when invoking the tools through sudo, even after you’ve added the relevant directory to PATH. Please read Environment variables and sudo to learn more.
+
+

14.3. Making environment variables permanent

diff -Nru ruby-passenger-4.0.8/doc/Users guide Apache.idmap.txt ruby-passenger-4.0.10/doc/Users guide Apache.idmap.txt --- ruby-passenger-4.0.8/doc/Users guide Apache.idmap.txt 2013-07-09 08:23:38.000000000 +0000 +++ ruby-passenger-4.0.10/doc/Users guide Apache.idmap.txt 2013-07-14 12:27:42.000000000 +0000 @@ -370,6 +370,8 @@ 14.2. The PATH environment variable => the-path-environment-variable-p8e32r +14.2.1. Adding Phusion Passenger’s administration tools to PATH => adding-phusion-passenger-s-administration-tools-to-path-xwppud + 14.3. Making environment variables permanent => making-environment-variables-permanent-13x0l4h 14.3.1. bash => bash-1pktn63 diff -Nru ruby-passenger-4.0.8/doc/Users guide Nginx.html ruby-passenger-4.0.10/doc/Users guide Nginx.html --- ruby-passenger-4.0.8/doc/Users guide Nginx.html 2013-07-09 08:23:45.000000000 +0000 +++ ruby-passenger-4.0.10/doc/Users guide Nginx.html 2013-07-14 12:26:45.000000000 +0000 @@ -1253,6 +1253,7 @@ + @@ -6187,6 +6188,75 @@ # => success!
+
+

13.2.1. Adding Phusion Passenger’s administration tools to PATH

+

If you get a "command not found" error when invoking one of the Phusion Passenger administration tools (e.g. passenger-status or passenger-memory-stats then that means the tools are not in PATH, so you need to add them.

+
    +
  • +

    +If you installed Phusion Passenger with RubyGems, then the tools are in your RubyGems executable path. You can view the gem path using the command gem env: +

    +
    +
    +
    $ gem env
    +RubyGems Environment:
    +  - RUBYGEMS VERSION: 1.8.15
    +  - RUBY VERSION: 1.8.7 (2011-12-28 patchlevel 357) [i686-darwin10.8.0]
    +  - INSTALLATION DIRECTORY: /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8
    +  - RUBY EXECUTABLE: /opt/ruby-enterprise-1.8.7-2010.01/bin/ruby
    +  - EXECUTABLE DIRECTORY: /opt/ruby-enterprise-1.8.7-2010.01/bin    <--------- !!
    +  - RUBYGEMS PLATFORMS:
    +    - ruby
    +    - x86-darwin-10
    +  - GEM PATHS:
    +     - /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8
    +     - /Users/hongli/.gem/ruby/1.8
    +  - GEM CONFIGURATION:
    +     - :update_sources => true
    +     - :verbose => true
    +     - :benchmark => false
    +     - :backtrace => false
    +     - :bulk_threshold => 1000
    +     - "gem" => "--no-ri --no-rdoc"
    +  - REMOTE SOURCES:
    +     - http://rubygems.org/
    +
    +
    +

    As you can see, the RubyGems executable path in the example happens to be /opt/ruby-enterprise-1.8.7-2010.01/bin. So that directory must be added to PATH.

    +
  • +
  • +

    +If you installed Phusion Passenger using the tarball, then the tools are in the bin subdirectory of the Phusion Passenger tarball directory that you extracted. For example, if you extracted passenger-4.9.0.tar.gz inside /opt, then the tools are located in /opt/passenger-4.0.9/bin. In that case, you need to add /opt/passenger-4.0.9/bin to your PATH. +

    +
  • +
  • +

    +If you installed Phusion Passenger using native OS packages, then some Phusion Passenger administration tools are in /usr/bin, while others are in /usr/sbin. If you are not logged in as root, then /usr/sbin may not be in PATH, which would explain why you get a "command not found" when trying to invoke some of the tools. You should /usr/sbin to PATH. +

    +
  • +
  • +

    +If you are unsure where your Phusion Passenger directory is then you can use the find command to look them up. Go to the root directory and invoke find with sudo: +

    +
    +
    +
    $ cd /
    +$ sudo find . -name passenger-status
    +/usr/local/passenger/bin/passenger-status
    +
    +
    +

    In this example, the administration tools happen to be in /usr/local/passenger/bin, so you must add that to PATH.

    +
  • +
+
+ + + +
+Note +You may still get a "command not found" when invoking the tools through sudo, even after you’ve added the relevant directory to PATH. Please read Environment variables and sudo to learn more.
+
+

13.3. Making environment variables permanent

diff -Nru ruby-passenger-4.0.8/doc/Users guide Nginx.idmap.txt ruby-passenger-4.0.10/doc/Users guide Nginx.idmap.txt --- ruby-passenger-4.0.8/doc/Users guide Nginx.idmap.txt 2013-07-09 08:23:45.000000000 +0000 +++ ruby-passenger-4.0.10/doc/Users guide Nginx.idmap.txt 2013-07-14 12:26:45.000000000 +0000 @@ -310,6 +310,8 @@ 13.2. The PATH environment variable => the-path-environment-variable-vlp05e +13.2.1. Adding Phusion Passenger’s administration tools to PATH => adding-phusion-passenger-s-administration-tools-to-path-1flz2tu + 13.3. Making environment variables permanent => making-environment-variables-permanent-1wjyhzt 13.3.1. bash => bash-19xsxec diff -Nru ruby-passenger-4.0.8/doc/users_guide_snippets/environment_variables.txt ruby-passenger-4.0.10/doc/users_guide_snippets/environment_variables.txt --- ruby-passenger-4.0.8/doc/users_guide_snippets/environment_variables.txt 2013-07-05 08:02:40.000000000 +0000 +++ ruby-passenger-4.0.10/doc/users_guide_snippets/environment_variables.txt 2013-07-14 12:26:37.000000000 +0000 @@ -107,6 +107,53 @@ # => success! ---------------------- +==== Adding Phusion Passenger's administration tools to PATH + +If you get a "command not found" error when invoking one of the Phusion Passenger administration tools (e.g. `passenger-status` or `passenger-memory-stats` then that means the tools are not in `PATH`, so you need to add them. + + * If you <>, then the tools are in your RubyGems executable path. You can view the gem path using the command `gem env`: ++ +------------------------------ +$ gem env +RubyGems Environment: + - RUBYGEMS VERSION: 1.8.15 + - RUBY VERSION: 1.8.7 (2011-12-28 patchlevel 357) [i686-darwin10.8.0] + - INSTALLATION DIRECTORY: /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8 + - RUBY EXECUTABLE: /opt/ruby-enterprise-1.8.7-2010.01/bin/ruby + - EXECUTABLE DIRECTORY: /opt/ruby-enterprise-1.8.7-2010.01/bin <--------- !! + - RUBYGEMS PLATFORMS: + - ruby + - x86-darwin-10 + - GEM PATHS: + - /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8 + - /Users/hongli/.gem/ruby/1.8 + - GEM CONFIGURATION: + - :update_sources => true + - :verbose => true + - :benchmark => false + - :backtrace => false + - :bulk_threshold => 1000 + - "gem" => "--no-ri --no-rdoc" + - REMOTE SOURCES: + - http://rubygems.org/ +------------------------------ ++ +As you can see, the RubyGems executable path in the example happens to be `/opt/ruby-enterprise-1.8.7-2010.01/bin`. So that directory must be added to `PATH`. + + * If you <>, then the tools are in the `bin` subdirectory of the Phusion Passenger tarball directory that you extracted. For example, if you extracted `passenger-4.9.0.tar.gz` inside `/opt`, then the tools are located in `/opt/passenger-4.0.9/bin`. In that case, you need to add `/opt/passenger-4.0.9/bin` to your `PATH`. + * If you installed Phusion Passenger using native OS packages, then some Phusion Passenger administration tools are in `/usr/bin`, while others are in `/usr/sbin`. If you are not logged in as root, then `/usr/sbin` may not be in `PATH`, which would explain why you get a "command not found" when trying to invoke some of the tools. You should `/usr/sbin` to `PATH`. + * If you are unsure where your Phusion Passenger directory is then you can use the `find` command to look them up. Go to the root directory and invoke `find` with `sudo`: ++ +-------------------------------- +$ cd / +$ sudo find . -name passenger-status +/usr/local/passenger/bin/passenger-status +-------------------------------- ++ +In this example, the administration tools happen to be in `/usr/local/passenger/bin`, so you must add that to `PATH`. + +NOTE: You may still get a "command not found" when invoking the tools through sudo, even after you've added the relevant directory to `PATH`. Please read <> to learn more. + === Making environment variables permanent When you exit your shell, the evironment variable changes are lost. There is no standard method to set environment variables system-wide, so you have to set them in different configuration files for different services. diff -Nru ruby-passenger-4.0.8/ext/common/Constants.h ruby-passenger-4.0.10/ext/common/Constants.h --- ruby-passenger-4.0.8/ext/common/Constants.h 2013-07-09 08:09:52.000000000 +0000 +++ ruby-passenger-4.0.10/ext/common/Constants.h 2013-07-16 14:53:05.000000000 +0000 @@ -70,7 +70,7 @@ #define PROCESS_SHUTDOWN_TIMEOUT_DISPLAY "1 minute" - #define PASSENGER_VERSION "4.0.8" + #define PASSENGER_VERSION "4.0.10" #define SERVER_INSTANCE_DIR_STRUCTURE_MAJOR_VERSION 1 diff -Nru ruby-passenger-4.0.8/ext/common/agents/HelperAgent/Main.cpp ruby-passenger-4.0.10/ext/common/agents/HelperAgent/Main.cpp --- ruby-passenger-4.0.8/ext/common/agents/HelperAgent/Main.cpp 2013-07-05 13:50:18.000000000 +0000 +++ ruby-passenger-4.0.10/ext/common/agents/HelperAgent/Main.cpp 2013-07-09 19:22:52.000000000 +0000 @@ -587,6 +587,7 @@ main(int argc, char *argv[]) { TRACE_POINT(); AgentOptions options(initializeAgent(argc, argv, "PassengerHelperAgent")); + P_DEBUG("Starting PassengerHelperAgent..."); MultiLibeio::init(); try { diff -Nru ruby-passenger-4.0.8/ext/common/agents/LoggingAgent/LoggingServer.h ruby-passenger-4.0.10/ext/common/agents/LoggingAgent/LoggingServer.h --- ruby-passenger-4.0.8/ext/common/agents/LoggingAgent/LoggingServer.h 2013-07-05 13:12:25.000000000 +0000 +++ ruby-passenger-4.0.10/ext/common/agents/LoggingAgent/LoggingServer.h 2013-07-12 14:19:39.000000000 +0000 @@ -93,6 +93,9 @@ /** Last time data was actually written to the underlying storage device. */ ev_tstamp lastFlushed; + + /** The amount of data that has been written to this sink so far. */ + unsigned int writtenTo; /** * This LogSink's iterator inside LoggingServer.logSinkCache. @@ -110,6 +113,7 @@ opened = 0; lastUsed = ev_now(server->getLoop()); lastFlushed = lastUsed; + writtenTo = 0; } virtual ~LogSink() { @@ -127,7 +131,10 @@ } virtual void append(const DataStoreId &dataStoreId, - const StaticString &data) = 0; + const StaticString &data) + { + writtenTo += data.size(); + } virtual bool flush() { lastFlushed = ev_now(server->getLoop()); @@ -163,6 +170,7 @@ } virtual void append(const DataStoreId &dataStoreId, const StaticString &data) { + LogSink::append(dataStoreId, data); syscalls::write(fd, data.data(), data.size()); } @@ -171,6 +179,7 @@ stream << " Opened : " << opened << "\n"; stream << " LastUsed : " << distanceOfTimeInWords((time_t) lastUsed) << " ago\n"; stream << " LastFlushed: " << distanceOfTimeInWords((time_t) lastFlushed) << " ago\n"; + stream << " WrittenTo : " << writtenTo << "\n"; } }; @@ -223,6 +232,7 @@ } virtual void append(const DataStoreId &dataStoreId, const StaticString &data) { + LogSink::append(dataStoreId, data); if (bufferSize + data.size() > BUFFER_CAPACITY) { StaticString data2[2]; data2[0] = StaticString(buffer, bufferSize); @@ -265,6 +275,7 @@ stream << " Opened : " << opened << "\n"; stream << " LastUsed : " << distanceOfTimeInWords((time_t) lastUsed) << " ago\n"; stream << " LastFlushed: " << distanceOfTimeInWords((time_t) lastFlushed) << " ago\n"; + stream << " WrittenTo : " << writtenTo << "\n"; stream << " BufferSize : " << bufferSize << "\n"; } }; diff -Nru ruby-passenger-4.0.8/ext/common/agents/Watchdog/AgentWatcher.cpp ruby-passenger-4.0.10/ext/common/agents/Watchdog/AgentWatcher.cpp --- ruby-passenger-4.0.8/ext/common/agents/Watchdog/AgentWatcher.cpp 2013-07-05 08:02:40.000000000 +0000 +++ ruby-passenger-4.0.10/ext/common/agents/Watchdog/AgentWatcher.cpp 2013-07-09 19:49:08.000000000 +0000 @@ -106,15 +106,15 @@ boost::lock_guard l(lock); threadExceptionMessage = e.what(); threadExceptionBacktrace = e.backtrace(); - errorEvent->notify(); + wo->errorEvent.notify(); } catch (const std::exception &e) { boost::lock_guard l(lock); threadExceptionMessage = e.what(); - errorEvent->notify(); + wo->errorEvent.notify(); } catch (...) { boost::lock_guard l(lock); threadExceptionMessage = "Unknown error"; - errorEvent->notify(); + wo->errorEvent.notify(); } } @@ -137,6 +137,8 @@ * the watcher thread. */ mutable boost::mutex lock; + + WorkingObjectsPtr wo; /** * Returns the filename of the agent process's executable. This method may be @@ -217,9 +219,10 @@ } public: - AgentWatcher() { + AgentWatcher(const WorkingObjectsPtr &wo) { thr = NULL; pid = 0; + this->wo = wo; } virtual ~AgentWatcher() { @@ -424,7 +427,7 @@ } /** - * Start watching the agent process. + * Begin watching the agent process. * * @pre start() has been called and succeeded. * @pre This watcher isn't already watching. @@ -432,7 +435,7 @@ * @throws thread_interrupted * @throws thread_resource_error */ - virtual void startWatching() { + virtual void beginWatching() { boost::lock_guard l(lock); if (pid == 0) { throw RuntimeException("start() hasn't been called yet"); diff -Nru ruby-passenger-4.0.8/ext/common/agents/Watchdog/HelperAgentWatcher.cpp ruby-passenger-4.0.10/ext/common/agents/Watchdog/HelperAgentWatcher.cpp --- ruby-passenger-4.0.8/ext/common/agents/Watchdog/HelperAgentWatcher.cpp 2013-06-27 13:19:11.000000000 +0000 +++ ruby-passenger-4.0.10/ext/common/agents/Watchdog/HelperAgentWatcher.cpp 2013-07-09 19:44:55.000000000 +0000 @@ -64,27 +64,29 @@ } public: - HelperAgentWatcher(const ResourceLocator &resourceLocator) { - helperAgentFilename = resourceLocator.getAgentsDir() + "/PassengerHelperAgent"; + HelperAgentWatcher(const WorkingObjectsPtr &wo) + : AgentWatcher(wo) + { + helperAgentFilename = wo->resourceLocator->getAgentsDir() + "/PassengerHelperAgent"; report .set("request_socket_filename", agentsOptions.get("request_socket_filename", false, - generation->getPath() + "/request")) + wo->generation->getPath() + "/request")) .set("request_socket_password", agentsOptions.get("request_socket_password", false, - randomGenerator->generateAsciiString(REQUEST_SOCKET_PASSWORD_SIZE))) + wo->randomGenerator.generateAsciiString(REQUEST_SOCKET_PASSWORD_SIZE))) .set("helper_agent_admin_socket_address", agentsOptions.get("helper_agent_admin_socket_address", false, - "unix:" + generation->getPath() + "/helper_admin")) + "unix:" + wo->generation->getPath() + "/helper_admin")) .set("helper_agent_exit_password", agentsOptions.get("helper_agent_exit_password", false, - randomGenerator->generateAsciiString(MESSAGE_SERVER_MAX_PASSWORD_SIZE))); + wo->randomGenerator.generateAsciiString(MESSAGE_SERVER_MAX_PASSWORD_SIZE))); params = report; params - .set("logging_agent_address", loggingAgentAddress) - .set("logging_agent_password", loggingAgentPassword); + .set("logging_agent_address", wo->loggingAgentAddress) + .set("logging_agent_password", wo->loggingAgentPassword); } virtual void reportAgentsInformation(VariantMap &report) { diff -Nru ruby-passenger-4.0.8/ext/common/agents/Watchdog/LoggingAgentWatcher.cpp ruby-passenger-4.0.10/ext/common/agents/Watchdog/LoggingAgentWatcher.cpp --- ruby-passenger-4.0.8/ext/common/agents/Watchdog/LoggingAgentWatcher.cpp 2013-07-05 08:02:40.000000000 +0000 +++ ruby-passenger-4.0.10/ext/common/agents/Watchdog/LoggingAgentWatcher.cpp 2013-07-09 19:45:51.000000000 +0000 @@ -42,9 +42,9 @@ virtual void sendStartupArguments(pid_t pid, FileDescriptor &fd) { VariantMap options = agentsOptions; - options.set("logging_agent_address", loggingAgentAddress); - options.set("logging_agent_password", loggingAgentPassword); - options.set("logging_agent_admin_address", loggingAgentAdminAddress); + options.set("logging_agent_address", wo->loggingAgentAddress); + options.set("logging_agent_password", wo->loggingAgentPassword); + options.set("logging_agent_admin_address", wo->loggingAgentAdminAddress); options.writeToFd(fd); } @@ -57,14 +57,16 @@ } public: - LoggingAgentWatcher(const ResourceLocator &resourceLocator) { - agentFilename = resourceLocator.getAgentsDir() + "/PassengerLoggingAgent"; + LoggingAgentWatcher(const WorkingObjectsPtr &wo) + : AgentWatcher(wo) + { + agentFilename = wo->resourceLocator->getAgentsDir() + "/PassengerLoggingAgent"; } virtual void reportAgentsInformation(VariantMap &report) { report - .set("logging_socket_address", loggingAgentAddress) - .set("logging_socket_password", loggingAgentPassword) - .set("logging_socket_admin_address", loggingAgentAdminAddress); + .set("logging_socket_address", wo->loggingAgentAddress) + .set("logging_socket_password", wo->loggingAgentPassword) + .set("logging_socket_admin_address", wo->loggingAgentAdminAddress); } }; diff -Nru ruby-passenger-4.0.8/ext/common/agents/Watchdog/Main.cpp ruby-passenger-4.0.10/ext/common/agents/Watchdog/Main.cpp --- ruby-passenger-4.0.8/ext/common/agents/Watchdog/Main.cpp 2013-07-05 08:02:40.000000000 +0000 +++ ruby-passenger-4.0.10/ext/common/agents/Watchdog/Main.cpp 2013-07-09 19:52:21.000000000 +0000 @@ -72,11 +72,13 @@ #define REQUEST_SOCKET_PASSWORD_SIZE 64 class ServerInstanceDirToucher; +class AgentWatcher; static bool hasEnvOption(const char *name, bool defaultValue = false); static void setOomScore(const StaticString &score); -/** The options that were passed to AgentsStarter. */ +/***** Agent options *****/ + static VariantMap agentsOptions; static string tempDir; static bool userSwitching; @@ -84,31 +86,36 @@ static string defaultGroup; static uid_t webServerWorkerUid; static gid_t webServerWorkerGid; -static string serializedPrestartURLs; /***** Working objects *****/ + +struct WorkingObjects { + RandomGenerator randomGenerator; + EventFd errorEvent; + ResourceLocatorPtr resourceLocator; + ServerInstanceDirPtr serverInstanceDir; + ServerInstanceDir::GenerationPtr generation; + uid_t defaultUid; + gid_t defaultGid; + string loggingAgentAddress; + string loggingAgentPassword; + string loggingAgentAdminAddress; + string adminToolStatusPassword; + string adminToolManipulationPassword; +}; + +typedef shared_ptr WorkingObjectsPtr; + static string oldOomScore; -static RandomGenerator *randomGenerator; -static EventFd *errorEvent; -static ResourceLocator *resourceLocator; -static ServerInstanceDirPtr serverInstanceDir; -static ServerInstanceDir::GenerationPtr generation; -static ServerInstanceDirToucher *serverInstanceDirToucher; -static uid_t defaultUid; -static gid_t defaultGid; -static string loggingAgentAddress; -static string loggingAgentPassword; -static string loggingAgentAdminAddress; -static string adminToolStatusPassword; -static string adminToolManipulationPassword; #include "AgentWatcher.cpp" +#include "ServerInstanceDirToucher.cpp" #include "HelperAgentWatcher.cpp" #include "LoggingAgentWatcher.cpp" -#include "ServerInstanceDirToucher.cpp" -static vector watchers; +/***** Functions *****/ + static bool hasEnvOption(const char *name, bool defaultValue) { const char *value = getenv(name); @@ -218,19 +225,19 @@ * an error. */ static bool -waitForStarterProcessOrWatchers(vector &watchers) { +waitForStarterProcessOrWatchers(const WorkingObjectsPtr &wo, vector &watchers) { fd_set fds; int max, ret; char x; FD_ZERO(&fds); FD_SET(FEEDBACK_FD, &fds); - FD_SET(errorEvent->fd(), &fds); + FD_SET(wo->errorEvent.fd(), &fds); - if (FEEDBACK_FD > errorEvent->fd()) { + if (FEEDBACK_FD > wo->errorEvent.fd()) { max = FEEDBACK_FD; } else { - max = errorEvent->fd(); + max = wo->errorEvent.fd(); } ret = syscalls::select(max + 1, &fds, NULL, NULL, NULL); @@ -240,7 +247,7 @@ return false; } - if (FD_ISSET(errorEvent->fd(), &fds)) { + if (FD_ISSET(wo->errorEvent.fd(), &fds)) { vector::const_iterator it; string message, backtrace, watcherName; @@ -264,7 +271,7 @@ } static void -cleanupAgentsInBackground(vector &watchers, char *argv[]) { +cleanupAgentsInBackground(const WorkingObjectsPtr &wo, vector &watchers, char *argv[]) { this_thread::disable_interruption di; this_thread::disable_syscall_interruption dsi; pid_t pid; @@ -335,8 +342,8 @@ } // Now clean up the server instance directory. - delete generation.get(); - delete serverInstanceDir.get(); + delete wo->generation.get(); + delete wo->serverInstanceDir.get(); _exit(0); @@ -349,8 +356,8 @@ // Parent // Let child process handle cleanup. - serverInstanceDir->detach(); - generation->detach(); + wo->serverInstanceDir->detach(); + wo->generation->detach(); } } @@ -481,11 +488,10 @@ } static void -initializeWorkingObjects() { +initializeWorkingObjects(WorkingObjectsPtr &wo, ServerInstanceDirToucherPtr &serverInstanceDirToucher) { TRACE_POINT(); - randomGenerator = new RandomGenerator(); - errorEvent = new EventFd(); - resourceLocator = new ResourceLocator(agentsOptions.get("passenger_root")); + wo = make_shared(); + wo->resourceLocator = make_shared(agentsOptions.get("passenger_root")); UPDATE_TRACE_POINT(); // Must not used make_shared() here because Watchdog.cpp @@ -501,54 +507,54 @@ toString(SERVER_INSTANCE_DIR_STRUCTURE_MAJOR_VERSION) + "." + toString(SERVER_INSTANCE_DIR_STRUCTURE_MINOR_VERSION) + "." + toString(agentsOptions.getPid("web_server_pid")); - serverInstanceDir.reset(new ServerInstanceDir(path)); + wo->serverInstanceDir.reset(new ServerInstanceDir(path)); } else { - serverInstanceDir.reset(new ServerInstanceDir(agentsOptions.get("server_instance_dir"))); - agentsOptions.set("server_instance_dir", serverInstanceDir->getPath()); + wo->serverInstanceDir.reset(new ServerInstanceDir(agentsOptions.get("server_instance_dir"))); + agentsOptions.set("server_instance_dir", wo->serverInstanceDir->getPath()); } - generation = serverInstanceDir->newGeneration(userSwitching, defaultUser, + wo->generation = wo->serverInstanceDir->newGeneration(userSwitching, defaultUser, defaultGroup, webServerWorkerUid, webServerWorkerGid); - agentsOptions.set("server_instance_dir", serverInstanceDir->getPath()); - agentsOptions.setInt("generation_number", generation->getNumber()); + agentsOptions.set("server_instance_dir", wo->serverInstanceDir->getPath()); + agentsOptions.setInt("generation_number", wo->generation->getNumber()); UPDATE_TRACE_POINT(); - serverInstanceDirToucher = new ServerInstanceDirToucher(); + serverInstanceDirToucher = make_shared(wo); UPDATE_TRACE_POINT(); - lookupDefaultUidGid(defaultUid, defaultGid); + lookupDefaultUidGid(wo->defaultUid, wo->defaultGid); UPDATE_TRACE_POINT(); - loggingAgentAddress = "unix:" + generation->getPath() + "/logging"; - loggingAgentPassword = randomGenerator->generateAsciiString(64); - loggingAgentAdminAddress = "unix:" + generation->getPath() + "/logging_admin"; + wo->loggingAgentAddress = "unix:" + wo->generation->getPath() + "/logging"; + wo->loggingAgentPassword = wo->randomGenerator.generateAsciiString(64); + wo->loggingAgentAdminAddress = "unix:" + wo->generation->getPath() + "/logging_admin"; UPDATE_TRACE_POINT(); - adminToolStatusPassword = randomGenerator->generateAsciiString(MESSAGE_SERVER_MAX_PASSWORD_SIZE); - adminToolManipulationPassword = randomGenerator->generateAsciiString(MESSAGE_SERVER_MAX_PASSWORD_SIZE); - agentsOptions.set("admin_tool_status_password", adminToolStatusPassword); - agentsOptions.set("admin_tool_manipulation_password", adminToolManipulationPassword); + wo->adminToolStatusPassword = wo->randomGenerator.generateAsciiString(MESSAGE_SERVER_MAX_PASSWORD_SIZE); + wo->adminToolManipulationPassword = wo->randomGenerator.generateAsciiString(MESSAGE_SERVER_MAX_PASSWORD_SIZE); + agentsOptions.set("admin_tool_status_password", wo->adminToolStatusPassword); + agentsOptions.set("admin_tool_manipulation_password", wo->adminToolManipulationPassword); if (geteuid() == 0 && !userSwitching) { - createFile(generation->getPath() + "/passenger-status-password.txt", - adminToolStatusPassword, S_IRUSR, defaultUid, defaultGid); - createFile(generation->getPath() + "/admin-manipulation-password.txt", - adminToolManipulationPassword, S_IRUSR, defaultUid, defaultGid); + createFile(wo->generation->getPath() + "/passenger-status-password.txt", + wo->adminToolStatusPassword, S_IRUSR, wo->defaultUid, wo->defaultGid); + createFile(wo->generation->getPath() + "/admin-manipulation-password.txt", + wo->adminToolManipulationPassword, S_IRUSR, wo->defaultUid, wo->defaultGid); } else { - createFile(generation->getPath() + "/passenger-status-password.txt", - adminToolStatusPassword, S_IRUSR | S_IWUSR); - createFile(generation->getPath() + "/admin-manipulation-password.txt", - adminToolManipulationPassword, S_IRUSR | S_IWUSR); + createFile(wo->generation->getPath() + "/passenger-status-password.txt", + wo->adminToolStatusPassword, S_IRUSR | S_IWUSR); + createFile(wo->generation->getPath() + "/admin-manipulation-password.txt", + wo->adminToolManipulationPassword, S_IRUSR | S_IWUSR); } } static void -initializeAgentWatchers() { +initializeAgentWatchers(const WorkingObjectsPtr &wo, vector &watchers) { TRACE_POINT(); - watchers.push_back(make_shared(*resourceLocator)); - watchers.push_back(make_shared(*resourceLocator)); + watchers.push_back(make_shared(wo)); + watchers.push_back(make_shared(wo)); } static void -startAgents() { +startAgents(const WorkingObjectsPtr &wo, vector &watchers) { TRACE_POINT(); foreach (AgentWatcherPtr watcher, watchers) { try { @@ -566,10 +572,10 @@ } static void -startWatchingAgents() { +beginWatchingAgents(const WorkingObjectsPtr &wo, vector &watchers) { foreach (AgentWatcherPtr watcher, watchers) { try { - watcher->startWatching(); + watcher->beginWatching(); } catch (const std::exception &e) { writeArrayMessage(FEEDBACK_FD, "Watchdog startup error", @@ -583,13 +589,13 @@ } static void -reportAgentsInformation() { +reportAgentsInformation(const WorkingObjectsPtr &wo, const vector &watchers) { TRACE_POINT(); VariantMap report; report - .set("server_instance_dir", serverInstanceDir->getPath()) - .setInt("generation", generation->getNumber()); + .set("server_instance_dir", wo->serverInstanceDir->getPath()) + .setInt("generation", wo->generation->getNumber()); foreach (AgentWatcherPtr watcher, watchers) { watcher->reportAgentsInformation(report); @@ -602,13 +608,16 @@ main(int argc, char *argv[]) { initializeBareEssentials(argc, argv); P_DEBUG("Starting Watchdog..."); + WorkingObjectsPtr wo; + ServerInstanceDirToucherPtr serverInstanceDirToucher; + vector watchers; try { TRACE_POINT(); initializeOptions(); maybeSetsid(); - initializeWorkingObjects(); - initializeAgentWatchers(); + initializeWorkingObjects(wo, serverInstanceDirToucher); + initializeAgentWatchers(wo, watchers); } catch (const std::exception &e) { writeArrayMessage(FEEDBACK_FD, "Watchdog startup error", @@ -620,15 +629,15 @@ try { TRACE_POINT(); - startAgents(); - startWatchingAgents(); - reportAgentsInformation(); + startAgents(wo, watchers); + beginWatchingAgents(wo, watchers); + reportAgentsInformation(wo, watchers); P_INFO("All Phusion Passenger agents started!"); UPDATE_TRACE_POINT(); this_thread::disable_interruption di; this_thread::disable_syscall_interruption dsi; - bool exitGracefully = waitForStarterProcessOrWatchers(watchers); + bool exitGracefully = waitForStarterProcessOrWatchers(wo, watchers); if (exitGracefully) { /* Fork a child process which cleans up all the agent processes in * the background and exit this watchdog process so that we don't block @@ -642,7 +651,7 @@ AgentWatcher::stopWatching(watchers); if (exitGracefully) { UPDATE_TRACE_POINT(); - cleanupAgentsInBackground(watchers, argv); + cleanupAgentsInBackground(wo, watchers, argv); return 0; } else { UPDATE_TRACE_POINT(); diff -Nru ruby-passenger-4.0.8/ext/common/agents/Watchdog/ServerInstanceDirToucher.cpp ruby-passenger-4.0.10/ext/common/agents/Watchdog/ServerInstanceDirToucher.cpp --- ruby-passenger-4.0.8/ext/common/agents/Watchdog/ServerInstanceDirToucher.cpp 2013-06-27 13:19:11.000000000 +0000 +++ ruby-passenger-4.0.10/ext/common/agents/Watchdog/ServerInstanceDirToucher.cpp 2013-07-09 19:44:23.000000000 +0000 @@ -30,9 +30,10 @@ */ class ServerInstanceDirToucher { private: + WorkingObjectsPtr wo; oxt::thread *thr; - static void + void threadMain() { while (!this_thread::interruption_requested()) { syscalls::sleep(60 * 60 * 6); @@ -66,12 +67,12 @@ } do { - ret = chdir(serverInstanceDir->getPath().c_str()); + ret = chdir(wo->serverInstanceDir->getPath().c_str()); } while (ret == -1 && errno == EINTR); if (ret == -1) { e = errno; fprintf(stderr, "chdir(\"%s\") failed: %s (%d)\n", - serverInstanceDir->getPath().c_str(), + wo->serverInstanceDir->getPath().c_str(), strerror(e), e); fflush(stderr); _exit(1); @@ -100,8 +101,10 @@ } public: - ServerInstanceDirToucher() { - thr = new oxt::thread(threadMain, "Server instance dir toucher", 256 * 1024); + ServerInstanceDirToucher(const WorkingObjectsPtr &wo) { + this->wo = wo; + thr = new oxt::thread(boost::bind(&ServerInstanceDirToucher::threadMain, this), + "Server instance dir toucher", 256 * 1024); } ~ServerInstanceDirToucher() { @@ -109,3 +112,5 @@ delete thr; } }; + +typedef shared_ptr ServerInstanceDirToucherPtr; diff -Nru ruby-passenger-4.0.8/lib/phusion_passenger/admin_tools/server_instance.rb ruby-passenger-4.0.10/lib/phusion_passenger/admin_tools/server_instance.rb --- ruby-passenger-4.0.8/lib/phusion_passenger/admin_tools/server_instance.rb 2013-07-05 08:02:40.000000000 +0000 +++ ruby-passenger-4.0.10/lib/phusion_passenger/admin_tools/server_instance.rb 2013-07-10 11:13:41.000000000 +0000 @@ -238,9 +238,8 @@ return nil end - # FIXME: probably broken - def stats - doc = REXML::Document.new(xml) + def stats(client) + doc = REXML::Document.new(client.pool_xml) stats = Stats.new stats.max = doc.elements["info/max"].text.to_i stats.usage = doc.elements["info/usage"].text.to_i @@ -248,12 +247,10 @@ return stats end - # FIXME: probably broken - def get_wait_list_size - return stats.get_wait_list_size + def get_wait_list_size(client) + return stats(client).get_wait_list_size end - # FIXME: probably broken def groups(client) doc = REXML::Document.new(client.pool_xml) @@ -297,7 +294,6 @@ return groups end - # FIXME: probably broken def processes(client) return groups(client).map do |group| group.processes diff -Nru ruby-passenger-4.0.8/lib/phusion_passenger/analytics_logger.rb ruby-passenger-4.0.10/lib/phusion_passenger/analytics_logger.rb --- ruby-passenger-4.0.8/lib/phusion_passenger/analytics_logger.rb 2013-06-20 16:00:50.000000000 +0000 +++ ruby-passenger-4.0.10/lib/phusion_passenger/analytics_logger.rb 2013-07-12 14:19:39.000000000 +0000 @@ -47,7 +47,7 @@ end def null? - return !@connection + return !@connection || !@connection.connected? end def message(text) diff -Nru ruby-passenger-4.0.8/lib/phusion_passenger/constants.rb ruby-passenger-4.0.10/lib/phusion_passenger/constants.rb --- ruby-passenger-4.0.8/lib/phusion_passenger/constants.rb 2013-06-20 16:00:50.000000000 +0000 +++ ruby-passenger-4.0.10/lib/phusion_passenger/constants.rb 2013-07-12 14:19:39.000000000 +0000 @@ -26,7 +26,7 @@ module PhusionPassenger PASSENGER_ANALYTICS_WEB_LOG = "PASSENGER_ANALYTICS_WEB_LOG".freeze PASSENGER_TXN_ID = "PASSENGER_TXN_ID".freeze - PASSENGER_UNION_STATION_KEY = "PASSENGER_UNION_STATION_KEY".freeze + PASSENGER_UNION_STATION_KEY = "UNION_STATION_KEY".freeze RACK_HIJACK_IO = "rack.hijack_io".freeze # Constants shared between the C++ and Ruby codebase. The C++ Constants.h diff -Nru ruby-passenger-4.0.8/lib/phusion_passenger.rb ruby-passenger-4.0.10/lib/phusion_passenger.rb --- ruby-passenger-4.0.8/lib/phusion_passenger.rb 2013-07-09 08:09:39.000000000 +0000 +++ ruby-passenger-4.0.10/lib/phusion_passenger.rb 2013-07-16 14:52:57.000000000 +0000 @@ -30,7 +30,7 @@ PACKAGE_NAME = 'passenger' # Run 'rake ext/common/Constants.h' after changing this number. - VERSION_STRING = '4.0.8' + VERSION_STRING = '4.0.10' PREFERRED_NGINX_VERSION = '1.4.1' NGINX_SHA256_CHECKSUM = 'bca5d1e89751ba29406185e1736c390412603a7e6b604f5b4575281f6565d119' diff -Nru ruby-passenger-4.0.8/passenger.gemspec ruby-passenger-4.0.10/passenger.gemspec --- ruby-passenger-4.0.8/passenger.gemspec 2013-06-20 16:00:50.000000000 +0000 +++ ruby-passenger-4.0.10/passenger.gemspec 2013-07-16 14:09:21.000000000 +0000 @@ -7,7 +7,7 @@ Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.homepage = "https://www.phusionpassenger.com/" - s.summary = "Easy and robust Ruby web application deployment" + s.summary = "A fast and robust web server and application server for Ruby, Python and Node.js" s.name = PhusionPassenger::PACKAGE_NAME s.version = PhusionPassenger::VERSION_STRING s.rubyforge_project = "passenger" @@ -21,5 +21,6 @@ Dir[*PhusionPassenger::Packaging::EXCLUDE_GLOB] s.executables = PhusionPassenger::Packaging::USER_EXECUTABLES + PhusionPassenger::Packaging::SUPER_USER_EXECUTABLES - s.description = "Easy and robust Ruby web application deployment." + s.description = "A modern web server and application server for Ruby, Python and Node.js, " + + "optimized for performance, low memory usage and ease of use." end