passenger 5.0.8 → 5.0.9
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.
- checksums.yaml +8 -8
- checksums.yaml.gz.asc +7 -7
- data.tar.gz.asc +7 -7
- data/.editorconfig +20 -0
- data/CHANGELOG +21 -0
- data/bin/passenger-install-apache2-module +3 -1
- data/build/agents.rb +7 -5
- data/build/basics.rb +3 -3
- data/build/common_library.rb +52 -30
- data/build/cxx_tests.rb +20 -13
- data/build/misc.rb +5 -5
- data/doc/Design and Architecture.html +1 -1
- data/doc/Design and Architecture.txt +1 -1
- data/doc/Packaging.html +4 -4
- data/doc/Packaging.txt.md +4 -4
- data/doc/Users guide Apache.html +22 -9
- data/doc/Users guide Apache.idmap.txt +4 -2
- data/doc/Users guide Apache.txt +2 -0
- data/doc/Users guide Nginx.html +22 -9
- data/doc/Users guide Nginx.idmap.txt +4 -2
- data/doc/Users guide Nginx.txt +2 -0
- data/doc/Users guide Standalone.html +14 -9
- data/doc/Users guide Standalone.idmap.txt +4 -2
- data/doc/users_guide_snippets/installation.txt +10 -6
- data/ext/apache2/Hooks.cpp +13 -2
- data/ext/common/ApplicationPool2/Pool/Inspection.h +8 -3
- data/ext/common/BackgroundEventLoop.cpp +249 -67
- data/ext/common/BackgroundEventLoop.h +5 -5
- data/ext/common/Constants.h +1 -1
- data/ext/common/InstanceDirectory.h +8 -6
- data/ext/common/ServerKit/Context.h +8 -2
- data/ext/common/ServerKit/FileBufferedChannel.h +262 -226
- data/ext/common/ServerKit/HeaderTable.h +28 -3
- data/ext/common/ServerKit/HttpHeaderParser.h +37 -13
- data/ext/common/ServerKit/HttpServer.h +17 -1
- data/ext/common/ServerKit/Implementation.cpp +2 -0
- data/ext/common/ServerKit/Server.h +25 -28
- data/ext/common/Utils/IOUtils.cpp +11 -0
- data/ext/common/Utils/ProcessMetricsCollector.h +4 -0
- data/ext/common/Utils/StrIntUtils.cpp +11 -7
- data/ext/common/Utils/StrIntUtils.h +1 -1
- data/ext/common/Utils/StrIntUtilsNoStrictAliasing.cpp +21 -16
- data/ext/common/agents/Base.cpp +6 -0
- data/ext/common/agents/Base.h +2 -0
- data/ext/common/agents/HelperAgent/AdminServer.h +25 -25
- data/ext/common/agents/HelperAgent/Main.cpp +37 -12
- data/ext/common/agents/HelperAgent/RequestHandler.h +18 -20
- data/ext/common/agents/HelperAgent/RequestHandler/AppResponse.h +4 -0
- data/ext/common/agents/HelperAgent/RequestHandler/ForwardResponse.cpp +10 -6
- data/ext/common/agents/HelperAgent/RequestHandler/Hooks.cpp +2 -0
- data/ext/common/agents/HelperAgent/RequestHandler/InitRequest.cpp +1 -1
- data/ext/common/agents/HelperAgent/RequestHandler/SendRequest.cpp +1 -1
- data/ext/common/agents/HelperAgent/RequestHandler/Utils.cpp +9 -2
- data/ext/common/agents/HelperAgent/ResponseCache.h +11 -11
- data/ext/common/agents/LoggingAgent/AdminServer.h +8 -8
- data/ext/common/agents/LoggingAgent/Main.cpp +6 -5
- data/ext/common/agents/Watchdog/AdminServer.h +13 -13
- data/ext/common/agents/Watchdog/Main.cpp +8 -3
- data/ext/libuv/.gitignore +72 -0
- data/ext/libuv/AUTHORS +199 -0
- data/ext/libuv/ChangeLog +2023 -0
- data/ext/libuv/LICENSE +46 -0
- data/ext/libuv/Makefile.am +336 -0
- data/ext/libuv/README.md +197 -0
- data/ext/libuv/checksparse.sh +233 -0
- data/ext/libuv/common.gypi +210 -0
- data/ext/libuv/configure.ac +67 -0
- data/ext/libuv/gyp_uv.py +96 -0
- data/ext/libuv/include/android-ifaddrs.h +54 -0
- data/ext/libuv/include/pthread-fixes.h +72 -0
- data/ext/libuv/include/tree.h +768 -0
- data/ext/libuv/include/uv-aix.h +32 -0
- data/ext/libuv/include/uv-bsd.h +34 -0
- data/ext/libuv/include/uv-darwin.h +61 -0
- data/ext/libuv/include/uv-errno.h +418 -0
- data/ext/libuv/include/uv-linux.h +34 -0
- data/ext/libuv/include/uv-sunos.h +44 -0
- data/ext/libuv/include/uv-threadpool.h +37 -0
- data/ext/libuv/include/uv-unix.h +383 -0
- data/ext/libuv/include/uv-version.h +39 -0
- data/ext/libuv/include/uv.h +1455 -0
- data/ext/libuv/libuv.pc.in +11 -0
- data/ext/libuv/m4/.gitignore +4 -0
- data/ext/libuv/m4/as_case.m4 +21 -0
- data/ext/libuv/m4/libuv-check-flags.m4 +319 -0
- data/ext/libuv/src/fs-poll.c +255 -0
- data/ext/libuv/src/heap-inl.h +245 -0
- data/ext/libuv/src/inet.c +313 -0
- data/ext/libuv/src/queue.h +92 -0
- data/ext/libuv/src/threadpool.c +303 -0
- data/ext/libuv/src/unix/aix.c +1240 -0
- data/ext/libuv/src/unix/android-ifaddrs.c +703 -0
- data/ext/libuv/src/unix/async.c +284 -0
- data/ext/libuv/src/unix/atomic-ops.h +60 -0
- data/ext/libuv/src/unix/core.c +985 -0
- data/ext/libuv/src/unix/darwin-proctitle.c +206 -0
- data/ext/libuv/src/unix/darwin.c +331 -0
- data/ext/libuv/src/unix/dl.c +83 -0
- data/ext/libuv/src/unix/freebsd.c +435 -0
- data/ext/libuv/src/unix/fs.c +1189 -0
- data/ext/libuv/src/unix/fsevents.c +899 -0
- data/ext/libuv/src/unix/getaddrinfo.c +202 -0
- data/ext/libuv/src/unix/getnameinfo.c +120 -0
- data/ext/libuv/src/unix/internal.h +314 -0
- data/ext/libuv/src/unix/kqueue.c +418 -0
- data/ext/libuv/src/unix/linux-core.c +876 -0
- data/ext/libuv/src/unix/linux-inotify.c +257 -0
- data/ext/libuv/src/unix/linux-syscalls.c +471 -0
- data/ext/libuv/src/unix/linux-syscalls.h +158 -0
- data/ext/libuv/src/unix/loop-watcher.c +63 -0
- data/ext/libuv/src/unix/loop.c +135 -0
- data/ext/libuv/src/unix/netbsd.c +368 -0
- data/ext/libuv/src/unix/openbsd.c +384 -0
- data/ext/libuv/src/unix/pipe.c +288 -0
- data/ext/libuv/src/unix/poll.c +113 -0
- data/ext/libuv/src/unix/process.c +551 -0
- data/ext/libuv/src/unix/proctitle.c +102 -0
- data/ext/libuv/src/unix/pthread-fixes.c +103 -0
- data/ext/libuv/src/unix/signal.c +465 -0
- data/ext/libuv/src/unix/spinlock.h +53 -0
- data/ext/libuv/src/unix/stream.c +1598 -0
- data/ext/libuv/src/unix/sunos.c +763 -0
- data/ext/libuv/src/unix/tcp.c +327 -0
- data/ext/libuv/src/unix/thread.c +519 -0
- data/ext/libuv/src/unix/timer.c +172 -0
- data/ext/libuv/src/unix/tty.c +265 -0
- data/ext/libuv/src/unix/udp.c +833 -0
- data/ext/libuv/src/uv-common.c +544 -0
- data/ext/libuv/src/uv-common.h +214 -0
- data/ext/libuv/src/version.c +49 -0
- data/ext/libuv/uv.gyp +487 -0
- data/ext/nginx/ContentHandler.c +21 -10
- data/ext/nginx/ngx_http_passenger_module.c +7 -0
- data/ext/oxt/implementation.cpp +9 -2
- data/ext/oxt/initialize.hpp +5 -1
- data/lib/phusion_passenger.rb +3 -3
- data/lib/phusion_passenger/admin_tools/instance.rb +10 -6
- data/lib/phusion_passenger/admin_tools/instance_registry.rb +6 -2
- data/lib/phusion_passenger/packaging.rb +3 -4
- data/lib/phusion_passenger/platform_info.rb +13 -1
- data/lib/phusion_passenger/platform_info/apache.rb +15 -4
- data/lib/phusion_passenger/platform_info/apache_detector.rb +5 -1
- data/lib/phusion_passenger/rack/thread_handler_extension.rb +184 -99
- data/lib/phusion_passenger/request_handler/thread_handler.rb +13 -6
- data/lib/phusion_passenger/standalone/start_command.rb +2 -2
- data/resources/templates/apache2/apache_install_broken.txt.erb +2 -1
- metadata +99 -22
- metadata.gz.asc +7 -7
- data/ext/libeio/Changes +0 -76
- data/ext/libeio/LICENSE +0 -36
- data/ext/libeio/Makefile.am +0 -15
- data/ext/libeio/Makefile.in +0 -694
- data/ext/libeio/aclocal.m4 +0 -9418
- data/ext/libeio/autogen.sh +0 -3
- data/ext/libeio/config.guess +0 -1540
- data/ext/libeio/config.h.in +0 -136
- data/ext/libeio/config.sub +0 -1779
- data/ext/libeio/configure +0 -14822
- data/ext/libeio/configure.ac +0 -22
- data/ext/libeio/demo.c +0 -194
- data/ext/libeio/ecb.h +0 -714
- data/ext/libeio/eio.c +0 -2818
- data/ext/libeio/eio.h +0 -414
- data/ext/libeio/install-sh +0 -520
- data/ext/libeio/libeio.m4 +0 -195
- data/ext/libeio/ltmain.sh +0 -9636
- data/ext/libeio/missing +0 -376
- data/ext/libeio/xthread.h +0 -166
data/doc/Packaging.txt.md
CHANGED
@@ -278,16 +278,16 @@ Optional fields:
|
|
278
278
|
|
279
279
|
# Vendoring of libraries
|
280
280
|
|
281
|
-
Phusion Passenger vendors libev and
|
281
|
+
Phusion Passenger vendors libev and libuv in order to make installation easier
|
282
282
|
for users on operating systems without proper package management, like OS X.
|
283
283
|
If you want Phusion Passenger to compile against the system-provided
|
284
|
-
libev and/or
|
284
|
+
libev and/or libuv instead, then set the following environment variables
|
285
285
|
before compiling:
|
286
286
|
|
287
287
|
* `export USE_VENDORED_LIBEV=no`
|
288
|
-
* `export
|
288
|
+
* `export USE_VENDORED_LIBUV=no`
|
289
289
|
|
290
|
-
Note that we require at least libev 4.11 and
|
290
|
+
Note that we require at least libev 4.11 and libuv 1.4.2.
|
291
291
|
|
292
292
|
|
293
293
|
# Generating gem and tarball
|
data/doc/Users guide Apache.html
CHANGED
@@ -1126,8 +1126,9 @@ using the command line.</p></div>
|
|
1126
1126
|
<div class="foo toclevel4"><a href="#_verifying_the_phusion_software_signing_key">2.9.3. Verifying the Phusion Software Signing key</a></div>
|
1127
1127
|
<div class="foo toclevel4"><a href="#_verifying_the_gem_and_tarball">2.9.4. Verifying the gem and tarball</a></div>
|
1128
1128
|
<div class="foo toclevel4"><a href="#_verifying_git_signatures">2.9.5. Verifying Git signatures</a></div>
|
1129
|
-
<div class="foo toclevel4"><a href="#
|
1130
|
-
<div class="foo toclevel4"><a href="#
|
1129
|
+
<div class="foo toclevel4"><a href="#_verifying_debian_packages">2.9.6. Verifying Debian packages</a></div>
|
1130
|
+
<div class="foo toclevel4"><a href="#_verifying_rpm_packages">2.9.7. Verifying RPM packages</a></div>
|
1131
|
+
<div class="foo toclevel4"><a href="#_revocation">2.9.8. Revocation</a></div>
|
1131
1132
|
<div class="foo toclevel3"><a href="#_non_interactive_automatic_headless_installs_or_upgrades">2.10. Non-interactive, automatic, headless installs or upgrades</a></div>
|
1132
1133
|
<div class="foo toclevel3"><a href="#_customizing_the_compilation_process">2.11. Customizing the compilation process</a></div>
|
1133
1134
|
<div class="foo toclevel4"><a href="#_setting_the_compiler">2.11.1. Setting the compiler</a></div>
|
@@ -1781,7 +1782,7 @@ Download the Passenger YUM repository definition.
|
|
1781
1782
|
<div class="listingblock">
|
1782
1783
|
<div class="content monospaced">
|
1783
1784
|
<pre>unset HISTFILE
|
1784
|
-
sudo curl --fail -
|
1785
|
+
sudo curl --fail -sSL -u download:YOUR_DOWNLOAD_TOKEN -o /etc/yum.repos.d/passenger.repo https://www.phusionpassenger.com/enterprise_yum/el-passenger-enterprise.repo</pre>
|
1785
1786
|
</div>
|
1786
1787
|
</div>
|
1787
1788
|
<div class="paragraph"><p>The <span class="monospaced">unset HISTFILE</span> command ensures that your download token isn’t saved to the Bash history file.</p></div>
|
@@ -1911,12 +1912,12 @@ Stop/start Apache (reload or restart is not enough when upgrading):
|
|
1911
1912
|
<div class="ulist"><ul>
|
1912
1913
|
<li>
|
1913
1914
|
<p>
|
1914
|
-
Are you using RVM? Run <span class="monospaced">rvmsudo -
|
1915
|
+
Are you using RVM? Run <span class="monospaced">rvmsudo -H bash</span>
|
1915
1916
|
</p>
|
1916
1917
|
</li>
|
1917
1918
|
<li>
|
1918
1919
|
<p>
|
1919
|
-
Are you not using RVM, or do you not know what RVM is? Run <span class="monospaced">sudo -s</span>
|
1920
|
+
Are you not using RVM, or do you not know what RVM is? Run <span class="monospaced">sudo -H -s</span>
|
1920
1921
|
</p>
|
1921
1922
|
</li>
|
1922
1923
|
<li>
|
@@ -1978,7 +1979,7 @@ First, download the <strong>license key</strong> from the <a href="https://www.p
|
|
1978
1979
|
</div>
|
1979
1980
|
</div>
|
1980
1981
|
<div class="paragraph"><p>Substitute <em>YOUR_DOWNLOAD_TOKEN</em> with the one you find in the <a href="https://www.phusionpassenger.com/orders">Customer Area</a>. And notice the <strong>trailing slash</strong> in the URL! It is very important.</p></div>
|
1981
|
-
<div class="paragraph"><p>Finally, install the latest gem to obtain the files for the latest stable version of
|
1982
|
+
<div class="paragraph"><p>Finally, install the latest gem to obtain the files for the latest stable version of Passenger Enterprise:</p></div>
|
1982
1983
|
<div class="listingblock">
|
1983
1984
|
<div class="content monospaced">
|
1984
1985
|
<pre>gem install passenger-enterprise-server</pre>
|
@@ -2244,11 +2245,15 @@ gpg: Good signature from "Phusion Software Signing <software-signing@phusion.
|
|
2244
2245
|
</div>
|
2245
2246
|
</div>
|
2246
2247
|
<div class="sect3">
|
2247
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="
|
2248
|
-
<div class="paragraph"><p>
|
2248
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_verifying_debian_packages"></span><h4 data-comment-topic="verifying-deb-and-rpm-packages-vgtv04" data-anchor="_verifying_debian_packages">2.9.6. Verifying Debian packages</h4>
|
2249
|
+
<div class="paragraph"><p>Our <a href="#install_on_debian_ubuntu">APT repository</a> is signed by Phusion Automated Software Signing (<a href="mailto:auto-software-signing@phusion.nl">auto-software-signing@phusion.nl</a>). Packages are automatically checked upon installation.</p></div>
|
2249
2250
|
</div>
|
2250
2251
|
<div class="sect3">
|
2251
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="
|
2252
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_verifying_rpm_packages"></span><h4 data-comment-topic="verifying-rpm-packages-1nlx51r" data-anchor="_verifying_rpm_packages">2.9.7. Verifying RPM packages</h4>
|
2253
|
+
<div class="paragraph"><p>Our <a href="#installing_or_upgrading_on_red_hat">YUM repository</a> is signed by <a href="https://packagecloud.io">PackageCloud</a> (<a href="mailto:ops@packagecloud.io">ops@packagecloud.io</a>). PackageCloud is the RPM package hosting service that we use. You can find their key <a href="https://packagecloud.io/gpg.key">here</a>. Packages are automatically checked upon installation.</p></div>
|
2254
|
+
</div>
|
2255
|
+
<div class="sect3">
|
2256
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_revocation"></span><h4 data-comment-topic="revocation-4o01n2" data-anchor="_revocation">2.9.8. Revocation</h4>
|
2252
2257
|
<div class="paragraph"><p>In the event our key is compromised, we will revoke the key and upload the revocation information to sks-servers.net and keyserver.ubuntu.com. However your system will not know about the revocation until you update the keys from the keyservers. You should update your keys regularly (e.g. once a week) by invoking:</p></div>
|
2253
2258
|
<div class="listingblock">
|
2254
2259
|
<div class="content monospaced">
|
@@ -4185,6 +4190,14 @@ In <em>.htaccess</em>, if <span class="monospaced">AllowOverride Options</span>
|
|
4185
4190
|
</li>
|
4186
4191
|
</ul></div>
|
4187
4192
|
<div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>off</em>.</p></div>
|
4193
|
+
<div class="admonitionblock">
|
4194
|
+
<table><tr>
|
4195
|
+
<td class="icon">
|
4196
|
+
<img src="./images/icons/note.png" alt="Note">
|
4197
|
+
</td>
|
4198
|
+
<td class="content">Are you looking to prevent applications from being restarted when you restart the web server? That is handled by the <a href="Users%20guide%20Nginx.html#flying_passenger">Flying Passenger mode</a> (which requires Nginx), not by the rolling restarts feature.</td>
|
4199
|
+
</tr></table>
|
4200
|
+
</div>
|
4188
4201
|
</div>
|
4189
4202
|
<div class="sect3">
|
4190
4203
|
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerResistDeploymentErrors"></span><h4 data-comment-topic="passengerresistdeploymenterrors" data-anchor="PassengerResistDeploymentErrors">7.4.16. PassengerResistDeploymentErrors <on|off></h4>
|
@@ -56,9 +56,11 @@
|
|
56
56
|
|
57
57
|
2.9.5. Verifying Git signatures => verifying-git-signatures-oaafwd
|
58
58
|
|
59
|
-
2.9.6. Verifying
|
59
|
+
2.9.6. Verifying Debian packages => verifying-deb-and-rpm-packages-vgtv04
|
60
60
|
|
61
|
-
2.9.7.
|
61
|
+
2.9.7. Verifying RPM packages => verifying-rpm-packages-1nlx51r
|
62
|
+
|
63
|
+
2.9.8. Revocation => revocation-4o01n2
|
62
64
|
|
63
65
|
2.10. Non-interactive, automatic, headless installs or upgrades => non-interactive-automatic-headless-installs-or-upgrades-1arnxii
|
64
66
|
|
data/doc/Users guide Apache.txt
CHANGED
@@ -965,6 +965,8 @@ This option may occur in the following places:
|
|
965
965
|
|
966
966
|
In each place, it may be specified at most once. The default value is 'off'.
|
967
967
|
|
968
|
+
NOTE: Are you looking to prevent applications from being restarted when you restart the web server? That is handled by the link:Users%20guide%20Nginx.html#flying_passenger[Flying Passenger mode] (which requires Nginx), not by the rolling restarts feature.
|
969
|
+
|
968
970
|
[[PassengerResistDeploymentErrors]]
|
969
971
|
==== PassengerResistDeploymentErrors <on|off>
|
970
972
|
:version: 3.0.0
|
data/doc/Users guide Nginx.html
CHANGED
@@ -1127,8 +1127,9 @@ using the command line.</p></div>
|
|
1127
1127
|
<div class="foo toclevel4"><a href="#_verifying_the_phusion_software_signing_key">2.9.3. Verifying the Phusion Software Signing key</a></div>
|
1128
1128
|
<div class="foo toclevel4"><a href="#_verifying_the_gem_and_tarball">2.9.4. Verifying the gem and tarball</a></div>
|
1129
1129
|
<div class="foo toclevel4"><a href="#_verifying_git_signatures">2.9.5. Verifying Git signatures</a></div>
|
1130
|
-
<div class="foo toclevel4"><a href="#
|
1131
|
-
<div class="foo toclevel4"><a href="#
|
1130
|
+
<div class="foo toclevel4"><a href="#_verifying_debian_packages">2.9.6. Verifying Debian packages</a></div>
|
1131
|
+
<div class="foo toclevel4"><a href="#_verifying_rpm_packages">2.9.7. Verifying RPM packages</a></div>
|
1132
|
+
<div class="foo toclevel4"><a href="#_revocation">2.9.8. Revocation</a></div>
|
1132
1133
|
<div class="foo toclevel3"><a href="#_non_interactive_automatic_headless_installs_or_upgrades">2.10. Non-interactive, automatic, headless installs or upgrades</a></div>
|
1133
1134
|
<div class="foo toclevel3"><a href="#_customizing_the_compilation_process">2.11. Customizing the compilation process</a></div>
|
1134
1135
|
<div class="foo toclevel4"><a href="#_setting_the_compiler">2.11.1. Setting the compiler</a></div>
|
@@ -1832,7 +1833,7 @@ Download the Passenger YUM repository definition.
|
|
1832
1833
|
<div class="listingblock">
|
1833
1834
|
<div class="content monospaced">
|
1834
1835
|
<pre>unset HISTFILE
|
1835
|
-
sudo curl --fail -
|
1836
|
+
sudo curl --fail -sSL -u download:YOUR_DOWNLOAD_TOKEN -o /etc/yum.repos.d/passenger.repo https://www.phusionpassenger.com/enterprise_yum/el-passenger-enterprise.repo</pre>
|
1836
1837
|
</div>
|
1837
1838
|
</div>
|
1838
1839
|
<div class="paragraph"><p>The <span class="monospaced">unset HISTFILE</span> command ensures that your download token isn’t saved to the Bash history file.</p></div>
|
@@ -1974,12 +1975,12 @@ Restart Nginx:
|
|
1974
1975
|
<div class="ulist"><ul>
|
1975
1976
|
<li>
|
1976
1977
|
<p>
|
1977
|
-
Are you using RVM? Run <span class="monospaced">rvmsudo -
|
1978
|
+
Are you using RVM? Run <span class="monospaced">rvmsudo -H bash</span>
|
1978
1979
|
</p>
|
1979
1980
|
</li>
|
1980
1981
|
<li>
|
1981
1982
|
<p>
|
1982
|
-
Are you not using RVM, or do you not know what RVM is? Run <span class="monospaced">sudo -s</span>
|
1983
|
+
Are you not using RVM, or do you not know what RVM is? Run <span class="monospaced">sudo -H -s</span>
|
1983
1984
|
</p>
|
1984
1985
|
</li>
|
1985
1986
|
<li>
|
@@ -2041,7 +2042,7 @@ First, download the <strong>license key</strong> from the <a href="https://www.p
|
|
2041
2042
|
</div>
|
2042
2043
|
</div>
|
2043
2044
|
<div class="paragraph"><p>Substitute <em>YOUR_DOWNLOAD_TOKEN</em> with the one you find in the <a href="https://www.phusionpassenger.com/orders">Customer Area</a>. And notice the <strong>trailing slash</strong> in the URL! It is very important.</p></div>
|
2044
|
-
<div class="paragraph"><p>Finally, install the latest gem to obtain the files for the latest stable version of
|
2045
|
+
<div class="paragraph"><p>Finally, install the latest gem to obtain the files for the latest stable version of Passenger Enterprise:</p></div>
|
2045
2046
|
<div class="listingblock">
|
2046
2047
|
<div class="content monospaced">
|
2047
2048
|
<pre>gem install passenger-enterprise-server</pre>
|
@@ -2339,11 +2340,15 @@ gpg: Good signature from "Phusion Software Signing <software-signing@phusion.
|
|
2339
2340
|
</div>
|
2340
2341
|
</div>
|
2341
2342
|
<div class="sect3">
|
2342
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="
|
2343
|
-
<div class="paragraph"><p>
|
2343
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_verifying_debian_packages"></span><h4 data-comment-topic="verifying-deb-and-rpm-packages-1ed36d5" data-anchor="_verifying_debian_packages">2.9.6. Verifying Debian packages</h4>
|
2344
|
+
<div class="paragraph"><p>Our <a href="#install_on_debian_ubuntu">APT repository</a> is signed by Phusion Automated Software Signing (<a href="mailto:auto-software-signing@phusion.nl">auto-software-signing@phusion.nl</a>). Packages are automatically checked upon installation.</p></div>
|
2344
2345
|
</div>
|
2345
2346
|
<div class="sect3">
|
2346
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="
|
2347
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_verifying_rpm_packages"></span><h4 data-comment-topic="verifying-rpm-packages-1wwblzx" data-anchor="_verifying_rpm_packages">2.9.7. Verifying RPM packages</h4>
|
2348
|
+
<div class="paragraph"><p>Our <a href="#installing_or_upgrading_on_red_hat">YUM repository</a> is signed by <a href="https://packagecloud.io">PackageCloud</a> (<a href="mailto:ops@packagecloud.io">ops@packagecloud.io</a>). PackageCloud is the RPM package hosting service that we use. You can find their key <a href="https://packagecloud.io/gpg.key">here</a>. Packages are automatically checked upon installation.</p></div>
|
2349
|
+
</div>
|
2350
|
+
<div class="sect3">
|
2351
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_revocation"></span><h4 data-comment-topic="revocation-xwvhea" data-anchor="_revocation">2.9.8. Revocation</h4>
|
2347
2352
|
<div class="paragraph"><p>In the event our key is compromised, we will revoke the key and upload the revocation information to sks-servers.net and keyserver.ubuntu.com. However your system will not know about the revocation until you update the keys from the keyservers. You should update your keys regularly (e.g. once a week) by invoking:</p></div>
|
2348
2353
|
<div class="listingblock">
|
2349
2354
|
<div class="content monospaced">
|
@@ -4221,6 +4226,14 @@ In an <em>if</em> configuration scope.
|
|
4221
4226
|
</li>
|
4222
4227
|
</ul></div>
|
4223
4228
|
<div class="paragraph"><p>In each place, it may be specified at most once. The default value is <em>off</em>.</p></div>
|
4229
|
+
<div class="admonitionblock">
|
4230
|
+
<table><tr>
|
4231
|
+
<td class="icon">
|
4232
|
+
<img src="./images/icons/note.png" alt="Note">
|
4233
|
+
</td>
|
4234
|
+
<td class="content">Are you looking to prevent applications from being restarted when you restart Nginx? That is handled by the <a href="#flying_passenger">Flying Passenger mode</a>, not by the rolling restarts feature.</td>
|
4235
|
+
</tr></table>
|
4236
|
+
</div>
|
4224
4237
|
</div>
|
4225
4238
|
<div class="sect3">
|
4226
4239
|
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="PassengerResistDeploymentErrors"></span><h4 data-comment-topic="passenger-resist-deployment-errors-on-off--k9yf1" data-anchor="PassengerResistDeploymentErrors">7.3.16. passenger_resist_deployment_errors <on|off></h4>
|
@@ -58,9 +58,11 @@
|
|
58
58
|
|
59
59
|
2.9.5. Verifying Git signatures => verifying-git-signatures-dyo4fk
|
60
60
|
|
61
|
-
2.9.6. Verifying
|
61
|
+
2.9.6. Verifying Debian packages => verifying-deb-and-rpm-packages-1ed36d5
|
62
62
|
|
63
|
-
2.9.7.
|
63
|
+
2.9.7. Verifying RPM packages => verifying-rpm-packages-1wwblzx
|
64
|
+
|
65
|
+
2.9.8. Revocation => revocation-xwvhea
|
64
66
|
|
65
67
|
2.10. Non-interactive, automatic, headless installs or upgrades => non-interactive-automatic-headless-installs-or-upgrades-834ymv
|
66
68
|
|
data/doc/Users guide Nginx.txt
CHANGED
@@ -939,6 +939,8 @@ This option may occur in the following places:
|
|
939
939
|
|
940
940
|
In each place, it may be specified at most once. The default value is 'off'.
|
941
941
|
|
942
|
+
NOTE: Are you looking to prevent applications from being restarted when you restart Nginx? That is handled by the <<flying_passenger,Flying Passenger mode>>, not by the rolling restarts feature.
|
943
|
+
|
942
944
|
[[PassengerResistDeploymentErrors]]
|
943
945
|
==== passenger_resist_deployment_errors <on|off>
|
944
946
|
:version: 3.0.0
|
@@ -1118,8 +1118,9 @@ pre {
|
|
1118
1118
|
<div class="foo toclevel4"><a href="#_verifying_the_phusion_software_signing_key">2.9.3. Verifying the Phusion Software Signing key</a></div>
|
1119
1119
|
<div class="foo toclevel4"><a href="#_verifying_the_gem_and_tarball">2.9.4. Verifying the gem and tarball</a></div>
|
1120
1120
|
<div class="foo toclevel4"><a href="#_verifying_git_signatures">2.9.5. Verifying Git signatures</a></div>
|
1121
|
-
<div class="foo toclevel4"><a href="#
|
1122
|
-
<div class="foo toclevel4"><a href="#
|
1121
|
+
<div class="foo toclevel4"><a href="#_verifying_debian_packages">2.9.6. Verifying Debian packages</a></div>
|
1122
|
+
<div class="foo toclevel4"><a href="#_verifying_rpm_packages">2.9.7. Verifying RPM packages</a></div>
|
1123
|
+
<div class="foo toclevel4"><a href="#_revocation">2.9.8. Revocation</a></div>
|
1123
1124
|
<div class="foo toclevel3"><a href="#_customizing_the_compilation_process">2.10. Customizing the compilation process</a></div>
|
1124
1125
|
<div class="foo toclevel4"><a href="#_setting_the_compiler">2.10.1. Setting the compiler</a></div>
|
1125
1126
|
<div class="foo toclevel4"><a href="#_adding_additional_compiler_or_linker_flags">2.10.2. Adding additional compiler or linker flags</a></div>
|
@@ -1594,7 +1595,7 @@ Download the Passenger YUM repository definition.
|
|
1594
1595
|
<div class="listingblock">
|
1595
1596
|
<div class="content monospaced">
|
1596
1597
|
<pre>unset HISTFILE
|
1597
|
-
sudo curl --fail -
|
1598
|
+
sudo curl --fail -sSL -u download:YOUR_DOWNLOAD_TOKEN -o /etc/yum.repos.d/passenger.repo https://www.phusionpassenger.com/enterprise_yum/el-passenger-enterprise.repo</pre>
|
1598
1599
|
</div>
|
1599
1600
|
</div>
|
1600
1601
|
<div class="paragraph"><p>The <span class="monospaced">unset HISTFILE</span> command ensures that your download token isn’t saved to the Bash history file.</p></div>
|
@@ -1704,12 +1705,12 @@ Install the packages:
|
|
1704
1705
|
<div class="ulist"><ul>
|
1705
1706
|
<li>
|
1706
1707
|
<p>
|
1707
|
-
Are you using RVM? Run <span class="monospaced">rvmsudo -
|
1708
|
+
Are you using RVM? Run <span class="monospaced">rvmsudo -H bash</span>
|
1708
1709
|
</p>
|
1709
1710
|
</li>
|
1710
1711
|
<li>
|
1711
1712
|
<p>
|
1712
|
-
Are you not using RVM, or do you not know what RVM is? Run <span class="monospaced">sudo -s</span>
|
1713
|
+
Are you not using RVM, or do you not know what RVM is? Run <span class="monospaced">sudo -H -s</span>
|
1713
1714
|
</p>
|
1714
1715
|
</li>
|
1715
1716
|
<li>
|
@@ -1771,7 +1772,7 @@ First, download the <strong>license key</strong> from the <a href="https://www.p
|
|
1771
1772
|
</div>
|
1772
1773
|
</div>
|
1773
1774
|
<div class="paragraph"><p>Substitute <em>YOUR_DOWNLOAD_TOKEN</em> with the one you find in the <a href="https://www.phusionpassenger.com/orders">Customer Area</a>. And notice the <strong>trailing slash</strong> in the URL! It is very important.</p></div>
|
1774
|
-
<div class="paragraph"><p>Finally, install the latest gem to obtain the files for the latest stable version of
|
1775
|
+
<div class="paragraph"><p>Finally, install the latest gem to obtain the files for the latest stable version of Passenger Enterprise:</p></div>
|
1775
1776
|
<div class="listingblock">
|
1776
1777
|
<div class="content monospaced">
|
1777
1778
|
<pre>gem install passenger-enterprise-server</pre>
|
@@ -1979,11 +1980,15 @@ gpg: Good signature from "Phusion Software Signing <software-signing@phusion.
|
|
1979
1980
|
</div>
|
1980
1981
|
</div>
|
1981
1982
|
<div class="sect3">
|
1982
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="
|
1983
|
-
<div class="paragraph"><p>
|
1983
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_verifying_debian_packages"></span><h4 data-comment-topic="verifying-deb-and-rpm-packages-uga0ho" data-anchor="_verifying_debian_packages">2.9.6. Verifying Debian packages</h4>
|
1984
|
+
<div class="paragraph"><p>Our <a href="#install_on_debian_ubuntu">APT repository</a> is signed by Phusion Automated Software Signing (<a href="mailto:auto-software-signing@phusion.nl">auto-software-signing@phusion.nl</a>). Packages are automatically checked upon installation.</p></div>
|
1984
1985
|
</div>
|
1985
1986
|
<div class="sect3">
|
1986
|
-
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="
|
1987
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_verifying_rpm_packages"></span><h4 data-comment-topic="verifying-rpm-packages-1m745i5" data-anchor="_verifying_rpm_packages">2.9.7. Verifying RPM packages</h4>
|
1988
|
+
<div class="paragraph"><p>Our <a href="#installing_or_upgrading_on_red_hat">YUM repository</a> is signed by <a href="https://packagecloud.io">PackageCloud</a> (<a href="mailto:ops@packagecloud.io">ops@packagecloud.io</a>). PackageCloud is the RPM package hosting service that we use. You can find their key <a href="https://packagecloud.io/gpg.key">here</a>. Packages are automatically checked upon installation.</p></div>
|
1989
|
+
</div>
|
1990
|
+
<div class="sect3">
|
1991
|
+
<a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_revocation"></span><h4 data-comment-topic="revocation-ukzeg9" data-anchor="_revocation">2.9.8. Revocation</h4>
|
1987
1992
|
<div class="paragraph"><p>In the event our key is compromised, we will revoke the key and upload the revocation information to sks-servers.net and keyserver.ubuntu.com. However your system will not know about the revocation until you update the keys from the keyservers. You should update your keys regularly (e.g. once a week) by invoking:</p></div>
|
1988
1993
|
<div class="listingblock">
|
1989
1994
|
<div class="content monospaced">
|
@@ -56,9 +56,11 @@
|
|
56
56
|
|
57
57
|
2.9.5. Verifying Git signatures => verifying-git-signatures-dltpan
|
58
58
|
|
59
|
-
2.9.6. Verifying
|
59
|
+
2.9.6. Verifying Debian packages => verifying-deb-and-rpm-packages-uga0ho
|
60
60
|
|
61
|
-
2.9.7.
|
61
|
+
2.9.7. Verifying RPM packages => verifying-rpm-packages-1m745i5
|
62
|
+
|
63
|
+
2.9.8. Revocation => revocation-ukzeg9
|
62
64
|
|
63
65
|
2.10. Customizing the compilation process => customizing-the-compilation-process-j4xj2t
|
64
66
|
|
@@ -290,7 +290,7 @@ sudo curl --fail -sSLo /etc/yum.repos.d/passenger.repo https://oss-binaries.phus
|
|
290
290
|
+
|
291
291
|
--------------------------------------------------------------
|
292
292
|
unset HISTFILE
|
293
|
-
sudo curl --fail -
|
293
|
+
sudo curl --fail -sSL -u download:YOUR_DOWNLOAD_TOKEN -o /etc/yum.repos.d/passenger.repo https://www.phusionpassenger.com/enterprise_yum/el-passenger-enterprise.repo
|
294
294
|
--------------------------------------------------------------
|
295
295
|
+
|
296
296
|
The `unset HISTFILE` command ensures that your download token isn't saved to the Bash history file.
|
@@ -423,8 +423,8 @@ which ruby
|
|
423
423
|
|
424
424
|
Do you see a filename that references '/home' or '/Users'? If so then your Ruby interpreter is installed in your home directory and you can proceed to step 2. Otherwise, you need to switch to a root prompt by running one of the following commands:
|
425
425
|
|
426
|
-
* Are you using RVM? Run `rvmsudo -
|
427
|
-
* Are you not using RVM, or do you not know what RVM is? Run `sudo -s`
|
426
|
+
* Are you using RVM? Run `rvmsudo -H bash`
|
427
|
+
* Are you not using RVM, or do you not know what RVM is? Run `sudo -H -s`
|
428
428
|
* Is 'sudo' not installed on your system? Run `su -c bash`
|
429
429
|
|
430
430
|
You must maintain this root prompt throughout this installation guide.
|
@@ -471,7 +471,7 @@ gem source --add https://download:YOUR_DOWNLOAD_TOKEN@www.phusionpassenger.com/e
|
|
471
471
|
+
|
472
472
|
Substitute 'YOUR_DOWNLOAD_TOKEN' with the one you find in the link:https://www.phusionpassenger.com/orders[Customer Area]. And notice the **trailing slash** in the URL! It is very important.
|
473
473
|
+
|
474
|
-
Finally, install the latest gem to obtain the files for the latest stable version of
|
474
|
+
Finally, install the latest gem to obtain the files for the latest stable version of Passenger Enterprise:
|
475
475
|
+
|
476
476
|
----------------------
|
477
477
|
gem install passenger-enterprise-server
|
@@ -731,9 +731,13 @@ gpg: Signature made Mon Mar 11 10:12:02 2013 CET using RSA key ID 0A212A8C
|
|
731
731
|
gpg: Good signature from "Phusion Software Signing <software-signing@phusion.nl>"
|
732
732
|
-------------------------------------------------------
|
733
733
|
|
734
|
-
==== Verifying
|
734
|
+
==== Verifying Debian packages
|
735
735
|
|
736
|
-
|
736
|
+
Our <<install_on_debian_ubuntu,APT repository>> is signed by Phusion Automated Software Signing (auto-software-signing@phusion.nl). Packages are automatically checked upon installation.
|
737
|
+
|
738
|
+
==== Verifying RPM packages
|
739
|
+
|
740
|
+
Our <<installing_or_upgrading_on_red_hat,YUM repository>> is signed by link:https://packagecloud.io[PackageCloud] (ops@packagecloud.io). PackageCloud is the RPM package hosting service that we use. You can find their key link:https://packagecloud.io/gpg.key[here]. Packages are automatically checked upon installation.
|
737
741
|
|
738
742
|
==== Revocation
|
739
743
|
|
data/ext/apache2/Hooks.cpp
CHANGED
@@ -617,8 +617,20 @@ private:
|
|
617
617
|
char backendData[MAX_STRING_LEN];
|
618
618
|
Timer timer;
|
619
619
|
getsfunc_BRIGADE(backendData, MAX_STRING_LEN, bb);
|
620
|
+
|
621
|
+
// The bucket brigade is an interface to the HTTP response sent by the
|
622
|
+
// PassengerAgent. The scanner parses (line by line) response headers
|
623
|
+
// into error_headers_out (mostly) as well as headers_out.
|
620
624
|
ret = ap_scan_script_header_err_brigade(r, bb, backendData);
|
621
625
|
|
626
|
+
// The PassengerAgent sets the Connection: close header because it wants
|
627
|
+
// the bb connection closed, but because we fed everything to the
|
628
|
+
// ap_scan_script it will also be set in the response to the client and
|
629
|
+
// that breaks HTTP 1.1 keep-alive, so unset it.
|
630
|
+
apr_table_unset(r->err_headers_out, "Connection");
|
631
|
+
// It's undefined in which of the tables it ends up in, so unset on both.
|
632
|
+
apr_table_unset(r->headers_out, "Connection");
|
633
|
+
|
622
634
|
if (ret == OK) {
|
623
635
|
// The API documentation for ap_scan_script_err_brigade() says it
|
624
636
|
// returns HTTP_OK on success, but it actually returns OK.
|
@@ -783,8 +795,7 @@ private:
|
|
783
795
|
char *buffer, size_t bufsize) const
|
784
796
|
{
|
785
797
|
assert(bufsize > headerSize);
|
786
|
-
|
787
|
-
convertLowerCase((unsigned char *) buffer, headerSize);
|
798
|
+
convertLowerCase((const unsigned char *) header, (unsigned char *) buffer, headerSize);
|
788
799
|
buffer[headerSize] = '\0';
|
789
800
|
return strstr(buffer, "upgrade");
|
790
801
|
}
|
@@ -55,9 +55,14 @@ void inspectProcessList(const InspectOptions &options, stringstream &result,
|
|
55
55
|
char cpubuf[10];
|
56
56
|
char membuf[10];
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
(
|
58
|
+
if (process->metrics.isValid()) {
|
59
|
+
snprintf(cpubuf, sizeof(cpubuf), "%d%%", (int) process->metrics.cpu);
|
60
|
+
snprintf(membuf, sizeof(membuf), "%ldM",
|
61
|
+
(unsigned long) (process->metrics.realMemory() / 1024));
|
62
|
+
} else {
|
63
|
+
snprintf(cpubuf, sizeof(cpubuf), "0%%");
|
64
|
+
snprintf(membuf, sizeof(membuf), "0M");
|
65
|
+
}
|
61
66
|
snprintf(buf, sizeof(buf),
|
62
67
|
" * PID: %-5lu Sessions: %-2u Processed: %-5u Uptime: %s\n"
|
63
68
|
" CPU: %-5s Memory : %-5s Last used: %s ago",
|
@@ -23,16 +23,65 @@
|
|
23
23
|
* THE SOFTWARE.
|
24
24
|
*/
|
25
25
|
#include <cstdlib>
|
26
|
+
#include <cerrno>
|
27
|
+
#include <cassert>
|
26
28
|
#include <boost/bind.hpp>
|
27
29
|
#include <boost/make_shared.hpp>
|
30
|
+
#include <boost/scoped_ptr.hpp>
|
28
31
|
#include <oxt/thread.hpp>
|
29
|
-
#include <
|
30
|
-
#include <
|
32
|
+
#include <oxt/backtrace.hpp>
|
33
|
+
#include <oxt/system_calls.hpp>
|
34
|
+
#include <oxt/detail/context.hpp>
|
35
|
+
#include <ev.h>
|
36
|
+
#include <uv.h>
|
31
37
|
#include <BackgroundEventLoop.h>
|
32
38
|
#include <Logging.h>
|
33
39
|
#include <Exceptions.h>
|
34
40
|
#include <SafeLibev.h>
|
35
41
|
|
42
|
+
#ifndef HAVE_KQUEUE
|
43
|
+
#if defined(__APPLE__) || \
|
44
|
+
defined(__DragonFly__) || \
|
45
|
+
defined(__FreeBSD__) || \
|
46
|
+
defined(__OpenBSD__) || \
|
47
|
+
defined(__NetBSD__)
|
48
|
+
#define HAVE_KQUEUE 1
|
49
|
+
#endif
|
50
|
+
#endif
|
51
|
+
|
52
|
+
#ifndef HAVE_EPOLL
|
53
|
+
#ifdef __linux__
|
54
|
+
#define HAVE_EPOLL 1
|
55
|
+
#endif
|
56
|
+
#endif
|
57
|
+
|
58
|
+
#ifndef HAVE_POLLSET
|
59
|
+
#ifdef __AIX
|
60
|
+
#define HAVE_POLLSET 1
|
61
|
+
#endif
|
62
|
+
#endif
|
63
|
+
|
64
|
+
#ifndef HAVE_EVENT_PORTS
|
65
|
+
#if defined(sun) || defined(__sun)
|
66
|
+
#define HAVE_EVENT_PORTS
|
67
|
+
#endif
|
68
|
+
#endif
|
69
|
+
|
70
|
+
#if defined(HAVE_KQUEUE)
|
71
|
+
#include <sys/types.h>
|
72
|
+
#include <sys/event.h>
|
73
|
+
#include <sys/time.h>
|
74
|
+
#elif defined(HAVE_EPOLL)
|
75
|
+
#include <sys/epoll.h>
|
76
|
+
#elif defined(HAVE_POLLSET)
|
77
|
+
#include <sys/poll.h>
|
78
|
+
#include <sys/pollset.h>
|
79
|
+
#include <sys/fcntl.h>
|
80
|
+
#elif defined(HAVE_EVENT_PORTS)
|
81
|
+
#include <port.h>
|
82
|
+
#endif
|
83
|
+
|
84
|
+
|
36
85
|
namespace Passenger {
|
37
86
|
|
38
87
|
using namespace std;
|
@@ -41,126 +90,259 @@ using namespace oxt;
|
|
41
90
|
|
42
91
|
|
43
92
|
struct BackgroundEventLoopPrivate {
|
93
|
+
struct ev_async exitSignaller;
|
94
|
+
struct ev_async libuvActivitySignaller;
|
95
|
+
uv_loop_t libuv_loop;
|
96
|
+
/**
|
97
|
+
* Coordinates communication between the libuv poller thread and the
|
98
|
+
* libuv activity callback (the latter which runs on the libevent thread.
|
99
|
+
*/
|
100
|
+
uv_sem_t libuv_sem;
|
101
|
+
/**
|
102
|
+
* This timer doesn't do anything. It only exists to prevent
|
103
|
+
* uv_backend_timeout() from returning 0, which would make the
|
104
|
+
* libuv poller thread use 100% CPU.
|
105
|
+
*/
|
106
|
+
uv_timer_t libuv_timer;
|
107
|
+
|
44
108
|
oxt::thread *thr;
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
bool useLibeio;
|
109
|
+
oxt::thread *libuvPollerThr;
|
110
|
+
uv_barrier_t startBarrier;
|
111
|
+
|
112
|
+
bool usesLibuv;
|
50
113
|
bool started;
|
51
114
|
};
|
52
115
|
|
53
|
-
static BackgroundEventLoop *eioInstanceData = NULL;
|
54
|
-
|
55
116
|
|
56
117
|
static void
|
57
|
-
|
118
|
+
signalLibevExit(struct ev_loop *loop, ev_async *async, int revents) {
|
58
119
|
BackgroundEventLoop *bg = (BackgroundEventLoop *) async->data;
|
59
|
-
|
120
|
+
if (bg->priv->usesLibuv) {
|
121
|
+
ev_async_stop(bg->libev_loop, &bg->priv->libuvActivitySignaller);
|
122
|
+
}
|
123
|
+
ev_async_stop(bg->libev_loop, &bg->priv->exitSignaller);
|
124
|
+
ev_break(bg->libev_loop, EVBREAK_ALL);
|
125
|
+
if (bg->priv->usesLibuv) {
|
126
|
+
uv_timer_stop(&bg->priv->libuv_timer);
|
127
|
+
uv_run(bg->libuv_loop, UV_RUN_NOWAIT);
|
128
|
+
}
|
60
129
|
}
|
61
130
|
|
62
131
|
static void
|
63
|
-
|
64
|
-
|
65
|
-
bg->
|
66
|
-
bg->priv->
|
67
|
-
bg->priv->cond.notify_all();
|
68
|
-
l.unlock();
|
69
|
-
ev_run(bg->loop, 0);
|
132
|
+
onLibuvActivity(struct ev_loop *loop, ev_async *async, int revents) {
|
133
|
+
BackgroundEventLoop *bg = (BackgroundEventLoop *) async->data;
|
134
|
+
uv_run(bg->libuv_loop, UV_RUN_NOWAIT);
|
135
|
+
uv_sem_post(&bg->priv->libuv_sem);
|
70
136
|
}
|
71
137
|
|
72
138
|
static void
|
73
|
-
|
74
|
-
|
75
|
-
ev_idle_stop(EV_A_ w);
|
76
|
-
}
|
139
|
+
doNothing(uv_timer_t *timer) {
|
140
|
+
// Do nothing
|
77
141
|
}
|
78
142
|
|
79
|
-
/* eio has some results, process them */
|
80
143
|
static void
|
81
|
-
|
82
|
-
|
83
|
-
|
144
|
+
runBackgroundLoop(BackgroundEventLoop *bg) {
|
145
|
+
bg->safe->setCurrentThread();
|
146
|
+
if (bg->priv->usesLibuv) {
|
147
|
+
uv_timer_start(&bg->priv->libuv_timer, doNothing, 99999000, 99999000);
|
148
|
+
uv_run(bg->libuv_loop, UV_RUN_NOWAIT);
|
84
149
|
}
|
150
|
+
uv_barrier_wait(&bg->priv->startBarrier);
|
151
|
+
ev_run(bg->libev_loop, 0);
|
85
152
|
}
|
86
153
|
|
87
|
-
/* wake up the event loop */
|
88
154
|
static void
|
89
|
-
|
90
|
-
|
155
|
+
pollLibuv(BackgroundEventLoop *bg) {
|
156
|
+
uv_barrier_wait(&bg->priv->startBarrier);
|
157
|
+
|
158
|
+
int ret;
|
159
|
+
int fd;
|
160
|
+
int timeout;
|
161
|
+
int lastErrno;
|
162
|
+
bool intrRequested = false;
|
163
|
+
oxt::thread_local_context *ctx = oxt::get_thread_local_context();
|
164
|
+
assert(ctx != NULL);
|
165
|
+
|
166
|
+
fd = uv_backend_fd(&bg->priv->libuv_loop);
|
167
|
+
|
168
|
+
while (!this_thread::interruption_requested()) {
|
169
|
+
timeout = uv_backend_timeout(&bg->priv->libuv_loop);
|
170
|
+
|
171
|
+
ctx->syscall_interruption_lock.unlock();
|
172
|
+
|
173
|
+
do {
|
174
|
+
#if defined(HAVE_KQUEUE)
|
175
|
+
struct timespec ts;
|
176
|
+
struct kevent event;
|
177
|
+
|
178
|
+
ts.tv_sec = timeout / 1000;
|
179
|
+
ts.tv_nsec = (timeout % 1000) * 1000000;
|
180
|
+
|
181
|
+
ret = kevent(fd, NULL, 0, &event, 1, (timeout == -1) ? NULL : &ts);
|
182
|
+
#elif defined(HAVE_EPOLL)
|
183
|
+
struct epoll_event ev;
|
184
|
+
ret = epoll_wait(fd, &ev, 1, timeout);
|
185
|
+
#elif defined(HAVE_POLLSET)
|
186
|
+
struct pollfd event;
|
187
|
+
ret = pollset_poll(fd, &event, 1, timeout);
|
188
|
+
#elif defined(HAVE_EVENT_PORTS)
|
189
|
+
struct timespec ts;
|
190
|
+
struct port_event event;
|
191
|
+
|
192
|
+
ts.tv_sec = timeout / 1000;
|
193
|
+
ts.tv_nsec = (timeout % 1000) * 1000000;
|
194
|
+
|
195
|
+
ret = port_get(fd, &event, (timeout == -1) ? NULL : &ts);
|
196
|
+
#else
|
197
|
+
#error "This platform is not supported. Please add corresponding I/O polling code."
|
198
|
+
#endif
|
199
|
+
|
200
|
+
lastErrno = errno;
|
201
|
+
} while (ret == -1
|
202
|
+
&& lastErrno == EINTR
|
203
|
+
&& (!boost::this_thread::syscalls_interruptable()
|
204
|
+
|| !(intrRequested = this_thread::interruption_requested())));
|
205
|
+
|
206
|
+
ctx->syscall_interruption_lock.lock();
|
207
|
+
|
208
|
+
if (ret == -1
|
209
|
+
&& lastErrno == EINTR
|
210
|
+
&& this_thread::syscalls_interruptable()
|
211
|
+
&& intrRequested)
|
212
|
+
{
|
213
|
+
throw boost::thread_interrupted();
|
214
|
+
}
|
215
|
+
|
216
|
+
ev_async_send(bg->libev_loop, &bg->priv->libuvActivitySignaller);
|
217
|
+
uv_sem_wait(&bg->priv->libuv_sem);
|
218
|
+
}
|
91
219
|
}
|
92
220
|
|
93
|
-
BackgroundEventLoop::BackgroundEventLoop(bool scalable, bool
|
221
|
+
BackgroundEventLoop::BackgroundEventLoop(bool scalable, bool usesLibuv)
|
222
|
+
: libev_loop(NULL),
|
223
|
+
libuv_loop(NULL),
|
224
|
+
priv(NULL)
|
225
|
+
{
|
226
|
+
struct Guard {
|
227
|
+
BackgroundEventLoop *self;
|
228
|
+
|
229
|
+
Guard(BackgroundEventLoop *_self)
|
230
|
+
: self(_self)
|
231
|
+
{ }
|
232
|
+
|
233
|
+
~Guard() {
|
234
|
+
if (self != NULL) {
|
235
|
+
if (self->libev_loop != NULL) {
|
236
|
+
ev_loop_destroy(self->libev_loop);
|
237
|
+
}
|
238
|
+
if (self->libuv_loop != NULL) {
|
239
|
+
uv_loop_close(self->libuv_loop);
|
240
|
+
}
|
241
|
+
delete self->priv;
|
242
|
+
}
|
243
|
+
}
|
244
|
+
|
245
|
+
void clear() {
|
246
|
+
self = NULL;
|
247
|
+
}
|
248
|
+
};
|
249
|
+
|
94
250
|
TRACE_POINT();
|
251
|
+
Guard guard(this);
|
252
|
+
|
253
|
+
priv = new BackgroundEventLoopPrivate();
|
95
254
|
|
96
255
|
if (scalable) {
|
97
|
-
|
98
|
-
if (
|
99
|
-
|
256
|
+
libev_loop = ev_loop_new(EVBACKEND_KQUEUE);
|
257
|
+
if (libev_loop == NULL) {
|
258
|
+
libev_loop = ev_loop_new(EVBACKEND_EPOLL);
|
100
259
|
}
|
101
|
-
if (
|
102
|
-
|
260
|
+
if (libev_loop == NULL) {
|
261
|
+
libev_loop = ev_loop_new(EVFLAG_AUTO);
|
103
262
|
}
|
104
263
|
} else {
|
105
|
-
|
264
|
+
libev_loop = ev_loop_new(EVBACKEND_POLL);
|
106
265
|
}
|
107
|
-
if (
|
108
|
-
throw RuntimeException("Cannot create
|
266
|
+
if (libev_loop == NULL) {
|
267
|
+
throw RuntimeException("Cannot create a libev event loop");
|
109
268
|
}
|
110
269
|
|
111
|
-
P_LOG_FILE_DESCRIPTOR_OPEN2(ev_backend_fd(
|
270
|
+
P_LOG_FILE_DESCRIPTOR_OPEN2(ev_backend_fd(libev_loop), "libev event loop: backend FD");
|
112
271
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
priv
|
121
|
-
priv->thr = NULL;
|
122
|
-
priv->useLibeio = useLibeio;
|
123
|
-
priv->started = false;
|
272
|
+
ev_async_init(&priv->exitSignaller, signalLibevExit);
|
273
|
+
ev_async_start(libev_loop, &priv->exitSignaller);
|
274
|
+
P_LOG_FILE_DESCRIPTOR_OPEN2(ev_loop_get_pipe(libev_loop, 0), "libev event loop: async pipe 0");
|
275
|
+
P_LOG_FILE_DESCRIPTOR_OPEN2(ev_loop_get_pipe(libev_loop, 1), "libev event loop: async pipe 1");
|
276
|
+
priv->exitSignaller.data = this;
|
277
|
+
safe = boost::make_shared<SafeLibev>(libev_loop);
|
278
|
+
|
279
|
+
uv_barrier_init(&priv->startBarrier, usesLibuv ? 3 : 2);
|
124
280
|
|
125
|
-
if (
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
281
|
+
if (usesLibuv) {
|
282
|
+
ev_async_init(&priv->libuvActivitySignaller, onLibuvActivity);
|
283
|
+
ev_async_start(libev_loop, &priv->libuvActivitySignaller);
|
284
|
+
priv->libuvActivitySignaller.data = this;
|
285
|
+
|
286
|
+
libuv_loop = &priv->libuv_loop;
|
287
|
+
uv_loop_init(&priv->libuv_loop);
|
288
|
+
uv_timer_init(&priv->libuv_loop, &priv->libuv_timer);
|
289
|
+
uv_sem_init(&priv->libuv_sem, 0);
|
290
|
+
P_LOG_FILE_DESCRIPTOR_OPEN2(uv_backend_fd(libuv_loop), "libuv event loop: backend");
|
291
|
+
P_LOG_FILE_DESCRIPTOR_OPEN2(libuv_loop->signal_pipefd[0], "libuv event loop: signal pipe 0");
|
292
|
+
P_LOG_FILE_DESCRIPTOR_OPEN2(libuv_loop->signal_pipefd[1], "libuv event loop: signal pipe 1");
|
131
293
|
}
|
294
|
+
|
295
|
+
priv->thr = NULL;
|
296
|
+
priv->libuvPollerThr = NULL;
|
297
|
+
priv->usesLibuv = usesLibuv;
|
298
|
+
priv->started = false;
|
299
|
+
guard.clear();
|
132
300
|
}
|
133
301
|
|
134
302
|
BackgroundEventLoop::~BackgroundEventLoop() {
|
135
303
|
stop();
|
136
|
-
if (priv->
|
137
|
-
|
138
|
-
|
139
|
-
|
304
|
+
if (priv->usesLibuv) {
|
305
|
+
while (uv_loop_alive(libuv_loop)) {
|
306
|
+
uv_run(libuv_loop, UV_RUN_NOWAIT);
|
307
|
+
syscalls::usleep(10000);
|
308
|
+
}
|
309
|
+
uv_sem_destroy(&priv->libuv_sem);
|
310
|
+
P_LOG_FILE_DESCRIPTOR_CLOSE(uv_backend_fd(libuv_loop));
|
311
|
+
P_LOG_FILE_DESCRIPTOR_CLOSE(libuv_loop->signal_pipefd[0]);
|
312
|
+
P_LOG_FILE_DESCRIPTOR_CLOSE(libuv_loop->signal_pipefd[1]);
|
313
|
+
uv_loop_close(libuv_loop);
|
140
314
|
}
|
141
|
-
|
315
|
+
uv_barrier_destroy(&priv->startBarrier);
|
142
316
|
delete priv;
|
143
|
-
free(async);
|
144
317
|
}
|
145
318
|
|
146
319
|
void
|
147
320
|
BackgroundEventLoop::start(const string &threadName, unsigned int stackSize) {
|
148
321
|
assert(priv->thr == NULL);
|
149
|
-
boost::unique_lock<boost::mutex> l(priv->lock);
|
150
322
|
priv->thr = new oxt::thread(
|
151
|
-
boost::bind(
|
323
|
+
boost::bind(runBackgroundLoop, this),
|
152
324
|
threadName,
|
153
325
|
stackSize
|
154
326
|
);
|
155
|
-
|
156
|
-
priv->
|
327
|
+
if (priv->usesLibuv) {
|
328
|
+
priv->libuvPollerThr = new oxt::thread(
|
329
|
+
boost::bind(pollLibuv, this),
|
330
|
+
threadName + ": libuv poller",
|
331
|
+
1024 * 512
|
332
|
+
);
|
157
333
|
}
|
334
|
+
uv_barrier_wait(&priv->startBarrier);
|
158
335
|
}
|
159
336
|
|
160
337
|
void
|
161
338
|
BackgroundEventLoop::stop() {
|
162
339
|
if (priv->thr != NULL) {
|
163
|
-
|
340
|
+
if (priv->usesLibuv) {
|
341
|
+
priv->libuvPollerThr->interrupt_and_join();
|
342
|
+
delete priv->libuvPollerThr;
|
343
|
+
priv->libuvPollerThr = NULL;
|
344
|
+
}
|
345
|
+
ev_async_send(libev_loop, &priv->exitSignaller);
|
164
346
|
priv->thr->join();
|
165
347
|
delete priv->thr;
|
166
348
|
priv->thr = NULL;
|