passenger 4.0.8 → 4.0.10

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

data.tar.gz.asc CHANGED
@@ -2,11 +2,11 @@
2
2
  Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
3
3
  Comment: GPGTools - http://gpgtools.org
4
4
 
5
- iQEcBAABAgAGBQJR28iYAAoJECrHRaUKISqMPf4IAIGf9BCAw6AwVnoumKhaWkim
6
- k+hKA1kkPofS9Q7DZPEA5sizgSB1RCW8clalOF5Wb+kCn3KNwfluBENw2Bl974+A
7
- HubjUnT58//z4bNqx7cEjBxfVWrs8VwINd8nbtEnjVaZG9Xkh+zinGsBwVbvgBE/
8
- kwwklTV25qOPV3E9eLvWprB4i6lZEVCpsgJzn6HHz+mOxy9OS2VEGJQKZcCLU4WD
9
- EWiinu8mJmKWGDHAigzNs6xFCfR9i8tRp56y9p5nQrxDqAhYaGdcwPPvD2iNabgh
10
- dtnid9XFZeEOG5PtNktJ8P/2VX3ziFKnsvq5qYQMrV/lVQdBDeZDlcTfTHBDgqw=
11
- =V08b
5
+ iQEcBAABAgAGBQJR5WamAAoJECrHRaUKISqMsmoH/igRg7U+YBfKIrRjpDo1Dq3S
6
+ /aaIPmBo9QudDtB2I50CbldyvDQGYmHEogQXXENZVEHe4erFvhhpHVAO4l4SEpBN
7
+ 0vd2M8DXTx8QZX+AF4JwHnWG+xqLzRYgoa6vTaukZpuHjVSHD70eDs3GSNcIYQZw
8
+ 83OS6pwq11UZ7TAJk/poovo7B224+K1Nqxl/RUCqlBPLuWGchtuPUSn3W/HTWN39
9
+ SMry/gVXWWkQ2O0rIBFGy6HyhV+SVJ1gkOIoei/P+4CNDl/9g7xdRlQSCycwQuaL
10
+ fm7Jf6VFnrp3WHIK2zd4++5/RyRYCt4ngOmzXzbR8/czsaf64A9cEKTSlw7OV1Y=
11
+ =r1UX
12
12
  -----END PGP SIGNATURE-----
data/NEWS CHANGED
@@ -1,3 +1,17 @@
1
+ Release 4.0.10
2
+ --------------
3
+
4
+ * Fixed a crash in PassengerWatchdog which occurs on some OS X systems.
5
+ * Fixed exception reporting to Union Station.
6
+ * Improved documentation.
7
+
8
+
9
+ Release 4.0.9
10
+ -------------
11
+
12
+ * [Enterprise] Fixed a problem with passenger-irb.
13
+
14
+
1
15
  Release 4.0.8
2
16
  -------------
