passenger 5.0.10 → 5.0.11

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.

Files changed (124) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.asc +7 -7
  3. data.tar.gz.asc +7 -7
  4. data/CHANGELOG +18 -0
  5. data/CONTRIBUTING.md +3 -3
  6. data/bin/passenger-status +12 -4
  7. data/build/agents.rb +45 -45
  8. data/build/apache2.rb +1 -1
  9. data/build/basics.rb +1 -1
  10. data/build/cxx_tests.rb +12 -12
  11. data/doc/CloudLicensingConfiguration.html +10 -10
  12. data/doc/CloudLicensingConfiguration.txt.md +10 -10
  13. data/doc/DebuggingAndStressTesting.md +3 -3
  14. data/doc/Design and Architecture.html +30 -30
  15. data/doc/Design and Architecture.txt +28 -28
  16. data/doc/ServerOptimizationGuide.html +3 -3
  17. data/doc/ServerOptimizationGuide.txt.md +3 -3
  18. data/doc/Users guide Apache.html +24 -12
  19. data/doc/Users guide Apache.txt +2 -2
  20. data/doc/Users guide Nginx.html +24 -12
  21. data/doc/Users guide Nginx.txt +2 -2
  22. data/doc/Users guide Standalone.html +18 -6
  23. data/doc/images/passenger_architecture.png +0 -0
  24. data/doc/images/passenger_architecture.svg +10 -9
  25. data/doc/images/{helper_agent_core_architecture.png → passenger_core_architecture.png} +0 -0
  26. data/doc/users_guide_snippets/environment_variables.txt +1 -1
  27. data/doc/users_guide_snippets/installation/verify_running_epilogue.txt +1 -1
  28. data/doc/users_guide_snippets/support_information.txt +1 -1
  29. data/doc/users_guide_snippets/tips.txt +2 -2
  30. data/doc/users_guide_snippets/under_the_hood/relationship_with_ruby.txt +1 -1
  31. data/ext/apache2/Bucket.h +5 -5
  32. data/ext/apache2/Configuration.cpp +1 -1
  33. data/ext/apache2/Configuration.hpp +2 -3
  34. data/ext/apache2/ConfigurationFields.hpp +3 -0
  35. data/ext/apache2/ConfigurationFields.hpp.erb +3 -0
  36. data/ext/apache2/Hooks.cpp +42 -34
  37. data/ext/common/Account.h +3 -3
  38. data/ext/common/AgentsStarter.cpp +7 -7
  39. data/ext/common/AgentsStarter.h +20 -20
  40. data/ext/common/ApplicationPool2/Options.h +12 -12
  41. data/ext/common/Constants.h +10 -8
  42. data/ext/common/Logging.cpp +22 -1
  43. data/ext/common/Logging.h +19 -2
  44. data/ext/common/ServerKit/AcceptLoadBalancer.h +3 -3
  45. data/ext/common/ServerKit/Server.h +24 -0
  46. data/ext/common/UnionStation/Connection.h +1 -1
  47. data/ext/common/UnionStation/Core.h +21 -21
  48. data/ext/common/UnionStation/Transaction.h +3 -3
  49. data/ext/common/Utils.cpp +2 -2
  50. data/ext/common/Utils/IOUtils.cpp +5 -1
  51. data/ext/common/{agents → agent}/ApiServerUtils.h +3 -3
  52. data/ext/common/{agents → agent}/Base.cpp +2 -2
  53. data/ext/common/{agents → agent}/Base.h +0 -0
  54. data/ext/common/{agents/HelperAgent → agent/Core}/ApiServer.h +33 -9
  55. data/ext/common/{agents/HelperAgent → agent/Core}/Main.cpp +60 -59
  56. data/ext/common/{agents/HelperAgent → agent/Core}/OptionParser.h +32 -25
  57. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler.h +17 -17
  58. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/AppResponse.h +0 -0
  59. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/BufferBody.cpp +0 -0
  60. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/CheckoutSession.cpp +0 -0
  61. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/Client.h +2 -2
  62. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/ForwardResponse.cpp +0 -0
  63. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/Hooks.cpp +0 -0
  64. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/InitRequest.cpp +4 -3
  65. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/Request.h +1 -1
  66. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/SendRequest.cpp +0 -0
  67. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/TurboCaching.h +1 -1
  68. data/ext/common/{agents/HelperAgent → agent/Core}/RequestHandler/Utils.cpp +0 -0
  69. data/ext/common/{agents/HelperAgent → agent/Core}/ResponseCache.h +0 -0
  70. data/ext/common/{agents → agent}/Main.cpp +9 -9
  71. data/ext/common/{agents → agent}/SpawnPreparer/Main.cpp +0 -0
  72. data/ext/common/{agents/HelperAgent/SystemMetricsTool.cpp → agent/SystemMetrics/Main.cpp} +0 -0
  73. data/ext/common/{agents → agent}/TempDirToucher/Main.cpp +0 -0
  74. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/ApiServer.h +7 -7
  75. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/DataStoreId.h +0 -0
  76. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/FilterSupport.cpp +0 -0
  77. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/FilterSupport.h +0 -0
  78. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/LoggingServer.h +4 -4
  79. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/Main.cpp +45 -45
  80. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/OptionParser.h +20 -20
  81. data/ext/common/{agents/LoggingAgent → agent/UstRouter}/RemoteSender.h +0 -0
  82. data/ext/common/{agents → agent}/Watchdog/AgentWatcher.cpp +0 -0
  83. data/ext/common/{agents → agent}/Watchdog/ApiServer.h +1 -1
  84. data/ext/common/{agents/Watchdog/HelperAgentWatcher.cpp → agent/Watchdog/CoreWatcher.cpp} +14 -10
  85. data/ext/common/{agents → agent}/Watchdog/InstanceDirToucher.cpp +0 -0
  86. data/ext/common/{agents → agent}/Watchdog/Main.cpp +131 -75
  87. data/ext/common/{agents/Watchdog/LoggingAgentWatcher.cpp → agent/Watchdog/UstRouterWatcher.cpp} +13 -9
  88. data/ext/nginx/CacheLocationConfig.c +11 -6
  89. data/ext/nginx/CacheLocationConfig.c.erb +11 -6
  90. data/ext/nginx/Configuration.c +22 -7
  91. data/ext/nginx/Configuration.h +1 -19
  92. data/ext/nginx/ConfigurationFields.h +19 -0
  93. data/ext/nginx/ConfigurationFields.h.erb +19 -0
  94. data/ext/nginx/ContentHandler.c +33 -33
  95. data/ext/nginx/CreateLocationConfig.c +3 -1
  96. data/ext/nginx/CreateLocationConfig.c.erb +3 -1
  97. data/ext/nginx/MergeLocationConfig.c +8 -4
  98. data/ext/nginx/MergeLocationConfig.c.erb +7 -3
  99. data/ext/nginx/ngx_http_passenger_module.c +33 -42
  100. data/helper-scripts/backtrace-sanitizer.rb +2 -2
  101. data/lib/phusion_passenger.rb +1 -1
  102. data/lib/phusion_passenger/admin_tools/instance.rb +2 -2
  103. data/lib/phusion_passenger/admin_tools/instance_registry.rb +7 -3
  104. data/lib/phusion_passenger/common_library.rb +8 -8
  105. data/lib/phusion_passenger/config/about_command.rb +1 -1
  106. data/lib/phusion_passenger/config/api_call_command.rb +3 -3
  107. data/lib/phusion_passenger/config/installation_utils.rb +34 -21
  108. data/lib/phusion_passenger/config/reopen_logs_command.rb +2 -2
  109. data/lib/phusion_passenger/config/restart_app_command.rb +18 -4
  110. data/lib/phusion_passenger/constants.rb +7 -5
  111. data/lib/phusion_passenger/loader_shared_helpers.rb +2 -6
  112. data/lib/phusion_passenger/message_client.rb +8 -8
  113. data/lib/phusion_passenger/platform_info/ruby.rb +1 -2
  114. data/lib/phusion_passenger/preloader_shared_helpers.rb +1 -1
  115. data/lib/phusion_passenger/request_handler.rb +3 -2
  116. data/lib/phusion_passenger/request_handler/thread_handler.rb +4 -4
  117. data/lib/phusion_passenger/standalone/start_command.rb +13 -3
  118. data/lib/phusion_passenger/standalone/start_command/builtin_engine.rb +2 -1
  119. data/lib/phusion_passenger/union_station/core.rb +18 -18
  120. data/lib/phusion_passenger/union_station/transaction.rb +5 -5
  121. data/resources/oss-binaries.phusionpassenger.com.crt +0 -84
  122. data/resources/templates/standalone/config.erb +1 -0
  123. metadata +40 -40
  124. metadata.gz.asc +7 -7