3
17
 
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
- # Introduction
1
+ # Phusion Passenger: a fast and robust web server and application server for Ruby, Python and Node.js
2
+
3
+ [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.
2
4
 
3
5
  This is the [Phusion Passenger web application server](https://www.phusionpassenger.com/).
4
6
 
@@ -21,6 +21,10 @@ function run()
21
21
  "$@"
22
22
  }
23
23
 
24
+ run uname -a
25
+ run lsb_release -a
26
+ sudo tee /etc/dpkg/dpkg.cfg.d/02apt-speedup >/dev/null <<<"force-unsafe-io"
27
+
24
28
  if [[ "$TEST_RUBY_VERSION" != "" ]]; then
25
29
  echo "$ rvm use $TEST_RUBY_VERSION"
26
30
  if [[ -f ~/.rvm/scripts/rvm ]]; then
@@ -58,6 +62,7 @@ if [[ "$TEST_NGINX" = 1 ]]; then
58
62
  fi
59
63
 
60
64
  if [[ "$TEST_APACHE2" = 1 ]]; then
65
+ run sudo apt-get update
61
66
  run sudo apt-get install -y --no-install-recommends \
62
67
  apache2-mpm-worker apache2-threaded-dev
63
68
  run rake test:install_deps RAILS_BUNDLES=no DOCTOOLS=no
@@ -67,6 +72,7 @@ if [[ "$TEST_APACHE2" = 1 ]]; then
67
72
  fi
68
73
 
69
74
  if [[ "$TEST_DEBIAN_PACKAGING" = 1 ]]; then
75
+ run sudo apt-get update
70
76
  run sudo apt-get install -y --no-install-recommends \
71
77
  devscripts debhelper rake apache2-mpm-worker apache2-threaded-dev \
72
78
  ruby1.8 ruby1.8-dev ruby1.9.1 ruby1.9.1-dev libev-dev gdebi-core \
@@ -1283,6 +1283,7 @@ using the command line.</p></div>
1283
1283
  <div class="foo toclevel2"><a href="#about_environment_variables">14. Appendix D: About environment variables</a></div>
1284
1284
  <div class="foo toclevel3"><a href="#_working_with_environment_variables">14.1. Working with environment variables</a></div>
1285
1285
  <div class="foo toclevel3"><a href="#_the_path_environment_variable">14.2. The PATH environment variable</a></div>
1286
+ <div class="foo toclevel4"><a href="#_adding_phusion_passenger_8217_s_administration_tools_to_path">14.2.1. Adding Phusion Passenger’s administration tools to PATH</a></div>
1286
1287
  <div class="foo toclevel3"><a href="#_making_environment_variables_permanent">14.3. Making environment variables permanent</a></div>
1287
1288
  <div class="foo toclevel4"><a href="#_bash">14.3.1. bash</a></div>
1288
1289
  <div class="foo toclevel4"><a href="#_apache">14.3.2. Apache</a></div>
@@ -7078,6 +7079,75 @@ user@localhost bash$ frobnicator
7078
7079
  <span style="font-style: italic"><span style="color: #9A1900"># =&gt; success!</span></span></tt></pre>
7079
7080
  </div>
7080
7081
  </div>
7082
+ <div class="sect3">
7083
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_adding_phusion_passenger_8217_s_administration_tools_to_path"></span><h4 data-comment-topic="adding-phusion-passenger-s-administration-tools-to-path-xwppud" data-anchor="_adding_phusion_passenger_8217_s_administration_tools_to_path">14.2.1. Adding Phusion Passenger’s administration tools to PATH</h4>
7084
+ <div class="paragraph"><p>If you get a "command not found" error when invoking one of the Phusion Passenger administration tools (e.g. <span class="monospaced">passenger-status</span> or <span class="monospaced">passenger-memory-stats</span> then that means the tools are not in <span class="monospaced">PATH</span>, so you need to add them.</p></div>
7085
+ <div class="ulist"><ul>
7086
+ <li>
7087
+ <p>
7088
+ If you <a href="#rubygems_generic_install">installed Phusion Passenger with RubyGems</a>, then the tools are in your RubyGems executable path. You can view the gem path using the command <span class="monospaced">gem env</span>:
7089
+ </p>
7090
+ <div class="listingblock">
7091
+ <div class="content monospaced">
7092
+ <pre>$ gem env
7093
+ RubyGems Environment:
7094
+ - RUBYGEMS VERSION: 1.8.15
7095
+ - RUBY VERSION: 1.8.7 (2011-12-28 patchlevel 357) [i686-darwin10.8.0]
7096
+ - INSTALLATION DIRECTORY: /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8
7097
+ - RUBY EXECUTABLE: /opt/ruby-enterprise-1.8.7-2010.01/bin/ruby
7098
+ - EXECUTABLE DIRECTORY: /opt/ruby-enterprise-1.8.7-2010.01/bin &lt;--------- !!
7099
+ - RUBYGEMS PLATFORMS:
7100
+ - ruby
7101
+ - x86-darwin-10
7102
+ - GEM PATHS:
7103
+ - /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8
7104
+ - /Users/hongli/.gem/ruby/1.8
7105
+ - GEM CONFIGURATION:
7106
+ - :update_sources =&gt; true
7107
+ - :verbose =&gt; true
7108
+ - :benchmark =&gt; false
7109
+ - :backtrace =&gt; false
7110
+ - :bulk_threshold =&gt; 1000
7111
+ - "gem" =&gt; "--no-ri --no-rdoc"
7112
+ - REMOTE SOURCES:
7113
+ - http://rubygems.org/</pre>
7114
+ </div>
7115
+ </div>
7116
+ <div class="paragraph"><p>As you can see, the RubyGems executable path in the example happens to be <span class="monospaced">/opt/ruby-enterprise-1.8.7-2010.01/bin</span>. So that directory must be added to <span class="monospaced">PATH</span>.</p></div>
7117
+ </li>
7118
+ <li>
7119
+ <p>
7120
+ If you <a href="#tarball_generic_install">installed Phusion Passenger using the tarball</a>, then the tools are in the <span class="monospaced">bin</span> subdirectory of the Phusion Passenger tarball directory that you extracted. For example, if you extracted <span class="monospaced">passenger-4.9.0.tar.gz</span> inside <span class="monospaced">/opt</span>, then the tools are located in <span class="monospaced">/opt/passenger-4.0.9/bin</span>. In that case, you need to add <span class="monospaced">/opt/passenger-4.0.9/bin</span> to your <span class="monospaced">PATH</span>.
7121
+ </p>
7122
+ </li>
7123
+ <li>
7124
+ <p>
7125
+ If you installed Phusion Passenger using native OS packages, then some Phusion Passenger administration tools are in <span class="monospaced">/usr/bin</span>, while others are in <span class="monospaced">/usr/sbin</span>. If you are not logged in as root, then <span class="monospaced">/usr/sbin</span> may not be in <span class="monospaced">PATH</span>, which would explain why you get a "command not found" when trying to invoke some of the tools. You should <span class="monospaced">/usr/sbin</span> to <span class="monospaced">PATH</span>.
7126
+ </p>
7127
+ </li>
7128
+ <li>
7129
+ <p>
7130
+ If you are unsure where your Phusion Passenger directory is then you can use the <span class="monospaced">find</span> command to look them up. Go to the root directory and invoke <span class="monospaced">find</span> with <span class="monospaced">sudo</span>:
7131
+ </p>
7132
+ <div class="listingblock">
7133
+ <div class="content monospaced">
7134
+ <pre>$ cd /
7135
+ $ sudo find . -name passenger-status
7136
+ /usr/local/passenger/bin/passenger-status</pre>
7137
+ </div>
7138
+ </div>
7139
+ <div class="paragraph"><p>In this example, the administration tools happen to be in <span class="monospaced">/usr/local/passenger/bin</span>, so you must add that to <span class="monospaced">PATH</span>.</p></div>
7140
+ </li>
7141
+ </ul></div>
7142
+ <div class="admonitionblock">
7143
+ <table><tr>
7144
+ <td class="icon">
7145
+ <img src="./images/icons/note.png" alt="Note">
7146
+ </td>
7147
+ <td class="content">You may still get a "command not found" when invoking the tools through sudo, even after you’ve added the relevant directory to <span class="monospaced">PATH</span>. Please read <a href="#env_vars_and_sudo">Environment variables and sudo</a> to learn more.</td>
7148
+ </tr></table>
7149
+ </div>
7150
+ </div>
7081
7151
  </div>
7082
7152
  <div class="sect2">
7083
7153
  <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_making_environment_variables_permanent"></span><h3 data-comment-topic="making-environment-variables-permanent-13x0l4h" data-anchor="_making_environment_variables_permanent">14.3. Making environment variables permanent</h3>
@@ -370,6 +370,8 @@
370
370
 
371
371
  14.2. The PATH environment variable => the-path-environment-variable-p8e32r
372
372
 
373
+ 14.2.1. Adding Phusion Passenger’s administration tools to PATH => adding-phusion-passenger-s-administration-tools-to-path-xwppud
374
+
373
375
  14.3. Making environment variables permanent => making-environment-variables-permanent-13x0l4h
374
376
 
375
377
  14.3.1. bash => bash-1pktn63
@@ -1253,6 +1253,7 @@ using the command line.</p></div>
1253
1253
  <div class="foo toclevel2"><a href="#about_environment_variables">13. Appendix D: About environment variables</a></div>
1254
1254
  <div class="foo toclevel3"><a href="#_working_with_environment_variables">13.1. Working with environment variables</a></div>
1255
1255
  <div class="foo toclevel3"><a href="#_the_path_environment_variable">13.2. The PATH environment variable</a></div>
1256
+ <div class="foo toclevel4"><a href="#_adding_phusion_passenger_8217_s_administration_tools_to_path">13.2.1. Adding Phusion Passenger’s administration tools to PATH</a></div>
1256
1257
  <div class="foo toclevel3"><a href="#_making_environment_variables_permanent">13.3. Making environment variables permanent</a></div>
1257
1258
  <div class="foo toclevel4"><a href="#_bash">13.3.1. bash</a></div>
1258
1259
  <div class="foo toclevel4"><a href="#_apache">13.3.2. Apache</a></div>
@@ -6187,6 +6188,75 @@ user@localhost bash$ frobnicator
6187
6188
  <span style="font-style: italic"><span style="color: #9A1900"># =&gt; success!</span></span></tt></pre>
6188
6189
  </div>
6189
6190
  </div>
6191
+ <div class="sect3">
6192
+ <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_adding_phusion_passenger_8217_s_administration_tools_to_path"></span><h4 data-comment-topic="adding-phusion-passenger-s-administration-tools-to-path-1flz2tu" data-anchor="_adding_phusion_passenger_8217_s_administration_tools_to_path">13.2.1. Adding Phusion Passenger’s administration tools to PATH</h4>
6193
+ <div class="paragraph"><p>If you get a "command not found" error when invoking one of the Phusion Passenger administration tools (e.g. <span class="monospaced">passenger-status</span> or <span class="monospaced">passenger-memory-stats</span> then that means the tools are not in <span class="monospaced">PATH</span>, so you need to add them.</p></div>
6194
+ <div class="ulist"><ul>
6195
+ <li>
6196
+ <p>
6197
+ If you <a href="#rubygems_generic_install">installed Phusion Passenger with RubyGems</a>, then the tools are in your RubyGems executable path. You can view the gem path using the command <span class="monospaced">gem env</span>:
6198
+ </p>
6199
+ <div class="listingblock">
6200
+ <div class="content monospaced">
6201
+ <pre>$ gem env
6202
+ RubyGems Environment:
6203
+ - RUBYGEMS VERSION: 1.8.15
6204
+ - RUBY VERSION: 1.8.7 (2011-12-28 patchlevel 357) [i686-darwin10.8.0]
6205
+ - INSTALLATION DIRECTORY: /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8
6206
+ - RUBY EXECUTABLE: /opt/ruby-enterprise-1.8.7-2010.01/bin/ruby
6207
+ - EXECUTABLE DIRECTORY: /opt/ruby-enterprise-1.8.7-2010.01/bin &lt;--------- !!
6208
+ - RUBYGEMS PLATFORMS:
6209
+ - ruby
6210
+ - x86-darwin-10
6211
+ - GEM PATHS:
6212
+ - /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8
6213
+ - /Users/hongli/.gem/ruby/1.8
6214
+ - GEM CONFIGURATION:
6215
+ - :update_sources =&gt; true
6216
+ - :verbose =&gt; true
6217
+ - :benchmark =&gt; false
6218
+ - :backtrace =&gt; false
6219
+ - :bulk_threshold =&gt; 1000
6220
+ - "gem" =&gt; "--no-ri --no-rdoc"
6221
+ - REMOTE SOURCES:
6222
+ - http://rubygems.org/</pre>
6223
+ </div>
6224
+ </div>
6225
+ <div class="paragraph"><p>As you can see, the RubyGems executable path in the example happens to be <span class="monospaced">/opt/ruby-enterprise-1.8.7-2010.01/bin</span>. So that directory must be added to <span class="monospaced">PATH</span>.</p></div>
6226
+ </li>
6227
+ <li>
6228
+ <p>
6229
+ If you <a href="#tarball_generic_install">installed Phusion Passenger using the tarball</a>, then the tools are in the <span class="monospaced">bin</span> subdirectory of the Phusion Passenger tarball directory that you extracted. For example, if you extracted <span class="monospaced">passenger-4.9.0.tar.gz</span> inside <span class="monospaced">/opt</span>, then the tools are located in <span class="monospaced">/opt/passenger-4.0.9/bin</span>. In that case, you need to add <span class="monospaced">/opt/passenger-4.0.9/bin</span> to your <span class="monospaced">PATH</span>.
6230
+ </p>
6231
+ </li>
6232
+ <li>
6233
+ <p>
6234
+ If you installed Phusion Passenger using native OS packages, then some Phusion Passenger administration tools are in <span class="monospaced">/usr/bin</span>, while others are in <span class="monospaced">/usr/sbin</span>. If you are not logged in as root, then <span class="monospaced">/usr/sbin</span> may not be in <span class="monospaced">PATH</span>, which would explain why you get a "command not found" when trying to invoke some of the tools. You should <span class="monospaced">/usr/sbin</span> to <span class="monospaced">PATH</span>.
6235
+ </p>
6236
+ </li>
6237
+ <li>
6238
+ <p>
6239
+ If you are unsure where your Phusion Passenger directory is then you can use the <span class="monospaced">find</span> command to look them up. Go to the root directory and invoke <span class="monospaced">find</span> with <span class="monospaced">sudo</span>:
6240
+ </p>
6241
+ <div class="listingblock">
6242
+ <div class="content monospaced">
6243
+ <pre>$ cd /
6244
+ $ sudo find . -name passenger-status
6245
+ /usr/local/passenger/bin/passenger-status</pre>
6246
+ </div>
6247
+ </div>
6248
+ <div class="paragraph"><p>In this example, the administration tools happen to be in <span class="monospaced">/usr/local/passenger/bin</span>, so you must add that to <span class="monospaced">PATH</span>.</p></div>
6249
+ </li>
6250
+ </ul></div>
6251
+ <div class="admonitionblock">
6252
+ <table><tr>
6253
+ <td class="icon">
6254
+ <img src="./images/icons/note.png" alt="Note">
6255
+ </td>
6256
+ <td class="content">You may still get a "command not found" when invoking the tools through sudo, even after you’ve added the relevant directory to <span class="monospaced">PATH</span>. Please read <a href="#env_vars_and_sudo">Environment variables and sudo</a> to learn more.</td>
6257
+ </tr></table>
6258
+ </div>
6259
+ </div>
6190
6260
  </div>
6191
6261
  <div class="sect2">
6192
6262
  <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_making_environment_variables_permanent"></span><h3 data-comment-topic="making-environment-variables-permanent-1wjyhzt" data-anchor="_making_environment_variables_permanent">13.3. Making environment variables permanent</h3>
@@ -310,6 +310,8 @@
310
310
 
311
311
  13.2. The PATH environment variable => the-path-environment-variable-vlp05e
312
312
 
313
+ 13.2.1. Adding Phusion Passenger’s administration tools to PATH => adding-phusion-passenger-s-administration-tools-to-path-1flz2tu
314
+
313
315
  13.3. Making environment variables permanent => making-environment-variables-permanent-1wjyhzt
314
316
 
315
317
  13.3.1. bash => bash-19xsxec
@@ -107,6 +107,53 @@ user@localhost bash$ frobnicator
107
107
  # => success!
108
108
  ----------------------
109
109
 
110
+ ==== Adding Phusion Passenger's administration tools to PATH
111
+
112
+ 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.
113
+
114
+ * If you <<rubygems_generic_install,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`:
115
+ +
116
+ ------------------------------
117
+ $ gem env
118
+ RubyGems Environment:
119
+ - RUBYGEMS VERSION: 1.8.15
120
+ - RUBY VERSION: 1.8.7 (2011-12-28 patchlevel 357) [i686-darwin10.8.0]
121
+ - INSTALLATION DIRECTORY: /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8
122
+ - RUBY EXECUTABLE: /opt/ruby-enterprise-1.8.7-2010.01/bin/ruby
123
+ - EXECUTABLE DIRECTORY: /opt/ruby-enterprise-1.8.7-2010.01/bin <--------- !!
124
+ - RUBYGEMS PLATFORMS:
125
+ - ruby
126
+ - x86-darwin-10
127
+ - GEM PATHS:
128
+ - /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8
129
+ - /Users/hongli/.gem/ruby/1.8
130
+ - GEM CONFIGURATION:
131
+ - :update_sources => true
132
+ - :verbose => true
133
+ - :benchmark => false
134
+ - :backtrace => false
135
+ - :bulk_threshold => 1000
136
+ - "gem" => "--no-ri --no-rdoc"
137
+ - REMOTE SOURCES:
138
+ - http://rubygems.org/
139
+ ------------------------------
140
+ +
141
+ 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`.
142
+
143
+ * If you <<tarball_generic_install,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`.
144
+ * 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`.
145
+ * 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`:
146
+ +
147
+ --------------------------------
148
+ $ cd /
149
+ $ sudo find . -name passenger-status
150
+ /usr/local/passenger/bin/passenger-status
151
+ --------------------------------
152
+ +
153
+ In this example, the administration tools happen to be in `/usr/local/passenger/bin`, so you must add that to `PATH`.
154
+
155
+ 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 <<env_vars_and_sudo,Environment variables and sudo>> to learn more.
156
+
110
157
  === Making environment variables permanent
111
158
 
112
159
  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.
@@ -70,7 +70,7 @@
70
70
 
71
71
  #define PROCESS_SHUTDOWN_TIMEOUT_DISPLAY "1 minute"
72
72
 
73
- #define PASSENGER_VERSION "4.0.8"
73
+ #define PASSENGER_VERSION "4.0.10"
74
74
 
75
75
  #define SERVER_INSTANCE_DIR_STRUCTURE_MAJOR_VERSION 1
76
76
 
@@ -587,6 +587,7 @@ int
587
587
  main(int argc, char *argv[]) {
588
588
  TRACE_POINT();
589
589
  AgentOptions options(initializeAgent(argc, argv, "PassengerHelperAgent"));
590
+ P_DEBUG("Starting PassengerHelperAgent...");
590
591
  MultiLibeio::init();
591
592
 
592
593
  try {
@@ -93,6 +93,9 @@ private:
93
93
 
94
94
  /** Last time data was actually written to the underlying storage device. */
95
95
  ev_tstamp lastFlushed;
96
+
97
+ /** The amount of data that has been written to this sink so far. */
98
+ unsigned int writtenTo;
96
99
 
97
100
  /**
98
101
  * This LogSink's iterator inside LoggingServer.logSinkCache.
@@ -110,6 +113,7 @@ private:
110
113
  opened = 0;
111
114
  lastUsed = ev_now(server->getLoop());
112
115
  lastFlushed = lastUsed;
116
+ writtenTo = 0;
113
117
  }
114
118
 
115
119
  virtual ~LogSink() {
@@ -127,7 +131,10 @@ private:
127
131
  }
128
132
 
129
133
  virtual void append(const DataStoreId &dataStoreId,
130
- const StaticString &data) = 0;
134
+ const StaticString &data)
135
+ {
136
+ writtenTo += data.size();
137
+ }
131
138
 
132
139
  virtual bool flush() {
133
140
  lastFlushed = ev_now(server->getLoop());
@@ -163,6 +170,7 @@ private:
163
170
  }
164
171
 
165
172
  virtual void append(const DataStoreId &dataStoreId, const StaticString &data) {
173
+ LogSink::append(dataStoreId, data);
166
174
  syscalls::write(fd, data.data(), data.size());
167
175
  }
168
176
 
@@ -171,6 +179,7 @@ private:
171
179
  stream << " Opened : " << opened << "\n";
172
180
  stream << " LastUsed : " << distanceOfTimeInWords((time_t) lastUsed) << " ago\n";
173
181
  stream << " LastFlushed: " << distanceOfTimeInWords((time_t) lastFlushed) << " ago\n";
182
+ stream << " WrittenTo : " << writtenTo << "\n";
174
183
  }
175
184
  };
176
185
 
@@ -223,6 +232,7 @@ private:
223
232
  }
224
233
 
225
234
  virtual void append(const DataStoreId &dataStoreId, const StaticString &data) {
235
+ LogSink::append(dataStoreId, data);
226
236
  if (bufferSize + data.size() > BUFFER_CAPACITY) {
227
237
  StaticString data2[2];
228
238
  data2[0] = StaticString(buffer, bufferSize);
@@ -265,6 +275,7 @@ private:
265
275
  stream << " Opened : " << opened << "\n";
266
276
  stream << " LastUsed : " << distanceOfTimeInWords((time_t) lastUsed) << " ago\n";
267
277
  stream << " LastFlushed: " << distanceOfTimeInWords((time_t) lastFlushed) << " ago\n";
278
+ stream << " WrittenTo : " << writtenTo << "\n";
268
279
  stream << " BufferSize : " << bufferSize << "\n";
269
280
  }
270
281
  };
@@ -106,15 +106,15 @@ private:
106
106
  boost::lock_guard<boost::mutex> l(lock);
107
107
  threadExceptionMessage = e.what();
108
108
  threadExceptionBacktrace = e.backtrace();
109
- errorEvent->notify();
109
+ wo->errorEvent.notify();
110
110
  } catch (const std::exception &e) {
111
111
  boost::lock_guard<boost::mutex> l(lock);
112
112
  threadExceptionMessage = e.what();
113
- errorEvent->notify();
113
+ wo->errorEvent.notify();
114
114
  } catch (...) {
115
115
  boost::lock_guard<boost::mutex> l(lock);
116
116
  threadExceptionMessage = "Unknown error";
117
- errorEvent->notify();
117
+ wo->errorEvent.notify();
118
118
  }
119
119
  }
120
120
 
@@ -137,6 +137,8 @@ protected:
137
137
  * the watcher thread.
138
138
  */
139
139
  mutable boost::mutex lock;
140
+
141
+ WorkingObjectsPtr wo;
140
142
 
141
143
  /**
142
144
  * Returns the filename of the agent process's executable. This method may be
@@ -217,9 +219,10 @@ protected:
217
219
  }
218
220
 
219
221
  public:
220
- AgentWatcher() {
222
+ AgentWatcher(const WorkingObjectsPtr &wo) {
221
223
  thr = NULL;
222
224
  pid = 0;
225
+ this->wo = wo;
223
226
  }
224
227
 
225
228
  virtual ~AgentWatcher() {
@@ -424,7 +427,7 @@ public:
424
427
  }
425
428
 
426
429
  /**
427
- * Start watching the agent process.
430
+ * Begin watching the agent process.
428
431
  *
429
432
  * @pre start() has been called and succeeded.
430
433
  * @pre This watcher isn't already watching.
@@ -432,7 +435,7 @@ public:
432
435
  * @throws thread_interrupted
433
436
  * @throws thread_resource_error
434
437
  */
435
- virtual void startWatching() {
438
+ virtual void beginWatching() {
436
439
  boost::lock_guard<boost::mutex> l(lock);
437
440
  if (pid == 0) {
438
441
  throw RuntimeException("start() hasn't been called yet");
@@ -64,27 +64,29 @@ protected:
64
64
  }
65
65
 
66
66
  public:
67
- HelperAgentWatcher(const ResourceLocator &resourceLocator) {
68
- helperAgentFilename = resourceLocator.getAgentsDir() + "/PassengerHelperAgent";
67
+ HelperAgentWatcher(const WorkingObjectsPtr &wo)
68
+ : AgentWatcher(wo)
69
+ {
70
+ helperAgentFilename = wo->resourceLocator->getAgentsDir() + "/PassengerHelperAgent";
69
71
 
70
72
  report
71
73
  .set("request_socket_filename",
72
74
  agentsOptions.get("request_socket_filename", false,
73
- generation->getPath() + "/request"))
75
+ wo->generation->getPath() + "/request"))
74
76
  .set("request_socket_password",
75
77
  agentsOptions.get("request_socket_password", false,
76
- randomGenerator->generateAsciiString(REQUEST_SOCKET_PASSWORD_SIZE)))
78
+ wo->randomGenerator.generateAsciiString(REQUEST_SOCKET_PASSWORD_SIZE)))
77
79
  .set("helper_agent_admin_socket_address",
78
80
  agentsOptions.get("helper_agent_admin_socket_address", false,
79
- "unix:" + generation->getPath() + "/helper_admin"))
81
+ "unix:" + wo->generation->getPath() + "/helper_admin"))
80
82
  .set("helper_agent_exit_password",
81
83
  agentsOptions.get("helper_agent_exit_password", false,
82
- randomGenerator->generateAsciiString(MESSAGE_SERVER_MAX_PASSWORD_SIZE)));
84
+ wo->randomGenerator.generateAsciiString(MESSAGE_SERVER_MAX_PASSWORD_SIZE)));
83
85
 
84
86
  params = report;
85
87
  params
86
- .set("logging_agent_address", loggingAgentAddress)
87
- .set("logging_agent_password", loggingAgentPassword);
88
+ .set("logging_agent_address", wo->loggingAgentAddress)
89
+ .set("logging_agent_password", wo->loggingAgentPassword);
88
90
  }
89
91
 
90
92
  virtual void reportAgentsInformation(VariantMap &report) {
@@ -42,9 +42,9 @@ protected:
42
42
 
43
43
  virtual void sendStartupArguments(pid_t pid, FileDescriptor &fd) {
44
44
  VariantMap options = agentsOptions;
45
- options.set("logging_agent_address", loggingAgentAddress);
46
- options.set("logging_agent_password", loggingAgentPassword);
47
- options.set("logging_agent_admin_address", loggingAgentAdminAddress);
45
+ options.set("logging_agent_address", wo->loggingAgentAddress);
46
+ options.set("logging_agent_password", wo->loggingAgentPassword);
47
+ options.set("logging_agent_admin_address", wo->loggingAgentAdminAddress);
48
48
  options.writeToFd(fd);
49
49
  }
50
50
 
@@ -57,14 +57,16 @@ protected:
57
57
  }
58
58
 
59
59
  public:
60
- LoggingAgentWatcher(const ResourceLocator &resourceLocator) {
61
- agentFilename = resourceLocator.getAgentsDir() + "/PassengerLoggingAgent";
60
+ LoggingAgentWatcher(const WorkingObjectsPtr &wo)
61
+ : AgentWatcher(wo)
62
+ {
63
+ agentFilename = wo->resourceLocator->getAgentsDir() + "/PassengerLoggingAgent";
62
64
  }
63
65
 
64
66
  virtual void reportAgentsInformation(VariantMap &report) {
65
67
  report
66
- .set("logging_socket_address", loggingAgentAddress)
67
- .set("logging_socket_password", loggingAgentPassword)
68
- .set("logging_socket_admin_address", loggingAgentAdminAddress);
68
+ .set("logging_socket_address", wo->loggingAgentAddress)
69
+ .set("logging_socket_password", wo->loggingAgentPassword)
70
+ .set("logging_socket_admin_address", wo->loggingAgentAdminAddress);
69
71
  }
70
72
  };
@@ -72,11 +72,13 @@ enum OomFileType {
72
72
  #define REQUEST_SOCKET_PASSWORD_SIZE 64
73
73
 
74
74
  class ServerInstanceDirToucher;
75
+ class AgentWatcher;
75
76
  static bool hasEnvOption(const char *name, bool defaultValue = false);
76
77
  static void setOomScore(const StaticString &score);
77
78
 
78
79
 
79
- /** The options that were passed to AgentsStarter. */
80
+ /***** Agent options *****/
81
+
80
82
  static VariantMap agentsOptions;
81
83
  static string tempDir;
82
84
  static bool userSwitching;
@@ -84,31 +86,36 @@ static string defaultUser;
84
86
  static string defaultGroup;
85
87
  static uid_t webServerWorkerUid;
86
88
  static gid_t webServerWorkerGid;
87
- static string serializedPrestartURLs;
88
89
 
89
90
  /***** Working objects *****/
91
+
92
+ struct WorkingObjects {
93
+ RandomGenerator randomGenerator;
94
+ EventFd errorEvent;
95
+ ResourceLocatorPtr resourceLocator;
96
+ ServerInstanceDirPtr serverInstanceDir;
97
+ ServerInstanceDir::GenerationPtr generation;
98
+ uid_t defaultUid;
99
+ gid_t defaultGid;
100
+ string loggingAgentAddress;
101
+ string loggingAgentPassword;
102
+ string loggingAgentAdminAddress;
103
+ string adminToolStatusPassword;
104
+ string adminToolManipulationPassword;
105
+ };
106
+
107
+ typedef shared_ptr<WorkingObjects> WorkingObjectsPtr;
108
+
90
109
  static string oldOomScore;
91
- static RandomGenerator *randomGenerator;
92
- static EventFd *errorEvent;
93
- static ResourceLocator *resourceLocator;
94
- static ServerInstanceDirPtr serverInstanceDir;
95
- static ServerInstanceDir::GenerationPtr generation;
96
- static ServerInstanceDirToucher *serverInstanceDirToucher;
97
- static uid_t defaultUid;
98
- static gid_t defaultGid;
99
- static string loggingAgentAddress;
100
- static string loggingAgentPassword;
101
- static string loggingAgentAdminAddress;
102
- static string adminToolStatusPassword;
103
- static string adminToolManipulationPassword;
104
110
 
105
111
  #include "AgentWatcher.cpp"
112
+ #include "ServerInstanceDirToucher.cpp"
106
113
  #include "HelperAgentWatcher.cpp"
107
114
  #include "LoggingAgentWatcher.cpp"
108
- #include "ServerInstanceDirToucher.cpp"
109
- static vector<AgentWatcherPtr> watchers;
110
115
 
111
116
 
117
+ /***** Functions *****/
118
+
112
119
  static bool
113
120
  hasEnvOption(const char *name, bool defaultValue) {
114
121
  const char *value = getenv(name);
@@ -218,19 +225,19 @@ setOomScoreNeverKill() {
218
225
  * an error.
219
226
  */
220
227
  static bool
221
- waitForStarterProcessOrWatchers(vector<AgentWatcherPtr> &watchers) {
228
+ waitForStarterProcessOrWatchers(const WorkingObjectsPtr &wo, vector<AgentWatcherPtr> &watchers) {
222
229
  fd_set fds;
223
230
  int max, ret;
224
231
  char x;
225
232
 
226
233
  FD_ZERO(&fds);
227
234
  FD_SET(FEEDBACK_FD, &fds);
228
- FD_SET(errorEvent->fd(), &fds);
235
+ FD_SET(wo->errorEvent.fd(), &fds);
229
236
 
230
- if (FEEDBACK_FD > errorEvent->fd()) {
237
+ if (FEEDBACK_FD > wo->errorEvent.fd()) {
231
238
  max = FEEDBACK_FD;
232
239
  } else {
233
- max = errorEvent->fd();
240
+ max = wo->errorEvent.fd();
234
241
  }
235
242
 
236
243
  ret = syscalls::select(max + 1, &fds, NULL, NULL, NULL);
@@ -240,7 +247,7 @@ waitForStarterProcessOrWatchers(vector<AgentWatcherPtr> &watchers) {
240
247
  return false;
241
248
  }
242
249
 
243
- if (FD_ISSET(errorEvent->fd(), &fds)) {
250
+ if (FD_ISSET(wo->errorEvent.fd(), &fds)) {
244
251
  vector<AgentWatcherPtr>::const_iterator it;
245
252
  string message, backtrace, watcherName;
246
253
 
@@ -264,7 +271,7 @@ waitForStarterProcessOrWatchers(vector<AgentWatcherPtr> &watchers) {
264
271
  }
265
272
 
266
273
  static void
267
- cleanupAgentsInBackground(vector<AgentWatcherPtr> &watchers, char *argv[]) {
274
+ cleanupAgentsInBackground(const WorkingObjectsPtr &wo, vector<AgentWatcherPtr> &watchers, char *argv[]) {
268
275
  this_thread::disable_interruption di;
269
276
  this_thread::disable_syscall_interruption dsi;
270
277
  pid_t pid;
@@ -335,8 +342,8 @@ cleanupAgentsInBackground(vector<AgentWatcherPtr> &watchers, char *argv[]) {
335
342
  }
336
343
 
337
344
  // Now clean up the server instance directory.
338
- delete generation.get();
339
- delete serverInstanceDir.get();
345
+ delete wo->generation.get();
346
+ delete wo->serverInstanceDir.get();
340
347
 
341
348
  _exit(0);
342
349
 
@@ -349,8 +356,8 @@ cleanupAgentsInBackground(vector<AgentWatcherPtr> &watchers, char *argv[]) {
349
356
  // Parent
350
357
 
351
358
  // Let child process handle cleanup.
352
- serverInstanceDir->detach();
353
- generation->detach();
359
+ wo->serverInstanceDir->detach();
360
+ wo->generation->detach();
354
361
  }
355
362
  }
356
363
 
@@ -481,11 +488,10 @@ lookupDefaultUidGid(uid_t &uid, gid_t &gid) {
481
488
  }
482
489
 
483
490
  static void
484
- initializeWorkingObjects() {
491
+ initializeWorkingObjects(WorkingObjectsPtr &wo, ServerInstanceDirToucherPtr &serverInstanceDirToucher) {
485
492
  TRACE_POINT();
486
- randomGenerator = new RandomGenerator();
487
- errorEvent = new EventFd();
488
- resourceLocator = new ResourceLocator(agentsOptions.get("passenger_root"));
493
+ wo = make_shared<WorkingObjects>();
494
+ wo->resourceLocator = make_shared<ResourceLocator>(agentsOptions.get("passenger_root"));
489
495
 
490
496
  UPDATE_TRACE_POINT();
491
497
  // Must not used make_shared() here because Watchdog.cpp
@@ -501,54 +507,54 @@ initializeWorkingObjects() {
501
507
  toString(SERVER_INSTANCE_DIR_STRUCTURE_MAJOR_VERSION) + "." +
502
508
  toString(SERVER_INSTANCE_DIR_STRUCTURE_MINOR_VERSION) + "." +
503
509
  toString<unsigned long long>(agentsOptions.getPid("web_server_pid"));
504
- serverInstanceDir.reset(new ServerInstanceDir(path));
510
+ wo->serverInstanceDir.reset(new ServerInstanceDir(path));
505
511
  } else {
506
- serverInstanceDir.reset(new ServerInstanceDir(agentsOptions.get("server_instance_dir")));
507
- agentsOptions.set("server_instance_dir", serverInstanceDir->getPath());
512
+ wo->serverInstanceDir.reset(new ServerInstanceDir(agentsOptions.get("server_instance_dir")));
513
+ agentsOptions.set("server_instance_dir", wo->serverInstanceDir->getPath());
508
514
  }
509
- generation = serverInstanceDir->newGeneration(userSwitching, defaultUser,
515
+ wo->generation = wo->serverInstanceDir->newGeneration(userSwitching, defaultUser,
510
516
  defaultGroup, webServerWorkerUid, webServerWorkerGid);
511
- agentsOptions.set("server_instance_dir", serverInstanceDir->getPath());
512
- agentsOptions.setInt("generation_number", generation->getNumber());
517
+ agentsOptions.set("server_instance_dir", wo->serverInstanceDir->getPath());
518
+ agentsOptions.setInt("generation_number", wo->generation->getNumber());
513
519
 
514
520
  UPDATE_TRACE_POINT();
515
- serverInstanceDirToucher = new ServerInstanceDirToucher();
521
+ serverInstanceDirToucher = make_shared<ServerInstanceDirToucher>(wo);
516
522
 
517
523
  UPDATE_TRACE_POINT();
518
- lookupDefaultUidGid(defaultUid, defaultGid);
524
+ lookupDefaultUidGid(wo->defaultUid, wo->defaultGid);
519
525
 
520
526
  UPDATE_TRACE_POINT();
521
- loggingAgentAddress = "unix:" + generation->getPath() + "/logging";
522
- loggingAgentPassword = randomGenerator->generateAsciiString(64);
523
- loggingAgentAdminAddress = "unix:" + generation->getPath() + "/logging_admin";
527
+ wo->loggingAgentAddress = "unix:" + wo->generation->getPath() + "/logging";
528
+ wo->loggingAgentPassword = wo->randomGenerator.generateAsciiString(64);
529
+ wo->loggingAgentAdminAddress = "unix:" + wo->generation->getPath() + "/logging_admin";
524
530
 
525
531
  UPDATE_TRACE_POINT();
526
- adminToolStatusPassword = randomGenerator->generateAsciiString(MESSAGE_SERVER_MAX_PASSWORD_SIZE);
527
- adminToolManipulationPassword = randomGenerator->generateAsciiString(MESSAGE_SERVER_MAX_PASSWORD_SIZE);
528
- agentsOptions.set("admin_tool_status_password", adminToolStatusPassword);
529
- agentsOptions.set("admin_tool_manipulation_password", adminToolManipulationPassword);
532
+ wo->adminToolStatusPassword = wo->randomGenerator.generateAsciiString(MESSAGE_SERVER_MAX_PASSWORD_SIZE);
533
+ wo->adminToolManipulationPassword = wo->randomGenerator.generateAsciiString(MESSAGE_SERVER_MAX_PASSWORD_SIZE);
534
+ agentsOptions.set("admin_tool_status_password", wo->adminToolStatusPassword);
535
+ agentsOptions.set("admin_tool_manipulation_password", wo->adminToolManipulationPassword);
530
536
  if (geteuid() == 0 && !userSwitching) {
531
- createFile(generation->getPath() + "/passenger-status-password.txt",
532
- adminToolStatusPassword, S_IRUSR, defaultUid, defaultGid);
533
- createFile(generation->getPath() + "/admin-manipulation-password.txt",
534
- adminToolManipulationPassword, S_IRUSR, defaultUid, defaultGid);
537
+ createFile(wo->generation->getPath() + "/passenger-status-password.txt",
538
+ wo->adminToolStatusPassword, S_IRUSR, wo->defaultUid, wo->defaultGid);
539
+ createFile(wo->generation->getPath() + "/admin-manipulation-password.txt",
540
+ wo->adminToolManipulationPassword, S_IRUSR, wo->defaultUid, wo->defaultGid);
535
541
  } else {
536
- createFile(generation->getPath() + "/passenger-status-password.txt",
537
- adminToolStatusPassword, S_IRUSR | S_IWUSR);
538
- createFile(generation->getPath() + "/admin-manipulation-password.txt",
539
- adminToolManipulationPassword, S_IRUSR | S_IWUSR);
542
+ createFile(wo->generation->getPath() + "/passenger-status-password.txt",
543
+ wo->adminToolStatusPassword, S_IRUSR | S_IWUSR);
544
+ createFile(wo->generation->getPath() + "/admin-manipulation-password.txt",
545
+ wo->adminToolManipulationPassword, S_IRUSR | S_IWUSR);
540
546
  }
541
547
  }
542
548
 
543
549
  static void
544
- initializeAgentWatchers() {
550
+ initializeAgentWatchers(const WorkingObjectsPtr &wo, vector<AgentWatcherPtr> &watchers) {
545
551
  TRACE_POINT();
546
- watchers.push_back(make_shared<HelperAgentWatcher>(*resourceLocator));
547
- watchers.push_back(make_shared<LoggingAgentWatcher>(*resourceLocator));
552
+ watchers.push_back(make_shared<HelperAgentWatcher>(wo));
553
+ watchers.push_back(make_shared<LoggingAgentWatcher>(wo));
548
554
  }
549
555
 
550
556
  static void
551
- startAgents() {
557
+ startAgents(const WorkingObjectsPtr &wo, vector<AgentWatcherPtr> &watchers) {
552
558
  TRACE_POINT();
553
559
  foreach (AgentWatcherPtr watcher, watchers) {
554
560
  try {
@@ -566,10 +572,10 @@ startAgents() {
566
572
  }
567
573
 
568
574
  static void
569
- startWatchingAgents() {
575
+ beginWatchingAgents(const WorkingObjectsPtr &wo, vector<AgentWatcherPtr> &watchers) {
570
576
  foreach (AgentWatcherPtr watcher, watchers) {
571
577
  try {
572
- watcher->startWatching();
578
+ watcher->beginWatching();
573
579
  } catch (const std::exception &e) {
574
580
  writeArrayMessage(FEEDBACK_FD,
575
581
  "Watchdog startup error",
@@ -583,13 +589,13 @@ startWatchingAgents() {
583
589
  }
584
590
 
585
591
  static void
586
- reportAgentsInformation() {
592
+ reportAgentsInformation(const WorkingObjectsPtr &wo, const vector<AgentWatcherPtr> &watchers) {
587
593
  TRACE_POINT();
588
594
  VariantMap report;
589
595
 
590
596
  report
591
- .set("server_instance_dir", serverInstanceDir->getPath())
592
- .setInt("generation", generation->getNumber());
597
+ .set("server_instance_dir", wo->serverInstanceDir->getPath())
598
+ .setInt("generation", wo->generation->getNumber());
593
599
 
594
600
  foreach (AgentWatcherPtr watcher, watchers) {
595
601
  watcher->reportAgentsInformation(report);
@@ -602,13 +608,16 @@ int
602
608
  main(int argc, char *argv[]) {
603
609
  initializeBareEssentials(argc, argv);
604
610
  P_DEBUG("Starting Watchdog...");
611
+ WorkingObjectsPtr wo;
612
+ ServerInstanceDirToucherPtr serverInstanceDirToucher;
613
+ vector<AgentWatcherPtr> watchers;
605
614
 
606
615
  try {
607
616
  TRACE_POINT();
608
617
  initializeOptions();
609
618
  maybeSetsid();
610
- initializeWorkingObjects();
611
- initializeAgentWatchers();
619
+ initializeWorkingObjects(wo, serverInstanceDirToucher);
620
+ initializeAgentWatchers(wo, watchers);
612
621
  } catch (const std::exception &e) {
613
622
  writeArrayMessage(FEEDBACK_FD,
614
623
  "Watchdog startup error",
@@ -620,15 +629,15 @@ main(int argc, char *argv[]) {
620
629
 
621
630
  try {
622
631
  TRACE_POINT();
623
- startAgents();
624
- startWatchingAgents();
625
- reportAgentsInformation();
632
+ startAgents(wo, watchers);
633
+ beginWatchingAgents(wo, watchers);
634
+ reportAgentsInformation(wo, watchers);
626
635
  P_INFO("All Phusion Passenger agents started!");
627
636
 
628
637
  UPDATE_TRACE_POINT();
629
638
  this_thread::disable_interruption di;
630
639
  this_thread::disable_syscall_interruption dsi;
631
- bool exitGracefully = waitForStarterProcessOrWatchers(watchers);
640
+ bool exitGracefully = waitForStarterProcessOrWatchers(wo, watchers);
632
641
  if (exitGracefully) {
633
642
  /* Fork a child process which cleans up all the agent processes in
634
643
  * the background and exit this watchdog process so that we don't block
@@ -642,7 +651,7 @@ main(int argc, char *argv[]) {
642
651
  AgentWatcher::stopWatching(watchers);
643
652
  if (exitGracefully) {
644
653
  UPDATE_TRACE_POINT();
645
- cleanupAgentsInBackground(watchers, argv);
654
+ cleanupAgentsInBackground(wo, watchers, argv);
646
655
  return 0;
647
656
  } else {
648
657
  UPDATE_TRACE_POINT();
@@ -30,9 +30,10 @@
30
30
  */
31
31
  class ServerInstanceDirToucher {
32
32
  private:
33
+ WorkingObjectsPtr wo;
33
34
  oxt::thread *thr;
34
35
 
35
- static void
36
+ void
36
37
  threadMain() {
37
38
  while (!this_thread::interruption_requested()) {
38
39
  syscalls::sleep(60 * 60 * 6);
@@ -66,12 +67,12 @@ private:
66
67
  }
67
68
 
68
69
  do {
69
- ret = chdir(serverInstanceDir->getPath().c_str());
70
+ ret = chdir(wo->serverInstanceDir->getPath().c_str());
70
71
  } while (ret == -1 && errno == EINTR);
71
72
  if (ret == -1) {
72
73
  e = errno;
73
74
  fprintf(stderr, "chdir(\"%s\") failed: %s (%d)\n",
74
- serverInstanceDir->getPath().c_str(),
75
+ wo->serverInstanceDir->getPath().c_str(),
75
76
  strerror(e), e);
76
77
  fflush(stderr);
77
78
  _exit(1);
@@ -100,8 +101,10 @@ private:
100
101
  }
101
102
 
102
103
  public:
103
- ServerInstanceDirToucher() {
104
- thr = new oxt::thread(threadMain, "Server instance dir toucher", 256 * 1024);
104
+ ServerInstanceDirToucher(const WorkingObjectsPtr &wo) {
105
+ this->wo = wo;
106
+ thr = new oxt::thread(boost::bind(&ServerInstanceDirToucher::threadMain, this),
107
+ "Server instance dir toucher", 256 * 1024);
105
108
  }
106
109
 
107
110
  ~ServerInstanceDirToucher() {
@@ -109,3 +112,5 @@ public:
109
112
  delete thr;
110
113
  }
111
114
  };
115
+
116
+ typedef shared_ptr<ServerInstanceDirToucher> ServerInstanceDirToucherPtr;
@@ -30,7 +30,7 @@ module PhusionPassenger
30
30
 
31
31
  PACKAGE_NAME = 'passenger'
32
32
  # Run 'rake ext/common/Constants.h' after changing this number.
33
- VERSION_STRING = '4.0.8'
33
+ VERSION_STRING = '4.0.10'
34
34
 
35
35
  PREFERRED_NGINX_VERSION = '1.4.1'
36
36
  NGINX_SHA256_CHECKSUM = 'bca5d1e89751ba29406185e1736c390412603a7e6b604f5b4575281f6565d119'
@@ -238,9 +238,8 @@ class ServerInstance
238
238
  return nil
239
239
  end
240
240
 
241
- # FIXME: probably broken
242
- def stats
243
- doc = REXML::Document.new(xml)
241
+ def stats(client)
242
+ doc = REXML::Document.new(client.pool_xml)
244
243
  stats = Stats.new
245
244
  stats.max = doc.elements["info/max"].text.to_i
246
245
  stats.usage = doc.elements["info/usage"].text.to_i
@@ -248,12 +247,10 @@ class ServerInstance
248
247
  return stats
249
248
  end
250
249
 
251
- # FIXME: probably broken
252
- def get_wait_list_size
253
- return stats.get_wait_list_size
250
+ def get_wait_list_size(client)
251
+ return stats(client).get_wait_list_size
254
252
  end
255
253
 
256
- # FIXME: probably broken
257
254
  def groups(client)
258
255
  doc = REXML::Document.new(client.pool_xml)
259
256
 
@@ -297,7 +294,6 @@ class ServerInstance
297
294
  return groups
298
295
  end
299
296
 
300
- # FIXME: probably broken
301
297
  def processes(client)
302
298
  return groups(client).map do |group|
303
299
  group.processes
@@ -47,7 +47,7 @@ class AnalyticsLogger
47
47
  end
48
48
 
49
49
  def null?
50
- return !@connection
50
+ return !@connection || !@connection.connected?
51
51
  end
52
52
 
53
53
  def message(text)
@@ -26,7 +26,7 @@ require 'phusion_passenger'
26
26
  module PhusionPassenger
27
27
  PASSENGER_ANALYTICS_WEB_LOG = "PASSENGER_ANALYTICS_WEB_LOG".freeze
28
28
  PASSENGER_TXN_ID = "PASSENGER_TXN_ID".freeze
29
- PASSENGER_UNION_STATION_KEY = "PASSENGER_UNION_STATION_KEY".freeze
29
+ PASSENGER_UNION_STATION_KEY = "UNION_STATION_KEY".freeze
30
30
  RACK_HIJACK_IO = "rack.hijack_io".freeze
31
31
 
32
32
  # Constants shared between the C++ and Ruby codebase. The C++ Constants.h
@@ -7,7 +7,7 @@ require 'phusion_passenger/packaging'
7
7
  Gem::Specification.new do |s|
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.homepage = "https://www.phusionpassenger.com/"
10
- s.summary = "Easy and robust Ruby web application deployment"
10
+ s.summary = "A fast and robust web server and application server for Ruby, Python and Node.js"
11
11
  s.name = PhusionPassenger::PACKAGE_NAME
12
12
  s.version = PhusionPassenger::VERSION_STRING
13
13
  s.rubyforge_project = "passenger"
@@ -21,5 +21,6 @@ Gem::Specification.new do |s|
21
21
  Dir[*PhusionPassenger::Packaging::EXCLUDE_GLOB]
22
22
  s.executables = PhusionPassenger::Packaging::USER_EXECUTABLES +
23
23
  PhusionPassenger::Packaging::SUPER_USER_EXECUTABLES
24
- s.description = "Easy and robust Ruby web application deployment."
24
+ s.description = "A modern web server and application server for Ruby, Python and Node.js, " +
25
+ "optimized for performance, low memory usage and ease of use."
25
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passenger
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.8
4
+ version: 4.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-09 00:00:00.000000000 Z
12
+ date: 2013-07-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -59,7 +59,8 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
- description: Easy and robust Ruby web application deployment.
62
+ description: A modern web server and application server for Ruby, Python and Node.js,
63
+ optimized for performance, low memory usage and ease of use.
63
64
  email: software-signing@phusion.nl
64
65
  executables:
65
66
  - passenger
@@ -2741,5 +2742,6 @@ rubyforge_project: passenger
2741
2742
  rubygems_version: 1.8.25
2742
2743
  signing_key:
2743
2744
  specification_version: 3
2744
- summary: Easy and robust Ruby web application deployment
2745
+ summary: A fast and robust web server and application server for Ruby, Python and
2746
+ Node.js
2745
2747
  test_files: []
metadata.gz.asc CHANGED
@@ -2,11 +2,11 @@
2
2
  Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
3
3
  Comment: GPGTools - http://gpgtools.org
4
4
 
5
- iQEcBAABAgAGBQJR28iYAAoJECrHRaUKISqMQI4H/07+WJ2+hUyYOccJ6FxrH/7e
6
- 59ofy0PbGFEctyrfH7+TilJixj+xzKqn9q75q7eBNX8bK8gGD8zX1AwvgILvUWby
7
- OU23wRacnuhYbJrRK6aeftCDNDsoLpLGvfYBr05aUE72q4lUGuoE7A9Yc+1JVJPN
8
- DEpwf5BhcF0MGCtTZtuujCMBpHP6Dc+i1Ty9vhNYI4lvZgRNEwwU5MDyjH0ZJeyL
9
- pK8+h7zhLL4ryS+h+g3HXRjEcvkth2ANaK/UhB74pWpnbqTqyMazpsSSK4XypHgh
10
- 7ynPAf74eO8qfVZ1uPfwtm+53FXQIl5ix0MGg84osGJW3KUoyG1f5I1aUcAanZs=
11
- =dSK/
5
+ iQEcBAABAgAGBQJR5WamAAoJECrHRaUKISqM41MH/20mO9nzKZ+maVkCQxVOC5f+
6
+ p3Qx8pnORTW93re1wgL4WcDriAsn0uEaDimtKTZVQ0aDwExhkjyTHH6N/mvaUQqQ
7
+ btrIq+3YZwrtpk4clHi2o5rj4CkYuVVekPPmM+QDsmd3Zb1VHsTWDYc3dZSv0UaF
8
+ Iwmo0k5ZLnMbf7n/PdoN9Fu7Mt+HR0kF7eXVmTMrKNrpWoqp0AxpxW1QeNtuwMjv
9
+ lBAcdtrzNNW0nG6a7h3PrxuDk1cx2eyvDsJFWkyTwhzNrq4KX/HpVhx3S5W/kZhN
10
+ W5Qa9Mu7bMlP2eLI9YGQP3yAUJIuT0JqROZHdhoxKt1hpkx5e7dYEKx0dLnSKKM=
11
+ =Ikun
12
12
  -----END PGP SIGNATURE-----