@@ -906,7 +906,7 @@ include::users_guide_snippets/since_version.txt[]
906
906
 
907
907
  Enables or disables the loading of shell environment variables before spawning the application.
908
908
 
909
- If this option is turned on, and the user's shell is `bash`, then applications are loaded by running them with `bash -l -c`. Otherwise, they are loaded by running them directly from the `PassengerHelperAgent` process.
909
+ If this option is turned on, and the user's shell is `bash`, then applications are loaded by running them with `bash -l -c`. Otherwise, they are loaded by running them directly from the `PassengerAgent core` process.
910
910
 
911
911
  This option may occur in the following places:
912
912
 
@@ -1443,7 +1443,7 @@ The <<PassengerMemoryLimit,PassengerMemoryLimit>> directive uses
1443
1443
  queries `/proc` to obtain additional memory usage information that's
1444
1444
  not obtainable through `ps`. You should ensure that the `ps` works
1445
1445
  correctly and that the `/proc` filesystem is accessible by the
1446
- `PassengerHelperAgent` process.
1446
+ `PassengerAgent core` process.
1447
1447
  =====================================================
1448
1448
 
1449
1449
  [CAUTION]
@@ -1431,7 +1431,7 @@ width:100%;
1431
1431
  <td class="tableblock halign-left valign-top"><p class="tableblock">2.6</p></td>
1432
1432
  </tr>
1433
1433
  <tr>
1434
- <td class="tableblock halign-left valign-top"><p class="tableblock">Node.js</p></td>
1434
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Node.js/io.js</p></td>
1435
1435
  <td class="tableblock halign-left valign-top"><p class="tableblock">0.10</p></td>
1436
1436
  </tr>
1437
1437
  <tr>
@@ -2119,7 +2119,7 @@ kill PID_OF_FLYING_PASSENGER</pre>
2119
2119
  <pre>passenger-memory-stats</pre>
2120
2120
  </div>
2121
2121
  </div>
2122
- <div class="paragraph"><p>You should see the web server processes as well as a number of Phusion Passenger processes (e.g. PassengerWatchdog, PassengerHelperAgent). Congratulations, Phusion Passenger is now installed and running!
2122
+ <div class="paragraph"><p>You should see the web server processes as well as a number of Phusion Passenger processes (e.g. PassengerAgent watchdog, PassengerAgent core). Congratulations, Phusion Passenger is now installed and running!
2123
2123
  At this point you may be interested in <a href="#nginx_init_script">creating an Nginx init script</a>.</p></div>
2124
2124
  <div class="paragraph"><p>If the output is not as expected, then please refer to the <a href="#troubleshooting">Troubleshooting</a> section.</p></div>
2125
2125
  </div>
@@ -2231,7 +2231,7 @@ kill PID_OF_FLYING_PASSENGER</pre>
2231
2231
  <pre>./bin/passenger-memory-stats</pre>
2232
2232
  </div>
2233
2233
  </div>
2234
- <div class="paragraph"><p>You should see the web server processes as well as a number of Phusion Passenger processes (e.g. PassengerWatchdog, PassengerHelperAgent). Congratulations, Phusion Passenger is now installed and running!
2234
+ <div class="paragraph"><p>You should see the web server processes as well as a number of Phusion Passenger processes (e.g. PassengerAgent watchdog, PassengerAgent core). Congratulations, Phusion Passenger is now installed and running!
2235
2235
  At this point you may be interested in <a href="#nginx_init_script">creating an Nginx init script</a>.</p></div>
2236
2236
  <div class="paragraph"><p>If the output is not as expected, then please refer to the <a href="#troubleshooting">Troubleshooting</a> section.</p></div>
2237
2237
  </div>
@@ -4114,7 +4114,7 @@ In an <em>if</em> configuration scope.
4114
4114
  <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerLoadShellEnvvars"></span><h4 data-comment-topic="passenger-load-shell-envvars-on-off--fw5u4l" data-anchor="PassengerLoadShellEnvvars">7.3.14. passenger_load_shell_envvars &lt;on|off&gt;</h4>
4115
4115
  <div class="paragraph"><p><strong>Introduced in version 4.0.20.</strong></p></div>
4116
4116
  <div class="paragraph"><p>Enables or disables the loading of shell environment variables before spawning the application.</p></div>
4117
- <div class="paragraph"><p>If this option is turned on, and the user’s shell is <span class="monospaced">bash</span>, then applications are loaded by running them with <span class="monospaced">bash -l -c</span>. Otherwise, they are loaded by running them directly from the <span class="monospaced">PassengerHelperAgent</span> process.</p></div>
4117
+ <div class="paragraph"><p>If this option is turned on, and the user’s shell is <span class="monospaced">bash</span>, then applications are loaded by running them with <span class="monospaced">bash -l -c</span>. Otherwise, they are loaded by running them directly from the <span class="monospaced">PassengerAgent core</span> process.</p></div>
4118
4118
  <div class="paragraph"><p>This option may occur in the following places:</p></div>
4119
4119
  <div class="ulist"><ul>
4120
4120
  <li>
@@ -4958,7 +4958,7 @@ In an <em>if</em> configuration scope.
4958
4958
  queries <span class="monospaced">/proc</span> to obtain additional memory usage information that’s
4959
4959
  not obtainable through <span class="monospaced">ps</span>. You should ensure that the <span class="monospaced">ps</span> works
4960
4960
  correctly and that the <span class="monospaced">/proc</span> filesystem is accessible by the
4961
- <span class="monospaced">PassengerHelperAgent</span> process.</p></div>
4961
+ <span class="monospaced">PassengerAgent core</span> process.</p></div>
4962
4962
  </td>
4963
4963
  </tr></table>
4964
4964
  </div>
@@ -7029,7 +7029,7 @@ Attached process 28303 for app /webapps/foobar.
7029
7029
  <div class="sect3">
7030
7030
  <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_blocking_and_concurrency"></span><h4 data-comment-topic="blocking-and-concurrency-g5njp1" data-anchor="_blocking_and_concurrency">10.9.3. Blocking and concurrency</h4>
7031
7031
  <div class="paragraph"><p>Except when otherwise documented, all hooks block in the background. That is, while your hook command is running, Phusion Passenger can still handle web requests, but the background thread which is running your hook will be blocked and won’t be able to perform any further operations. For example, if you wrote a hook script for the <span class="monospaced">attached_process</span> event, then Phusion Passenger won’t be able to attach further processes until your hook script finishes. You should therefore be careful when writing hook scripts.</p></div>
7032
- <div class="paragraph"><p>If you have a bug in your script and it blocks, then you will be able to see that using the command <span class="monospaced">passenger-status --show=backtraces</span> which prints the backtraces of all threads in the Phusion Passenger HelperAgent. Look for the <span class="monospaced">runSingleHookScript</span> function in the backtrace. The following example shows at line 2 that Phusion Passenger is waiting for the hook script <span class="monospaced">/home/phusion/badscript.sh</span>.</p></div>
7032
+ <div class="paragraph"><p>If you have a bug in your script and it blocks, then you will be able to see that using the command <span class="monospaced">passenger-status --show=backtraces</span> which prints the backtraces of all threads in the Phusion Passenger core. Look for the <span class="monospaced">runSingleHookScript</span> function in the backtrace. The following example shows at line 2 that Phusion Passenger is waiting for the hook script <span class="monospaced">/home/phusion/badscript.sh</span>.</p></div>
7033
7033
  <div class="listingblock">
7034
7034
  <div class="content monospaced">
7035
7035
  <pre>Thread 'Group process spawner: /home/phusion/webapp.test#default' (0x1062d4000):
@@ -7056,7 +7056,7 @@ Attached process 28303 for app /webapps/foobar.
7056
7056
  </dt>
7057
7057
  <dd>
7058
7058
  <p>
7059
- Called at the very beginning of Phusion Passenger’s life cycle, during the start of the Watchdog process. The first hook is called before initialization is performed (before the HelperAgent is started). Errors in the hook script cause Phusion Passenger to abort.
7059
+ Called at the very beginning of Phusion Passenger’s life cycle, during the start of the Watchdog process. The first hook is called before initialization is performed (before the Passenger core is started). Errors in the hook script cause Phusion Passenger to abort.
7060
7060
  </p>
7061
7061
  </dd>
7062
7062
  <dt class="hdlist1">
@@ -7565,13 +7565,25 @@ Phusion Passenger’s installer, build system and administration tools are writt
7565
7565
  <p>
7566
7566
  Certain internally used tools, such as the crash handler (which generates a backtrace in case Phusion Passenger crash) and the prespawn script (used to implement
7567
7567
  <a href="#PassengerPreStart">passenger_pre_start</a>)
7568
+ are written in Ruby as well.
7569
+ </p>
7570
+ </li>
7571
+ <li>
7572
+ <p>
7573
+ Ruby web application support is implemented in Ruby.
7574
+ </p>
7575
+ </li>
7576
+ <li>
7577
+ <p>
7578
+ If you use <a href="#flying_passenger">Flying Passenger</a>, then the Flying Passenger daemon is written in Ruby. The daemon is a small (less than 500 lines of code) and offloads most tasks to the C++ core.
7579
+ </p>
7580
+ </li>
7581
+ <li>
7582
+ <p>
7583
+ If you use <a href="Users%20guide%20Standalone.html">Phusion Passenger Standalone</a>, then the frontend (the <span class="monospaced">passenger</span> command) is written in Ruby. The frontend is small (less than 1500 lines of code) and offloads most tasks to the C++ core.
7568
7584
  </p>
7569
7585
  </li>
7570
7586
  </ul></div>
7571
- <div class="paragraph"><p>are written in Ruby as well.
7572
- * Ruby web application support is implemented in Ruby.
7573
- * If you use <a href="#flying_passenger">Flying Passenger</a>, then the Flying Passenger daemon is written in Ruby. The daemon is a small (less than 500 lines of code) and offloads most tasks to the C<span class="monospaced"> core.
7574
- * If you use <a href="Users%20guide%20Standalone.html">Phusion Passenger Standalone</a>, then the frontend (the <span class="monospaced">passenger</span> command) is written in Ruby. The frontend is small (less than 1500 lines of code) and offloads most tasks to the C</span> core.</p></div>
7575
7587
  <div class="paragraph"><p>Other than the aforementioned aspects, Phusion Passenger does not use Ruby during normal operation. For example, if you run Python WSGI web applications on Phusion Passenger, then there will be (almost) no Ruby code running on the system.</p></div>
7576
7588
  </div>
7577
7589
  <div class="sect3">
@@ -8339,7 +8351,7 @@ NOTE: Make sure your <span class="monospaced">~/.bashrc</span> is actually inclu
8339
8351
  </div>
8340
8352
  <div class="paragraph"><p>On Debian and Ubuntu, with an Apache installed through apt, Apache environment variables are defined in the file <span class="monospaced">/etc/apache2/envvars</span>. This is a shell script so environment variables must be specified with the shell syntax.</p></div>
8341
8353
  <div class="paragraph"><p>On Red Hat, Fedora, CentOS and ScientificLinux, with an Apache installed through YUM, Apache environment variables are defined in <span class="monospaced">/etc/sysconfig/httpd</span>.</p></div>
8342
- <div class="paragraph"><p>On OS X they are defined in <span class="monospaced">/System/Library/LaunchDaemons/org.apache.httpd.plist</span>, as explained <a href="/System/Library/LaunchDaemons/org.apache.httpd.plist">here on Stack Overflow</a>.</p></div>
8354
+ <div class="paragraph"><p>On OS X they are defined in <span class="monospaced">/System/Library/LaunchDaemons/org.apache.httpd.plist</span>, as explained <a href="http://stackoverflow.com/questions/6833939/path-environment-variable-for-apache2-on-mac">here on Stack Overflow</a>.</p></div>
8343
8355
  <div class="paragraph"><p>On other systems, or if you did not install Apache through the system’s package manager, the configuration file for environment variables is specific to the vendor that supplied Apache. There may not even be such a configuration file. You should contact the vendor for support.</p></div>
8344
8356
  </div>
8345
8357
  <div class="sect3">
@@ -880,7 +880,7 @@ include::users_guide_snippets/since_version.txt[]
880
880
 
881
881
  Enables or disables the loading of shell environment variables before spawning the application.
882
882
 
883
- If this option is turned on, and the user's shell is `bash`, then applications are loaded by running them with `bash -l -c`. Otherwise, they are loaded by running them directly from the `PassengerHelperAgent` process.
883
+ If this option is turned on, and the user's shell is `bash`, then applications are loaded by running them with `bash -l -c`. Otherwise, they are loaded by running them directly from the `PassengerAgent core` process.
884
884
 
885
885
  This option may occur in the following places:
886
886
 
@@ -1421,7 +1421,7 @@ The <<PassengerMemoryLimit,passenger_memory_limit>> directive uses the
1421
1421
  queries `/proc` to obtain additional memory usage information that's
1422
1422
  not obtainable through `ps`. You should ensure that the `ps` works
1423
1423
  correctly and that the `/proc` filesystem is accessible by the
1424
- `PassengerHelperAgent` process.
1424
+ `PassengerAgent core` process.
1425
1425
  =====================================================
1426
1426
 
1427
1427
  [CAUTION]
@@ -1276,7 +1276,7 @@ width:100%;
1276
1276
  <td class="tableblock halign-left valign-top"><p class="tableblock">2.6</p></td>
1277
1277
  </tr>
1278
1278
  <tr>
1279
- <td class="tableblock halign-left valign-top"><p class="tableblock">Node.js</p></td>
1279
+ <td class="tableblock halign-left valign-top"><p class="tableblock">Node.js/io.js</p></td>
1280
1280
  <td class="tableblock halign-left valign-top"><p class="tableblock">0.10</p></td>
1281
1281
  </tr>
1282
1282
  <tr>
@@ -2996,13 +2996,25 @@ Phusion Passenger’s installer, build system and administration tools are writt
2996
2996
  <p>
2997
2997
  Certain internally used tools, such as the crash handler (which generates a backtrace in case Phusion Passenger crash) and the prespawn script (used to implement
2998
2998
  <a href="#PassengerPreStart">passenger_pre_start</a>)
2999
+ are written in Ruby as well.
3000
+ </p>
3001
+ </li>
3002
+ <li>
3003
+ <p>
3004
+ Ruby web application support is implemented in Ruby.
3005
+ </p>
3006
+ </li>
3007
+ <li>
3008
+ <p>
3009
+ If you use <a href="#flying_passenger">Flying Passenger</a>, then the Flying Passenger daemon is written in Ruby. The daemon is a small (less than 500 lines of code) and offloads most tasks to the C++ core.
3010
+ </p>
3011
+ </li>
3012
+ <li>
3013
+ <p>
3014
+ If you use <a href="Users%20guide%20Standalone.html">Phusion Passenger Standalone</a>, then the frontend (the <span class="monospaced">passenger</span> command) is written in Ruby. The frontend is small (less than 1500 lines of code) and offloads most tasks to the C++ core.
2999
3015
  </p>
3000
3016
  </li>
3001
3017
  </ul></div>
3002
- <div class="paragraph"><p>are written in Ruby as well.
3003
- * Ruby web application support is implemented in Ruby.
3004
- * If you use <a href="#flying_passenger">Flying Passenger</a>, then the Flying Passenger daemon is written in Ruby. The daemon is a small (less than 500 lines of code) and offloads most tasks to the C<span class="monospaced"> core.
3005
- * If you use <a href="Users%20guide%20Standalone.html">Phusion Passenger Standalone</a>, then the frontend (the <span class="monospaced">passenger</span> command) is written in Ruby. The frontend is small (less than 1500 lines of code) and offloads most tasks to the C</span> core.</p></div>
3006
3018
  <div class="paragraph"><p>Other than the aforementioned aspects, Phusion Passenger does not use Ruby during normal operation. For example, if you run Python WSGI web applications on Phusion Passenger, then there will be (almost) no Ruby code running on the system.</p></div>
3007
3019
  </div>
3008
3020
  <div class="sect3">
@@ -3381,7 +3393,7 @@ NOTE: Make sure your <span class="monospaced">~/.bashrc</span> is actually inclu
3381
3393
  </div>
3382
3394
  <div class="paragraph"><p>On Debian and Ubuntu, with an Apache installed through apt, Apache environment variables are defined in the file <span class="monospaced">/etc/apache2/envvars</span>. This is a shell script so environment variables must be specified with the shell syntax.</p></div>
3383
3395
  <div class="paragraph"><p>On Red Hat, Fedora, CentOS and ScientificLinux, with an Apache installed through YUM, Apache environment variables are defined in <span class="monospaced">/etc/sysconfig/httpd</span>.</p></div>
3384
- <div class="paragraph"><p>On OS X they are defined in <span class="monospaced">/System/Library/LaunchDaemons/org.apache.httpd.plist</span>, as explained <a href="/System/Library/LaunchDaemons/org.apache.httpd.plist">here on Stack Overflow</a>.</p></div>
3396
+ <div class="paragraph"><p>On OS X they are defined in <span class="monospaced">/System/Library/LaunchDaemons/org.apache.httpd.plist</span>, as explained <a href="http://stackoverflow.com/questions/6833939/path-environment-variable-for-apache2-on-mac">here on Stack Overflow</a>.</p></div>
3385
3397
  <div class="paragraph"><p>On other systems, or if you did not install Apache through the system’s package manager, the configuration file for environment variables is specific to the vendor that supplied Apache. There may not even be such a configuration file. You should contact the vendor for support.</p></div>
3386
3398
  </div>
3387
3399
  <div class="sect3">
@@ -13,7 +13,7 @@
13
13
  height="300"
14
14
  id="svg2"
15
15
  sodipodi:version="0.32"
16
- inkscape:version="0.48.2 r9819"
16
+ inkscape:version="0.48.5 r10040"
17
17
  sodipodi:docname="passenger_architecture.svg"
18
18
  inkscape:output_extension="org.inkscape.output.svg.inkscape"
19
19
  version="1.0"
@@ -77,14 +77,14 @@
77
77
  inkscape:cy="197.81434"
78
78
  inkscape:document-units="px"
79
79
  inkscape:current-layer="layer1"
80
- inkscape:window-width="1345"
81
- inkscape:window-height="860"
82
- inkscape:window-x="-1"
80
+ inkscape:window-width="1359"
81
+ inkscape:window-height="856"
82
+ inkscape:window-x="81"
83
83
  inkscape:window-y="0"
84
84
  height="255px"
85
85
  width="690px"
86
86
  showgrid="false"
87
- inkscape:window-maximized="0" />
87
+ inkscape:window-maximized="1" />
88
88
  <metadata
89
89
  id="metadata7">
90
90
  <rdf:RDF>
@@ -206,13 +206,14 @@
206
206
  <text
207
207
  xml:space="preserve"
208
208
  style="font-size:19.99363899px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
209
- x="337.47308"
210
- y="122.29496"
209
+ x="342.47308"
210
+ y="120.29496"
211
211
  id="text2170"><tspan
212
212
  sodipodi:role="line"
213
213
  id="tspan2172"
214
- x="337.47308"
215
- y="122.29496">Helper agent</tspan></text>
214
+ x="342.47308"
215
+ y="120.29496"
216
+ style="font-size:16px">Passenger core</tspan></text>
216
217
  </g>
217
218
  </g>
218
219
  <g
@@ -177,7 +177,7 @@ On Debian and Ubuntu, with an Apache installed through apt, Apache environment v
177
177
 
178
178
  On Red Hat, Fedora, CentOS and ScientificLinux, with an Apache installed through YUM, Apache environment variables are defined in `/etc/sysconfig/httpd`.
179
179
 
180
- On OS X they are defined in `/System/Library/LaunchDaemons/org.apache.httpd.plist`, as explained link:/System/Library/LaunchDaemons/org.apache.httpd.plist[here on Stack Overflow].
180
+ On OS X they are defined in `/System/Library/LaunchDaemons/org.apache.httpd.plist`, as explained link:http://stackoverflow.com/questions/6833939/path-environment-variable-for-apache2-on-mac[here on Stack Overflow].
181
181
 
182
182
  On other systems, or if you did not install Apache through the system's package manager, the configuration file for environment variables is specific to the vendor that supplied Apache. There may not even be such a configuration file. You should contact the vendor for support.
183
183
 
@@ -1,4 +1,4 @@
1
- You should see the web server processes as well as a number of Phusion Passenger processes (e.g. PassengerWatchdog, PassengerHelperAgent). Congratulations, Phusion Passenger is now installed and running!
1
+ You should see the web server processes as well as a number of Phusion Passenger processes (e.g. PassengerAgent watchdog, PassengerAgent core). Congratulations, Phusion Passenger is now installed and running!
2
2
  ifdef::nginx[]
3
3
  At this point you may be interested in <<nginx_init_script,creating an Nginx init script>>.
4
4
  endif::[]
@@ -40,7 +40,7 @@ Supported languages and frameworks:
40
40
  | Rubinius | 2.2.0
41
41
  | Ruby on Rails | 2.3
42
42
  | Python | 2.6
43
- | Node.js | 0.10
43
+ | Node.js/io.js | 0.10
44
44
  | Meteor | 0.6
45
45
  |==================================================
46
46
 
@@ -489,7 +489,7 @@ Here are some of the environment variables which are passed to all hooks, unless
489
489
 
490
490
  Except when otherwise documented, all hooks block in the background. That is, while your hook command is running, Phusion Passenger can still handle web requests, but the background thread which is running your hook will be blocked and won't be able to perform any further operations. For example, if you wrote a hook script for the `attached_process` event, then Phusion Passenger won't be able to attach further processes until your hook script finishes. You should therefore be careful when writing hook scripts.
491
491
 
492
- If you have a bug in your script and it blocks, then you will be able to see that using the command `passenger-status --show=backtraces` which prints the backtraces of all threads in the Phusion Passenger HelperAgent. Look for the `runSingleHookScript` function in the backtrace. The following example shows at line 2 that Phusion Passenger is waiting for the hook script `/home/phusion/badscript.sh`.
492
+ If you have a bug in your script and it blocks, then you will be able to see that using the command `passenger-status --show=backtraces` which prints the backtraces of all threads in the Phusion Passenger core. Look for the `runSingleHookScript` function in the backtrace. The following example shows at line 2 that Phusion Passenger is waiting for the hook script `/home/phusion/badscript.sh`.
493
493
 
494
494
  ---------------------------------------------------------------------------------------------------
495
495
  Thread 'Group process spawner: /home/phusion/webapp.test#default' (0x1062d4000):
@@ -511,7 +511,7 @@ Because hooks are inherently tied to the implementation of Phusion Passenger, th
511
511
  ==== Available hooks
512
512
 
513
513
  `before_watchdog_initialization`::
514
- Called at the very beginning of Phusion Passenger's life cycle, during the start of the Watchdog process. The first hook is called before initialization is performed (before the HelperAgent is started). Errors in the hook script cause Phusion Passenger to abort.
514
+ Called at the very beginning of Phusion Passenger's life cycle, during the start of the Watchdog process. The first hook is called before initialization is performed (before the Passenger core is started). Errors in the hook script cause Phusion Passenger to abort.
515
515
  `after_watchdog_initialization`::
516
516
  Like `before_watchdog_initialization`, but called after initialization of all Phusion Passenger agent processes. Errors in the hook script cause Phusion Passenger to abort.
517
517
  `before_watchdog_shutdown`::
@@ -16,8 +16,8 @@ endif::[]
16
16
  ifdef::standalone[]
17
17
  <<PassengerPreStart,passenger_pre_start>>)
18
18
  endif::[]
19
-
20
19
  are written in Ruby as well.
20
+
21
21
  * Ruby web application support is implemented in Ruby.
22
22
  * If you use <<flying_passenger,Flying Passenger>>, then the Flying Passenger daemon is written in Ruby. The daemon is a small (less than 500 lines of code) and offloads most tasks to the C++ core.
23
23
  * If you use link:Users%20guide%20Standalone.html[Phusion Passenger Standalone], then the frontend (the `passenger` command) is written in Ruby. The frontend is small (less than 1500 lines of code) and offloads most tasks to the C++ core.
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2010 Phusion
3
+ * Copyright (c) 2010-2015 Phusion
4
4
  *
5
5
  * "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
6
  *
@@ -51,7 +51,7 @@ struct PassengerBucketState {
51
51
  */
52
52
  int errorCode;
53
53
 
54
- /** Connection to the helper agent. */
54
+ /** Connection to the Passenger core. */
55
55
  FileDescriptor connection;
56
56
 
57
57
  PassengerBucketState(const FileDescriptor &conn) {
@@ -75,9 +75,9 @@ typedef boost::shared_ptr<PassengerBucketState> PassengerBucketStatePtr;
75
75
  * to read less data than can actually be read.
76
76
  *
77
77
  * PassengerBucket is like apr_bucket_pipe, but:
78
- * - It also holds a reference to the helper agent connection. When a read
79
- * error has occured or when end-of-stream has been reached this connection
80
- * will be closed.
78
+ * - It also holds a reference to the connection with the Passenger core.
79
+ * When a read error has occured or when end-of-stream has been reached
80
+ * this connection will be closed.
81
81
  * - It ignores the APR_NONBLOCK_READ flag because that's known to cause
82
82
  * strange I/O problems.
83
83
  * - It can store its current state in a PassengerBucketState data structure.
@@ -38,7 +38,7 @@
38
38
  #include "Configuration.hpp"
39
39
  #include "Utils.h"
40
40
  #include "Constants.h"
41
- #include <agents/LoggingAgent/FilterSupport.h>
41
+ #include <agent/UstRouter/FilterSupport.h>
42
42
 
43
43
  /* The APR headers must come after the Passenger headers. See Hooks.cpp
44
44
  * to learn why.
@@ -61,10 +61,9 @@ using namespace std;
61
61
  * Use the getter methods to query information, because those will return
62
62
  * the default value if the value is not specified.
63
63
  */
64
- struct DirConfig {
65
- enum Threeway { ENABLED, DISABLED, UNSET };
64
+ #include "ConfigurationFields.hpp"
66
65
 
67
- #include "ConfigurationFields.hpp"
66
+ struct DirConfig : GeneratedDirConfigPart {
68
67
 
69
68
  std::set<std::string> baseURIs;
70
69
 
@@ -36,6 +36,8 @@
36
36
  * rake ext/apache2/ConfigurationFields.hpp
37
37
  */
38
38
 
39
+ struct GeneratedDirConfigPart {
40
+ enum Threeway { ENABLED, DISABLED, UNSET };
39
41
 
40
42
 
41
43
  /** Whether to buffer file uploads. */
@@ -93,3 +95,4 @@
93
95
  /** The user that Ruby applications must run as. */
94
96
  const char *user;
95
97
 
98
+ };
@@ -36,6 +36,8 @@
36
36
  * rake ext/apache2/ConfigurationFields.hpp
37
37
  */
38
38
 
39
+ struct GeneratedDirConfigPart {
40
+ enum Threeway { ENABLED, DISABLED, UNSET };
39
41
  <%
40
42
  require 'phusion_passenger/apache2/config_options'
41
43
 
@@ -92,3 +94,4 @@ end
92
94
  /** <%= definition[3] %> */
93
95
  <%= definition[0] %>;
94
96
  <% end %>
97
+ };
@@ -254,43 +254,43 @@ private:
254
254
  }
255
255
  }
256
256
 
257
- StaticString getServerAddress() const {
258
- return agentsStarter.getServerAddress();
257
+ StaticString getCoreAddress() const {
258
+ return agentsStarter.getCoreAddress();
259
259
  }
260
260
 
261
- StaticString getServerPassword() const {
262
- return agentsStarter.getServerPassword();
261
+ StaticString getCorePassword() const {
262
+ return agentsStarter.getCorePassword();
263
263
  }
264
264
 
265
265
  /**
266
- * Connect to the helper agent. If it looks like the helper agent crashed,
267
- * wait and retry for a short period of time until the helper agent has been
268
- * restarted.
266
+ * Connect to the Passenger core. If it looks like the core crashed,
267
+ * wait and retry for a short period of time until the core has been
268
+ * restarted by the watchdog.
269
269
  */
270
270
  FileDescriptor connectToInternalServer() {
271
271
  TRACE_POINT();
272
272
  FileDescriptor conn;
273
273
 
274
274
  try {
275
- conn.assign(connectToServer(getServerAddress(), __FILE__, __LINE__), NULL, 0);
275
+ conn.assign(connectToServer(getCoreAddress(), __FILE__, __LINE__), NULL, 0);
276
276
  } catch (const SystemException &e) {
277
277
  if (e.code() == EPIPE || e.code() == ECONNREFUSED || e.code() == ENOENT) {
278
278
  UPDATE_TRACE_POINT();
279
279
  bool connected = false;
280
280
 
281
- // Maybe the helper agent crashed. First wait 50 ms.
281
+ // Maybe the core crashed. First wait 50 ms.
282
282
  usleep(50000);
283
283
 
284
- // Then try to reconnect to the helper agent for the
284
+ // Then try to reconnect to the core for the
285
285
  // next 5 seconds.
286
286
  time_t deadline = time(NULL) + 5;
287
287
  while (!connected && time(NULL) < deadline) {
288
288
  try {
289
- conn.assign(connectToServer(getServerAddress(), __FILE__, __LINE__), NULL, 0);
289
+ conn.assign(connectToServer(getCoreAddress(), __FILE__, __LINE__), NULL, 0);
290
290
  connected = true;
291
291
  } catch (const SystemException &e) {
292
292
  if (e.code() == EPIPE || e.code() == ECONNREFUSED || e.code() == ENOENT) {
293
- // Looks like the helper agent hasn't been
293
+ // Looks like the core hasn't been
294
294
  // restarted yet. Wait between 20 and 100 ms.
295
295
  usleep(20000 + rand() % 80000);
296
296
  // Don't care about thread-safety of rand()
@@ -302,8 +302,8 @@ private:
302
302
 
303
303
  if (!connected) {
304
304
  UPDATE_TRACE_POINT();
305
- throw IOException("Cannot connect to the helper agent at " +
306
- getServerAddress());
305
+ throw IOException("Cannot connect to the Passenger core at " +
306
+ getCoreAddress());
307
307
  }
308
308
  } else {
309
309
  throw;
@@ -312,6 +312,19 @@ private:
312
312
  return conn;
313
313
  }
314
314
 
315
+ vector<string> getConfigFiles(server_rec *s) const {
316
+ server_rec *server;
317
+ vector<string> result;
318
+
319
+ for (server = s; server != NULL; server = server->next) {
320
+ if (server->defn_name != NULL) {
321
+ result.push_back(server->defn_name);
322
+ }
323
+ }
324
+
325
+ return result;
326
+ }
327
+
315
328
  bool hasModRewrite() {
316
329
  if (m_hasModRewrite == UNKNOWN) {
317
330
  if (ap_find_linked_module("mod_rewrite.c")) {
@@ -499,7 +512,7 @@ private:
499
512
 
500
513
  /**
501
514
  * Most of the high-level logic for forwarding a request to the
502
- * HelperAgent is contained in this method.
515
+ * Passenger core is contained in this method.
503
516
  */
504
517
  int handleRequest(request_rec *r) {
505
518
  /********** Step 1: preparation work **********/
@@ -573,7 +586,7 @@ private:
573
586
 
574
587
 
575
588
  /********** Step 3: forwarding the request and request body
576
- to the HelperAgent **********/
589
+ to the Passenger core **********/
577
590
 
578
591
  int ret;
579
592
  bool bodyIsChunked = false;
@@ -587,7 +600,7 @@ private:
587
600
  }
588
601
 
589
602
 
590
- /********** Step 4: forwarding the response from the HelperAgent
603
+ /********** Step 4: forwarding the response from the Passenger core
591
604
  back to the HTTP client **********/
592
605
 
593
606
  UPDATE_TRACE_POINT();
@@ -672,7 +685,7 @@ private:
672
685
  }
673
686
  return OK;
674
687
  } else {
675
- // HelperAgent sent an empty response, or an invalid response.
688
+ // Passenger core sent an empty response, or an invalid response.
676
689
  apr_brigade_cleanup(bb);
677
690
  apr_table_setn(r->err_headers_out, "Status", "500 Internal Server Error");
678
691
  return HTTP_INTERNAL_SERVER_ERROR;
@@ -926,7 +939,7 @@ private:
926
939
  // Add secure headers.
927
940
 
928
941
  result.append("!~: ", sizeof("!~: ") - 1);
929
- result.append(getServerPassword().data(), getServerPassword().size());
942
+ result.append(getCorePassword().data(), getCorePassword().size());
930
943
  result.append("\r\n!~DOCUMENT_ROOT: ", sizeof("\r\n!~DOCUMENT_ROOT: ") - 1);
931
944
  result.append(ap_document_root(r));
932
945
  result.append("\r\n", 2);
@@ -1222,7 +1235,7 @@ private:
1222
1235
  }
1223
1236
  } catch (const SystemException &e) {
1224
1237
  if (e.code() == EPIPE || e.code() == ECONNRESET) {
1225
- // The HelperAgent stopped reading the body, probably
1238
+ // The Passenger core stopped reading the body, probably
1226
1239
  // because the application already sent EOF.
1227
1240
  return;
1228
1241
  } else {
@@ -1239,7 +1252,14 @@ public:
1239
1252
  serverConfig.finalize();
1240
1253
  Passenger::setLogLevel(serverConfig.logLevel);
1241
1254
  if (serverConfig.logFile != NULL) {
1242
- Passenger::setLogFile(serverConfig.logFile);
1255
+ int errcode;
1256
+ if (!Passenger::setLogFileWithoutRedirectingStderr(serverConfig.logFile, &errcode)) {
1257
+ fprintf(stderr,
1258
+ "ERROR: cannot open log file %s: %s (errno=%d)\n",
1259
+ serverConfig.logFile,
1260
+ strerror(errcode),
1261
+ errcode);
1262
+ }
1243
1263
  }
1244
1264
  if (serverConfig.fileDescriptorLogFile != NULL) {
1245
1265
  Passenger::setFileDescriptorLogFile(serverConfig.fileDescriptorLogFile);
@@ -1268,6 +1288,7 @@ public:
1268
1288
  VariantMap params;
1269
1289
  params
1270
1290
  .setPid ("web_server_pid", getpid())
1291
+ .setStrSet("web_server_config_files", getConfigFiles(s))
1271
1292
  .set ("server_software", webServerDesc)
1272
1293
  .setBool("multi_app", true)
1273
1294
  .setBool("load_shell_envvars", true)
@@ -1295,19 +1316,6 @@ public:
1295
1316
  serverConfig.ctl.addTo(params);
1296
1317
 
1297
1318
  agentsStarter.start(serverConfig.root, params);
1298
-
1299
- // Store some relevant information in the generation directory.
1300
- string instanceDir = agentsStarter.getInstanceDir();
1301
- server_rec *server;
1302
- string configFiles;
1303
-
1304
- for (server = s; server != NULL; server = server->next) {
1305
- if (server->defn_name != NULL) {
1306
- configFiles.append(server->defn_name);
1307
- configFiles.append(1, '\n');
1308
- }
1309
- }
1310
- createFile(instanceDir + "/config_files.txt", configFiles);
1311
1319
  }
1312
1320
 
1313
1321
  void childInit(apr_pool_t *pchild, server_rec *s) {