passenger 3.0.11 → 3.0.12
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/NEWS +18 -1
- data/bin/passenger-install-apache2-module +2 -2
- data/bin/passenger-install-nginx-module +2 -1
- data/build/config.rb +2 -2
- data/configure +10 -0
- data/doc/Users guide Apache.html +5 -5
- data/doc/Users guide Nginx.html +7 -7
- data/doc/Users guide Nginx.txt +2 -2
- data/doc/Users guide Standalone.html +1 -1
- data/doc/users_guide_snippets/appendix_c_spawning_methods.txt +4 -4
- data/ext/apache2/Hooks.cpp +25 -14
- data/ext/apache2/mod_passenger.c +1 -1
- data/ext/common/Constants.h +2 -2
- data/ext/common/FileDescriptor.h +5 -6
- data/ext/common/Process.h +2 -3
- data/ext/common/Utils.cpp +9 -9
- data/ext/common/Utils.h +1 -1
- data/ext/common/Utils/IOUtils.cpp +15 -41
- data/ext/common/Utils/IOUtils.h +8 -2
- data/ext/common/Utils/MessageIO.h +1 -1
- data/ext/common/Watchdog.cpp +72 -31
- data/ext/nginx/Configuration.c +2 -0
- data/ext/nginx/ContentHandler.c +11 -3
- data/ext/oxt/detail/backtrace_enabled.hpp +2 -2
- data/ext/oxt/system_calls.cpp +39 -6
- data/lib/phusion_passenger.rb +4 -4
- data/lib/phusion_passenger/packaging.rb +3 -2
- data/lib/phusion_passenger/platform_info/apache.rb +12 -1
- data/lib/phusion_passenger/platform_info/ruby.rb +1 -1
- data/lib/phusion_passenger/templates/apache2/apache_must_be_compiled_with_compatible_mpm.txt.erb +5 -5
- data/lib/phusion_passenger/templates/apache2/deployment_example.txt.erb +6 -3
- data/test/stub/apache2/httpd.conf.erb +13 -2
- data/test/stub/wsgi/passenger_wsgi.pyc +0 -0
- metadata +6 -8
- data/doc/Users guide Apache.idmap.txt +0 -80
data/NEWS
CHANGED
@@ -1,8 +1,25 @@
|
|
1
|
+
Release 3.0.12
|
2
|
+
--------------
|
3
|
+
|
4
|
+
* [Apache] Support Apache 2.4. The event MPM is now also supported.
|
5
|
+
* [Nginx] Preferred Nginx version upgraded to 1.0.15.
|
6
|
+
* [Nginx] Preferred PCRE version upgraded to 8.30.
|
7
|
+
* [Nginx] Fixed compatibility with Nginx < 1.0.10.
|
8
|
+
* [Nginx] Nginx is now installed with http_gzip_static_module by default.
|
9
|
+
* [Nginx] Fixed a memory disclosure security problem.
|
10
|
+
The issue is documented at http://www.nginx.org/en/security_advisories.html
|
11
|
+
and affects more modules than just Phusion Passenger. Users are advised
|
12
|
+
to upgrade as soon as possible. Patch submitted by Gregory Potamianos.
|
13
|
+
* [Nginx] passenger_show_version_in_header now hides the Phusion Passenger version number from the 'Server:' header too.
|
14
|
+
Patch submitted by Gregory Potamianos.
|
15
|
+
* Fixed a /proc deprecation warning on Linux kernel >= 3.0.
|
16
|
+
|
17
|
+
|
1
18
|
Release 3.0.11
|
2
19
|
--------------
|
3
20
|
|
4
21
|
* Fixed a compilation problem on platforms without alloca.h, such as FreeBSD 7.
|
5
|
-
* Improved performance and
|
22
|
+
* Improved performance and solved some warnings on Xen systems by compiling
|
6
23
|
with `-mno-tls-direct-seg-refs`. Patch contributed by Michał Pokrywka.
|
7
24
|
|
8
25
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Phusion Passenger - http://www.modrails.com/
|
3
|
-
# Copyright (c) 2010 Phusion
|
3
|
+
# Copyright (c) 2010, 2011, 2012 Phusion
|
4
4
|
#
|
5
5
|
# "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
6
6
|
#
|
@@ -124,7 +124,7 @@ private
|
|
124
124
|
mpm = nil
|
125
125
|
end
|
126
126
|
end
|
127
|
-
if mpm != "prefork" && mpm != "worker"
|
127
|
+
if mpm != "prefork" && mpm != "worker" && mpm != "event"
|
128
128
|
new_screen
|
129
129
|
render_template 'apache2/apache_must_be_compiled_with_compatible_mpm',
|
130
130
|
:current_mpm => mpm
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Phusion Passenger - http://www.modrails.com/
|
3
|
-
# Copyright (c) 2010 Phusion
|
3
|
+
# Copyright (c) 2010, 2011, 2012 Phusion
|
4
4
|
#
|
5
5
|
# "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
6
6
|
#
|
@@ -392,6 +392,7 @@ private
|
|
392
392
|
def build_nginx_configure_command(prefix, extra_configure_flags = nil)
|
393
393
|
command = "sh ./configure --prefix='#{prefix}' "
|
394
394
|
command << "--with-http_ssl_module "
|
395
|
+
command << "--with-http_gzip_static_module "
|
395
396
|
command << "--with-cc-opt='-Wno-error' "
|
396
397
|
if @pcre_source_dir
|
397
398
|
command << "--with-pcre='#{@pcre_source_dir}' "
|
data/build/config.rb
CHANGED
@@ -33,7 +33,7 @@ end
|
|
33
33
|
|
34
34
|
# Extra compiler flags that should always be passed to the C/C++ compiler.
|
35
35
|
# Should be included last in the command string, even after PlatformInfo.portability_cflags.
|
36
|
-
EXTRA_CXXFLAGS = "-Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-long-long"
|
36
|
+
EXTRA_CXXFLAGS = "-Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-long-long"
|
37
37
|
EXTRA_CXXFLAGS << " -Wno-missing-field-initializers" if PlatformInfo.compiler_supports_wno_missing_field_initializers_flag?
|
38
38
|
EXTRA_CXXFLAGS << " -mno-tls-direct-seg-refs" if PlatformInfo.requires_no_tls_direct_seg_refs? && PlatformInfo.compiler_supports_no_tls_direct_seg_refs_option?
|
39
39
|
EXTRA_CXXFLAGS << " #{OPTIMIZATION_FLAGS}" if !OPTIMIZATION_FLAGS.empty?
|
@@ -43,4 +43,4 @@ EXTRA_CXXFLAGS << " #{OPTIMIZATION_FLAGS}" if !OPTIMIZATION_FLAGS.empty?
|
|
43
43
|
EXTRA_LDFLAGS = ""
|
44
44
|
|
45
45
|
# Whether to use the vendored libev or the system one.
|
46
|
-
USE_VENDORED_LIBEV = boolean_option("USE_VENDORED_LIBEV", true)
|
46
|
+
USE_VENDORED_LIBEV = boolean_option("USE_VENDORED_LIBEV", true)
|
data/configure
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
echo "This is not how you install Phusion Passenger! Please run one of:"
|
3
|
+
echo
|
4
|
+
echo " ./bin/passenger-install-apache2-module"
|
5
|
+
echo " ./bin/passenger-install-nginx-module"
|
6
|
+
echo
|
7
|
+
echo "When unsure, please consult the manual (see 'doc' directory)."
|
8
|
+
echo
|
9
|
+
echo "*** ABORTED"
|
10
|
+
exit 1
|
data/doc/Users guide Apache.html
CHANGED
@@ -4679,7 +4679,7 @@ gotchas you can easily reap the benefits of smart spawning.</p></div>
|
|
4679
4679
|
</div>
|
4680
4680
|
</div>
|
4681
4681
|
<div class="sect2">
|
4682
|
-
<h3 id="
|
4682
|
+
<h3 id="_smart_spawning_gotcha_1_unintentional_file_descriptor_sharing">12.3. Smart spawning gotcha #1: unintentional file descriptor sharing</h3>
|
4683
4683
|
<div class="paragraph"><p>Because worker processes are created by forking from an ApplicationSpawner
|
4684
4684
|
server, it will share all file descriptors that are opened by the
|
4685
4685
|
ApplicationSpawner server. (This is part of the semantics of the Unix
|
@@ -4688,7 +4688,7 @@ it.) A file descriptor is a handle which can be an opened file, an opened socket
|
|
4688
4688
|
connection, a pipe, etc. If different worker processes write to such a file
|
4689
4689
|
descriptor at the same time, then their write calls will be interleaved, which
|
4690
4690
|
may potentially cause problems.</p></div>
|
4691
|
-
<div class="paragraph"><p>The problem commonly involves socket connections that are
|
4691
|
+
<div class="paragraph"><p>The problem commonly involves socket connections that are unintentionally being
|
4692
4692
|
shared. You can fix it by closing and reestablishing the connection when Phusion
|
4693
4693
|
Passenger is creating a new worker process. Phusion Passenger provides the API
|
4694
4694
|
call <span class="monospaced">PhusionPassenger.on_event(:starting_worker_process)</span> to do so. So you
|
@@ -4754,7 +4754,7 @@ result is now as follows:</p></div>
|
|
4754
4754
|
| Worker process 2 |-----/
|
4755
4755
|
+--------------------+</pre>
|
4756
4756
|
</div></div>
|
4757
|
-
<div class="paragraph"><p>As you can see, Worker process 1 and Worker process 2 have the same
|
4757
|
+
<div class="paragraph"><p>As you can see, Worker process 1 and Worker process 2 have the same Memcached
|
4758
4758
|
connection.</p></div>
|
4759
4759
|
<div class="paragraph"><p>Suppose that users Joe and Jane visit your website at the same time. Joe’s
|
4760
4760
|
request is handled by Worker process 1, and Jane’s request is handled by Worker
|
@@ -4805,7 +4805,7 @@ http://www.gnu.org/software/src-highlite -->
|
|
4805
4805
|
</div>
|
4806
4806
|
<div class="sect3">
|
4807
4807
|
<h4 id="_example_2_log_file_sharing_not_harmful">12.3.2. Example 2: Log file sharing (not harmful)</h4>
|
4808
|
-
<div class="paragraph"><p>There are also cases in which
|
4808
|
+
<div class="paragraph"><p>There are also cases in which unintentional file descriptor sharing is not harmful.
|
4809
4809
|
One such case is log file file descriptor sharing. Even if two processes write
|
4810
4810
|
to the log file at the same time, the worst thing that can happen is that the
|
4811
4811
|
data in the log file is interleaved.</p></div>
|
@@ -4862,7 +4862,7 @@ has no effect.</p></div>
|
|
4862
4862
|
<div id="footnotes"><hr></div>
|
4863
4863
|
<div id="footer">
|
4864
4864
|
<div id="footer-text">
|
4865
|
-
Last updated
|
4865
|
+
Last updated 2012-02-03 23:25:41 CET
|
4866
4866
|
</div>
|
4867
4867
|
</div>
|
4868
4868
|
</body>
|
data/doc/Users guide Nginx.html
CHANGED
@@ -1050,7 +1050,7 @@ uninstalling the Phusion Passenger files, so that Nginx behaves as if Phusion
|
|
1050
1050
|
Passenger was never installed in the first place. This might be useful to you if,
|
1051
1051
|
for example, you seem to be experiencing a problem caused by Phusion Passenger,
|
1052
1052
|
but you want to make sure whether that’s actually the case, without having
|
1053
|
-
to through the hassle of uninstalling Phusion Passenger completely. When disabled,
|
1053
|
+
to go through the hassle of uninstalling Phusion Passenger completely. When disabled,
|
1054
1054
|
Phusion Passenger will not occupy any memory or CPU or otherwise interfere with
|
1055
1055
|
Nginx.</p></div>
|
1056
1056
|
<div class="paragraph"><p>To unload Phusion Passenger, edit your Nginx configuration file(s)
|
@@ -2459,7 +2459,7 @@ passenger_pre_start http://bar.com:3500/; # <--- added</pre>
|
|
2459
2459
|
rails_base_uri /store;
|
2460
2460
|
}</pre>
|
2461
2461
|
</div></div>
|
2462
|
-
<div class="paragraph"><p>Then specify the <em>server_name</em>
|
2462
|
+
<div class="paragraph"><p>Then specify the <em>server_name</em> value followed by the sub-URI, like this:</p></div>
|
2463
2463
|
<div class="listingblock">
|
2464
2464
|
<div class="content monospaced">
|
2465
2465
|
<pre>server {
|
@@ -3569,7 +3569,7 @@ gotchas you can easily reap the benefits of smart spawning.</p></div>
|
|
3569
3569
|
</div>
|
3570
3570
|
</div>
|
3571
3571
|
<div class="sect2">
|
3572
|
-
<h3 id="
|
3572
|
+
<h3 id="_smart_spawning_gotcha_1_unintentional_file_descriptor_sharing">11.3. Smart spawning gotcha #1: unintentional file descriptor sharing</h3>
|
3573
3573
|
<div class="paragraph"><p>Because worker processes are created by forking from an ApplicationSpawner
|
3574
3574
|
server, it will share all file descriptors that are opened by the
|
3575
3575
|
ApplicationSpawner server. (This is part of the semantics of the Unix
|
@@ -3578,7 +3578,7 @@ it.) A file descriptor is a handle which can be an opened file, an opened socket
|
|
3578
3578
|
connection, a pipe, etc. If different worker processes write to such a file
|
3579
3579
|
descriptor at the same time, then their write calls will be interleaved, which
|
3580
3580
|
may potentially cause problems.</p></div>
|
3581
|
-
<div class="paragraph"><p>The problem commonly involves socket connections that are
|
3581
|
+
<div class="paragraph"><p>The problem commonly involves socket connections that are unintentionally being
|
3582
3582
|
shared. You can fix it by closing and reestablishing the connection when Phusion
|
3583
3583
|
Passenger is creating a new worker process. Phusion Passenger provides the API
|
3584
3584
|
call <span class="monospaced">PhusionPassenger.on_event(:starting_worker_process)</span> to do so. So you
|
@@ -3644,7 +3644,7 @@ result is now as follows:</p></div>
|
|
3644
3644
|
| Worker process 2 |-----/
|
3645
3645
|
+--------------------+</pre>
|
3646
3646
|
</div></div>
|
3647
|
-
<div class="paragraph"><p>As you can see, Worker process 1 and Worker process 2 have the same
|
3647
|
+
<div class="paragraph"><p>As you can see, Worker process 1 and Worker process 2 have the same Memcached
|
3648
3648
|
connection.</p></div>
|
3649
3649
|
<div class="paragraph"><p>Suppose that users Joe and Jane visit your website at the same time. Joe’s
|
3650
3650
|
request is handled by Worker process 1, and Jane’s request is handled by Worker
|
@@ -3695,7 +3695,7 @@ http://www.gnu.org/software/src-highlite -->
|
|
3695
3695
|
</div>
|
3696
3696
|
<div class="sect3">
|
3697
3697
|
<h4 id="_example_2_log_file_sharing_not_harmful">11.3.2. Example 2: Log file sharing (not harmful)</h4>
|
3698
|
-
<div class="paragraph"><p>There are also cases in which
|
3698
|
+
<div class="paragraph"><p>There are also cases in which unintentional file descriptor sharing is not harmful.
|
3699
3699
|
One such case is log file file descriptor sharing. Even if two processes write
|
3700
3700
|
to the log file at the same time, the worst thing that can happen is that the
|
3701
3701
|
data in the log file is interleaved.</p></div>
|
@@ -3752,7 +3752,7 @@ has no effect.</p></div>
|
|
3752
3752
|
<div id="footnotes"><hr></div>
|
3753
3753
|
<div id="footer">
|
3754
3754
|
<div id="footer-text">
|
3755
|
-
Last updated
|
3755
|
+
Last updated 2012-03-20 10:52:52 CET
|
3756
3756
|
</div>
|
3757
3757
|
</div>
|
3758
3758
|
</body>
|
data/doc/Users guide Nginx.txt
CHANGED
@@ -205,7 +205,7 @@ uninstalling the Phusion Passenger files, so that Nginx behaves as if Phusion
|
|
205
205
|
Passenger was never installed in the first place. This might be useful to you if,
|
206
206
|
for example, you seem to be experiencing a problem caused by Phusion Passenger,
|
207
207
|
but you want to make sure whether that's actually the case, without having
|
208
|
-
to through the hassle of uninstalling Phusion Passenger completely. When disabled,
|
208
|
+
to go through the hassle of uninstalling Phusion Passenger completely. When disabled,
|
209
209
|
Phusion Passenger will not occupy any memory or CPU or otherwise interfere with
|
210
210
|
Nginx.
|
211
211
|
|
@@ -1145,7 +1145,7 @@ server {
|
|
1145
1145
|
}
|
1146
1146
|
---------------------------
|
1147
1147
|
|
1148
|
-
Then specify the 'server_name'
|
1148
|
+
Then specify the 'server_name' value followed by the sub-URI, like this:
|
1149
1149
|
|
1150
1150
|
---------------------------
|
1151
1151
|
server {
|
@@ -863,7 +863,7 @@ use the <span class="monospaced">-p</span> option, e.g.:</p></div>
|
|
863
863
|
<div id="footnotes"><hr></div>
|
864
864
|
<div id="footer">
|
865
865
|
<div id="footer-text">
|
866
|
-
Last updated
|
866
|
+
Last updated 2012-02-03 23:25:41 CET
|
867
867
|
</div>
|
868
868
|
</div>
|
869
869
|
</body>
|
@@ -122,7 +122,7 @@ assuming that your Ruby interpreter is <<reducing_memory_usage,copy-on-write fri
|
|
122
122
|
Of course, smart spawning is not without gotchas. But if you understand the
|
123
123
|
gotchas you can easily reap the benefits of smart spawning.
|
124
124
|
|
125
|
-
=== Smart spawning gotcha #1:
|
125
|
+
=== Smart spawning gotcha #1: unintentional file descriptor sharing ===
|
126
126
|
|
127
127
|
Because worker processes are created by forking from an ApplicationSpawner
|
128
128
|
server, it will share all file descriptors that are opened by the
|
@@ -133,7 +133,7 @@ connection, a pipe, etc. If different worker processes write to such a file
|
|
133
133
|
descriptor at the same time, then their write calls will be interleaved, which
|
134
134
|
may potentially cause problems.
|
135
135
|
|
136
|
-
The problem commonly involves socket connections that are
|
136
|
+
The problem commonly involves socket connections that are unintentionally being
|
137
137
|
shared. You can fix it by closing and reestablishing the connection when Phusion
|
138
138
|
Passenger is creating a new worker process. Phusion Passenger provides the API
|
139
139
|
call `PhusionPassenger.on_event(:starting_worker_process)` to do so. So you
|
@@ -198,7 +198,7 @@ result is now as follows:
|
|
198
198
|
| Worker process 2 |-----/
|
199
199
|
+--------------------+
|
200
200
|
|
201
|
-
As you can see, Worker process 1 and Worker process 2 have the same
|
201
|
+
As you can see, Worker process 1 and Worker process 2 have the same Memcached
|
202
202
|
connection.
|
203
203
|
|
204
204
|
Suppose that users Joe and Jane visit your website at the same time. Joe's
|
@@ -250,7 +250,7 @@ end
|
|
250
250
|
|
251
251
|
==== Example 2: Log file sharing (not harmful) ====
|
252
252
|
|
253
|
-
There are also cases in which
|
253
|
+
There are also cases in which unintentional file descriptor sharing is not harmful.
|
254
254
|
One such case is log file file descriptor sharing. Even if two processes write
|
255
255
|
to the log file at the same time, the worst thing that can happen is that the
|
256
256
|
data in the log file is interleaved.
|
data/ext/apache2/Hooks.cpp
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - http://www.modrails.com/
|
3
|
-
* Copyright (c) 2010 Phusion
|
3
|
+
* Copyright (c) 2010, 2011, 2012 Phusion
|
4
4
|
*
|
5
5
|
* "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
6
6
|
*
|
@@ -79,6 +79,10 @@ using namespace Passenger;
|
|
79
79
|
|
80
80
|
extern "C" module AP_MODULE_DECLARE_DATA passenger_module;
|
81
81
|
|
82
|
+
#ifdef APLOG_USE_MODULE
|
83
|
+
APLOG_USE_MODULE(passenger);
|
84
|
+
#endif
|
85
|
+
|
82
86
|
|
83
87
|
/**
|
84
88
|
* If the HTTP client sends POST data larger than this value (in bytes),
|
@@ -99,6 +103,11 @@ extern "C" module AP_MODULE_DECLARE_DATA passenger_module;
|
|
99
103
|
#endif
|
100
104
|
#endif
|
101
105
|
|
106
|
+
#if HTTP_VERSION(AP_SERVER_MAJORVERSION_NUMBER, AP_SERVER_MINORVERSION_NUMBER) >= 2004
|
107
|
+
// Apache >= 2.4
|
108
|
+
#define unixd_config ap_unixd_config
|
109
|
+
#endif
|
110
|
+
|
102
111
|
|
103
112
|
/**
|
104
113
|
* Apache hook functions, wrapped in a class.
|
@@ -230,16 +239,9 @@ private:
|
|
230
239
|
* The existance of a request note means that the handler should be run.
|
231
240
|
*/
|
232
241
|
inline RequestNote *getRequestNote(request_rec *r) {
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
union {
|
237
|
-
RequestNote *note;
|
238
|
-
void *pointer;
|
239
|
-
} u;
|
240
|
-
u.note = 0;
|
241
|
-
apr_pool_userdata_get(&u.pointer, "Phusion Passenger", r->pool);
|
242
|
-
return u.note;
|
242
|
+
void *note = 0;
|
243
|
+
apr_pool_userdata_get(¬e, "Phusion Passenger", r->pool);
|
244
|
+
return (RequestNote *) note;
|
243
245
|
}
|
244
246
|
|
245
247
|
/**
|
@@ -987,14 +989,23 @@ private:
|
|
987
989
|
|
988
990
|
|
989
991
|
// Set standard CGI variables.
|
990
|
-
|
992
|
+
#ifdef AP_GET_SERVER_VERSION_DEPRECATED
|
993
|
+
addHeader(headers, "SERVER_SOFTWARE", ap_get_server_banner());
|
994
|
+
#else
|
995
|
+
addHeader(headers, "SERVER_SOFTWARE", ap_get_server_version());
|
996
|
+
#endif
|
991
997
|
addHeader(headers, "SERVER_PROTOCOL", r->protocol);
|
992
998
|
addHeader(headers, "SERVER_NAME", ap_get_server_name(r));
|
993
999
|
addHeader(headers, "SERVER_ADMIN", r->server->server_admin);
|
994
1000
|
addHeader(headers, "SERVER_ADDR", r->connection->local_ip);
|
995
1001
|
addHeader(headers, "SERVER_PORT", apr_psprintf(r->pool, "%u", ap_get_server_port(r)));
|
996
|
-
|
997
|
-
|
1002
|
+
#if HTTP_VERSION(AP_SERVER_MAJORVERSION_NUMBER, AP_SERVER_MINORVERSION_NUMBER) >= 2004
|
1003
|
+
addHeader(headers, "REMOTE_ADDR", r->connection->client_ip);
|
1004
|
+
addHeader(headers, "REMOTE_PORT", apr_psprintf(r->pool, "%d", r->connection->client_addr->port));
|
1005
|
+
#else
|
1006
|
+
addHeader(headers, "REMOTE_ADDR", r->connection->remote_ip);
|
1007
|
+
addHeader(headers, "REMOTE_PORT", apr_psprintf(r->pool, "%d", r->connection->remote_addr->port));
|
1008
|
+
#endif
|
998
1009
|
addHeader(headers, "REMOTE_USER", r->user);
|
999
1010
|
addHeader(headers, "REQUEST_METHOD", r->method);
|
1000
1011
|
addHeader(headers, "QUERY_STRING", r->args ? r->args : "");
|
data/ext/apache2/mod_passenger.c
CHANGED
data/ext/common/Constants.h
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Phusion Passenger - http://www.modrails.com/
|
3
|
-
* Copyright (c) 2010, 2011 Phusion
|
3
|
+
* Copyright (c) 2010, 2011, 2012 Phusion
|
4
4
|
*
|
5
5
|
* "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
6
6
|
*
|
@@ -26,7 +26,7 @@
|
|
26
26
|
#define _PASSENGER_CONSTANTS_H_
|
27
27
|
|
28
28
|
/* Don't forget to update lib/phusion_passenger.rb too. */
|
29
|
-
#define PASSENGER_VERSION "3.0.
|
29
|
+
#define PASSENGER_VERSION "3.0.12"
|
30
30
|
|
31
31
|
#define FEEDBACK_FD 3
|
32
32
|
|
data/ext/common/FileDescriptor.h
CHANGED
@@ -42,7 +42,10 @@ using namespace boost;
|
|
42
42
|
using namespace oxt;
|
43
43
|
|
44
44
|
|
45
|
-
|
45
|
+
#ifndef _PASSENGER_SAFELY_CLOSE_DEFINED_
|
46
|
+
#define _PASSENGER_SAFELY_CLOSE_DEFINED_
|
47
|
+
void safelyClose(int fd, bool ignoreErrors = false);
|
48
|
+
#endif
|
46
49
|
|
47
50
|
|
48
51
|
/**
|
@@ -81,11 +84,7 @@ private:
|
|
81
84
|
this_thread::disable_syscall_interruption dsi;
|
82
85
|
int theFd = fd;
|
83
86
|
fd = -1;
|
84
|
-
|
85
|
-
safelyClose(theFd);
|
86
|
-
} else {
|
87
|
-
syscalls::close(fd);
|
88
|
-
}
|
87
|
+
safelyClose(theFd, !checkErrors);
|
89
88
|
}
|
90
89
|
}
|
91
90
|
|
data/ext/common/Process.h
CHANGED
@@ -40,6 +40,7 @@
|
|
40
40
|
#include <Exceptions.h>
|
41
41
|
#include <Logging.h>
|
42
42
|
#include <Utils.h>
|
43
|
+
#include <Utils/IOUtils.h>
|
43
44
|
|
44
45
|
namespace Passenger {
|
45
46
|
|
@@ -122,9 +123,7 @@ public:
|
|
122
123
|
int ret;
|
123
124
|
|
124
125
|
if (ownerPipe != -1) {
|
125
|
-
|
126
|
-
ret = close(ownerPipe);
|
127
|
-
} while (ret == -1 && errno == EINTR);
|
126
|
+
safelyClose(ownerPipe, true);
|
128
127
|
}
|
129
128
|
for (it = serverSockets.begin(); it != serverSockets.end(); it++) {
|
130
129
|
const SocketInfo &info = it->second;
|
data/ext/common/Utils.cpp
CHANGED
@@ -922,9 +922,7 @@ getHighestFileDescriptor() {
|
|
922
922
|
goto done;
|
923
923
|
|
924
924
|
} else {
|
925
|
-
|
926
|
-
ret = close(p[1]);
|
927
|
-
} while (ret == -1 && errno == EINTR);
|
925
|
+
close(p[1]); // Do not retry on EINTR: http://news.ycombinator.com/item?id=3363819
|
928
926
|
p[1] = -1;
|
929
927
|
|
930
928
|
union {
|
@@ -965,15 +963,12 @@ getHighestFileDescriptor() {
|
|
965
963
|
}
|
966
964
|
|
967
965
|
done:
|
966
|
+
// Do not retry on EINTR: http://news.ycombinator.com/item?id=3363819
|
968
967
|
if (p[0] != -1) {
|
969
|
-
|
970
|
-
ret = close(p[0]);
|
971
|
-
} while (ret == -1 && errno == EINTR);
|
968
|
+
close(p[0]);
|
972
969
|
}
|
973
970
|
if (p[1] != -1) {
|
974
|
-
|
975
|
-
close(p[1]);
|
976
|
-
} while (ret == -1 && errno == EINTR);
|
971
|
+
close(p[1]);
|
977
972
|
}
|
978
973
|
if (pid != -1) {
|
979
974
|
do {
|
@@ -1007,6 +1002,11 @@ closeAllFileDescriptors(int lastToKeepOpen) {
|
|
1007
1002
|
#endif
|
1008
1003
|
|
1009
1004
|
for (int i = getHighestFileDescriptor(); i > lastToKeepOpen; i--) {
|
1005
|
+
/* Even though we normally shouldn't retry on EINTR
|
1006
|
+
* (http://news.ycombinator.com/item?id=3363819)
|
1007
|
+
* it's okay to do that here because because this function
|
1008
|
+
* may only be called in a single-threaded environment.
|
1009
|
+
*/
|
1010
1010
|
int ret;
|
1011
1011
|
do {
|
1012
1012
|
ret = close(i);
|
data/ext/common/Utils.h
CHANGED
@@ -50,7 +50,7 @@ using namespace boost;
|
|
50
50
|
static const uid_t USER_NOT_GIVEN = (uid_t) -1;
|
51
51
|
static const gid_t GROUP_NOT_GIVEN = (gid_t) -1;
|
52
52
|
|
53
|
-
|
53
|
+
class CachedFileStat;
|
54
54
|
class ResourceLocator;
|
55
55
|
|
56
56
|
/** Enumeration which indicates what kind of file a file is. */
|
@@ -265,9 +265,7 @@ createUnixServer(const StaticString &filename, unsigned int backlogSize, bool au
|
|
265
265
|
try {
|
266
266
|
ret = syscalls::bind(fd, (const struct sockaddr *) &addr, sizeof(addr));
|
267
267
|
} catch (...) {
|
268
|
-
|
269
|
-
ret = close(fd);
|
270
|
-
} while (ret == -1 && errno == EINTR);
|
268
|
+
safelyClose(fd, true);
|
271
269
|
throw;
|
272
270
|
}
|
273
271
|
if (ret == -1) {
|
@@ -275,9 +273,7 @@ createUnixServer(const StaticString &filename, unsigned int backlogSize, bool au
|
|
275
273
|
string message = "Cannot bind Unix socket '";
|
276
274
|
message.append(filename.toString());
|
277
275
|
message.append("'");
|
278
|
-
|
279
|
-
ret = close(fd);
|
280
|
-
} while (ret == -1 && errno == EINTR);
|
276
|
+
safelyClose(fd, true);
|
281
277
|
throw SystemException(message, e);
|
282
278
|
}
|
283
279
|
|
@@ -287,9 +283,7 @@ createUnixServer(const StaticString &filename, unsigned int backlogSize, bool au
|
|
287
283
|
try {
|
288
284
|
ret = syscalls::listen(fd, backlogSize);
|
289
285
|
} catch (...) {
|
290
|
-
|
291
|
-
ret = close(fd);
|
292
|
-
} while (ret == -1 && errno == EINTR);
|
286
|
+
safelyClose(fd, true);
|
293
287
|
throw;
|
294
288
|
}
|
295
289
|
if (ret == -1) {
|
@@ -297,9 +291,7 @@ createUnixServer(const StaticString &filename, unsigned int backlogSize, bool au
|
|
297
291
|
string message = "Cannot listen on Unix socket '";
|
298
292
|
message.append(filename.toString());
|
299
293
|
message.append("'");
|
300
|
-
|
301
|
-
ret = close(fd);
|
302
|
-
} while (ret == -1 && errno == EINTR);
|
294
|
+
safelyClose(fd, true);
|
303
295
|
throw SystemException(message, e);
|
304
296
|
}
|
305
297
|
|
@@ -337,9 +329,7 @@ createTcpServer(const char *address, unsigned short port, unsigned int backlogSi
|
|
337
329
|
try {
|
338
330
|
ret = syscalls::bind(fd, (const struct sockaddr *) &addr, sizeof(addr));
|
339
331
|
} catch (...) {
|
340
|
-
|
341
|
-
ret = close(fd);
|
342
|
-
} while (ret == -1 && errno == EINTR);
|
332
|
+
safelyClose(fd, true);
|
343
333
|
throw;
|
344
334
|
}
|
345
335
|
if (ret == -1) {
|
@@ -348,9 +338,7 @@ createTcpServer(const char *address, unsigned short port, unsigned int backlogSi
|
|
348
338
|
message.append(address);
|
349
339
|
message.append("' port ");
|
350
340
|
message.append(toString(port));
|
351
|
-
|
352
|
-
ret = close(fd);
|
353
|
-
} while (ret == -1 && errno == EINTR);
|
341
|
+
safelyClose(fd, true);
|
354
342
|
throw SystemException(message, e);
|
355
343
|
}
|
356
344
|
|
@@ -361,9 +349,7 @@ createTcpServer(const char *address, unsigned short port, unsigned int backlogSi
|
|
361
349
|
printf("so_reuseaddr failed: %s\n", strerror(errno));
|
362
350
|
}
|
363
351
|
} catch (...) {
|
364
|
-
|
365
|
-
ret = close(fd);
|
366
|
-
} while (ret == -1 && errno == EINTR);
|
352
|
+
safelyClose(fd, true);
|
367
353
|
throw;
|
368
354
|
}
|
369
355
|
// Ignore SO_REUSEPORT error, it's not fatal.
|
@@ -374,9 +360,7 @@ createTcpServer(const char *address, unsigned short port, unsigned int backlogSi
|
|
374
360
|
try {
|
375
361
|
ret = syscalls::listen(fd, backlogSize);
|
376
362
|
} catch (...) {
|
377
|
-
|
378
|
-
ret = close(fd);
|
379
|
-
} while (ret == -1 && errno == EINTR);
|
363
|
+
safelyClose(fd, true);
|
380
364
|
throw;
|
381
365
|
}
|
382
366
|
if (ret == -1) {
|
@@ -385,9 +369,7 @@ createTcpServer(const char *address, unsigned short port, unsigned int backlogSi
|
|
385
369
|
message.append(address);
|
386
370
|
message.append("' port ");
|
387
371
|
message.append(toString(port));
|
388
|
-
|
389
|
-
ret = close(fd);
|
390
|
-
} while (ret == -1 && errno == EINTR);
|
372
|
+
safelyClose(fd, true);
|
391
373
|
throw SystemException(message, e);
|
392
374
|
}
|
393
375
|
|
@@ -440,9 +422,7 @@ connectToUnixServer(const StaticString &filename) {
|
|
440
422
|
try {
|
441
423
|
ret = syscalls::connect(fd, (const sockaddr *) &addr, sizeof(addr));
|
442
424
|
} catch (...) {
|
443
|
-
|
444
|
-
ret = close(fd);
|
445
|
-
} while (ret == -1 && errno == EINTR);
|
425
|
+
safelyClose(fd, true);
|
446
426
|
throw;
|
447
427
|
}
|
448
428
|
if (ret == -1) {
|
@@ -466,9 +446,7 @@ connectToUnixServer(const StaticString &filename) {
|
|
466
446
|
string message("Cannot connect to Unix socket '");
|
467
447
|
message.append(filename.toString());
|
468
448
|
message.append("'");
|
469
|
-
|
470
|
-
ret = close(fd);
|
471
|
-
} while (ret == -1 && errno == EINTR);
|
449
|
+
safelyClose(fd, true);
|
472
450
|
throw SystemException(message, e);
|
473
451
|
}
|
474
452
|
} else {
|
@@ -514,9 +492,7 @@ connectToTcpServer(const StaticString &hostname, unsigned int port) {
|
|
514
492
|
ret = syscalls::connect(fd, res->ai_addr, res->ai_addrlen);
|
515
493
|
} catch (...) {
|
516
494
|
freeaddrinfo(res);
|
517
|
-
|
518
|
-
ret = close(fd);
|
519
|
-
} while (ret == -1 && errno == EINTR);
|
495
|
+
safelyClose(fd, true);
|
520
496
|
throw;
|
521
497
|
}
|
522
498
|
e = errno;
|
@@ -527,9 +503,7 @@ connectToTcpServer(const StaticString &hostname, unsigned int port) {
|
|
527
503
|
message.append(":");
|
528
504
|
message.append(toString(port));
|
529
505
|
message.append("'");
|
530
|
-
|
531
|
-
ret = close(fd);
|
532
|
-
} while (ret == -1 && errno == EINTR);
|
506
|
+
safelyClose(fd, true);
|
533
507
|
throw SystemException(message, e);
|
534
508
|
}
|
535
509
|
|
@@ -1006,7 +980,7 @@ writeFileDescriptor(int fd, int fdToSend, unsigned long long *timeout) {
|
|
1006
980
|
}
|
1007
981
|
|
1008
982
|
void
|
1009
|
-
safelyClose(int fd) {
|
983
|
+
safelyClose(int fd, bool ignoreErrors) {
|
1010
984
|
if (syscalls::close(fd) == -1) {
|
1011
985
|
/* FreeBSD has a kernel bug which can cause close() to return ENOTCONN.
|
1012
986
|
* This is harmless, ignore it. We check for this problem on all
|
@@ -1015,7 +989,7 @@ safelyClose(int fd) {
|
|
1015
989
|
* http://www.freebsd.org/cgi/query-pr.cgi?pr=79138
|
1016
990
|
* http://www.freebsd.org/cgi/query-pr.cgi?pr=144061
|
1017
991
|
*/
|
1018
|
-
if (errno != ENOTCONN) {
|
992
|
+
if (errno != ENOTCONN && !ignoreErrors) {
|
1019
993
|
int e = errno;
|
1020
994
|
throw SystemException("Cannot close file descriptor", e);
|
1021
995
|
}
|
data/ext/common/Utils/IOUtils.h
CHANGED
@@ -414,12 +414,18 @@ void writeFileDescriptor(int fd, int fdToSend, unsigned long long *timeout = NUL
|
|
414
414
|
|
415
415
|
/**
|
416
416
|
* Closes the given file descriptor and throws an exception if anything goes wrong.
|
417
|
-
* This function also works around certain close() bugs on certain
|
417
|
+
* This function also works around certain close() bugs and quirks on certain
|
418
|
+
* operating systems, such as the FreeBSD ENOTCONN-on-close bug and the fact that
|
419
|
+
* when close() returns EINTR the state of the file descriptor is unspecified.
|
420
|
+
* See IOUtils.cpp and ext/oxt/system_calls.cpp for details.
|
418
421
|
*
|
419
422
|
* @throws SystemException
|
420
423
|
* @throws boost::thread_interrupted
|
421
424
|
*/
|
422
|
-
|
425
|
+
#ifndef _PASSENGER_SAFELY_CLOSE_DEFINED_
|
426
|
+
#define _PASSENGER_SAFELY_CLOSE_DEFINED_
|
427
|
+
void safelyClose(int fd, bool ignoreErrors = false);
|
428
|
+
#endif
|
423
429
|
|
424
430
|
} // namespace Passenger
|
425
431
|
|
@@ -625,7 +625,7 @@ inline int
|
|
625
625
|
readFileDescriptorWithNegotiation(int fd, unsigned long long *timeout = NULL) {
|
626
626
|
writeArrayMessage(fd, timeout, "pass IO", NULL);
|
627
627
|
int result = readFileDescriptor(fd, timeout);
|
628
|
-
ScopeGuard guard(boost::bind(safelyClose, result));
|
628
|
+
ScopeGuard guard(boost::bind(safelyClose, result, false));
|
629
629
|
writeArrayMessage(fd, timeout, "got IO", NULL);
|
630
630
|
guard.clear();
|
631
631
|
return result;
|
data/ext/common/Watchdog.cpp
CHANGED
@@ -90,7 +90,7 @@ static EventFd *errorEvent;
|
|
90
90
|
|
91
91
|
#define REQUEST_SOCKET_PASSWORD_SIZE 64
|
92
92
|
|
93
|
-
static
|
93
|
+
static void setOomScore(const StaticString &score);
|
94
94
|
|
95
95
|
|
96
96
|
/**
|
@@ -764,46 +764,87 @@ public:
|
|
764
764
|
};
|
765
765
|
|
766
766
|
|
767
|
+
enum OomFileType {
|
768
|
+
OOM_ADJ,
|
769
|
+
OOM_SCORE_ADJ
|
770
|
+
};
|
771
|
+
|
772
|
+
static FILE *
|
773
|
+
openOomAdjFile(const char *mode, OomFileType &type) {
|
774
|
+
FILE *f = fopen("/proc/self/oom_score_adj", mode);
|
775
|
+
if (f == NULL) {
|
776
|
+
f = fopen("/proc/self/oom_adj", mode);
|
777
|
+
if (f == NULL) {
|
778
|
+
return NULL;
|
779
|
+
} else {
|
780
|
+
type = OOM_ADJ;
|
781
|
+
return f;
|
782
|
+
}
|
783
|
+
} else {
|
784
|
+
type = OOM_SCORE_ADJ;
|
785
|
+
return f;
|
786
|
+
}
|
787
|
+
}
|
788
|
+
|
767
789
|
/**
|
768
790
|
* Linux-only way to change OOM killer configuration for
|
769
791
|
* current process. Requires root privileges, which we
|
770
792
|
* should have.
|
771
793
|
*/
|
772
|
-
static
|
794
|
+
static void
|
773
795
|
setOomScore(const StaticString &score) {
|
774
|
-
if (
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
bytesRead = fread(buf, 1, sizeof(buf), f);
|
785
|
-
if (bytesRead == 0 && feof(f)) {
|
786
|
-
break;
|
787
|
-
} else if (bytesRead == 0 && ferror(f)) {
|
788
|
-
fclose(f);
|
789
|
-
return "";
|
790
|
-
} else {
|
791
|
-
oldScore.append(buf, bytesRead);
|
792
|
-
}
|
793
|
-
}
|
796
|
+
if (score.empty()) {
|
797
|
+
return;
|
798
|
+
}
|
799
|
+
|
800
|
+
FILE *f;
|
801
|
+
OomFileType type;
|
802
|
+
|
803
|
+
f = openOomAdjFile("r", type);
|
804
|
+
if (f != NULL) {
|
805
|
+
fwrite(score.data(), 1, score.size(), f);
|
794
806
|
fclose(f);
|
795
|
-
|
796
|
-
|
797
|
-
|
807
|
+
}
|
808
|
+
}
|
809
|
+
|
810
|
+
static string
|
811
|
+
setOomScoreNeverKill() {
|
812
|
+
string oldScore;
|
813
|
+
FILE *f;
|
814
|
+
OomFileType type;
|
815
|
+
|
816
|
+
f = openOomAdjFile("r", type);
|
817
|
+
if (f == NULL) {
|
818
|
+
return "";
|
819
|
+
}
|
820
|
+
char buf[1024];
|
821
|
+
size_t bytesRead;
|
822
|
+
while (true) {
|
823
|
+
bytesRead = fread(buf, 1, sizeof(buf), f);
|
824
|
+
if (bytesRead == 0 && feof(f)) {
|
825
|
+
break;
|
826
|
+
} else if (bytesRead == 0 && ferror(f)) {
|
827
|
+
fclose(f);
|
798
828
|
return "";
|
829
|
+
} else {
|
830
|
+
oldScore.append(buf, bytesRead);
|
799
831
|
}
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
832
|
+
}
|
833
|
+
fclose(f);
|
834
|
+
|
835
|
+
f = openOomAdjFile("w", type);
|
836
|
+
if (f == NULL) {
|
805
837
|
return "";
|
806
838
|
}
|
839
|
+
if (type == OOM_SCORE_ADJ) {
|
840
|
+
fprintf(f, "-1000\n");
|
841
|
+
} else {
|
842
|
+
assert(type == OOM_ADJ);
|
843
|
+
fprintf(f, "-17\n");
|
844
|
+
}
|
845
|
+
fclose(f);
|
846
|
+
|
847
|
+
return oldScore;
|
807
848
|
}
|
808
849
|
|
809
850
|
/**
|
@@ -965,7 +1006,7 @@ main(int argc, char *argv[]) {
|
|
965
1006
|
* for this watchdog. Note that the OOM score is inherited by child processes
|
966
1007
|
* so we need to restore it after each fork().
|
967
1008
|
*/
|
968
|
-
oldOomScore =
|
1009
|
+
oldOomScore = setOomScoreNeverKill();
|
969
1010
|
|
970
1011
|
agentsOptions = initializeAgent(argc, argv, "PassengerWatchdog");
|
971
1012
|
logLevel = agentsOptions.getInt("log_level");
|
data/ext/nginx/Configuration.c
CHANGED
@@ -362,7 +362,9 @@ passenger_create_loc_conf(ngx_conf_t *cf)
|
|
362
362
|
DEFINE_VAR_TO_PASS("SERVER_ADDR", "$server_addr");
|
363
363
|
DEFINE_VAR_TO_PASS("SERVER_PORT", "$server_port");
|
364
364
|
|
365
|
+
#if NGINX_VERSION_NUM >= 1000010
|
365
366
|
ngx_str_set(&conf->upstream_config.module, "passenger");
|
367
|
+
#endif
|
366
368
|
|
367
369
|
return conf;
|
368
370
|
}
|
data/ext/nginx/ContentHandler.c
CHANGED
@@ -1197,8 +1197,10 @@ process_header(ngx_http_request_t *r)
|
|
1197
1197
|
ngx_table_elt_t *h;
|
1198
1198
|
ngx_http_upstream_header_t *hh;
|
1199
1199
|
ngx_http_upstream_main_conf_t *umcf;
|
1200
|
+
passenger_loc_conf_t *slcf;
|
1200
1201
|
|
1201
1202
|
umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module);
|
1203
|
+
slcf = ngx_http_get_module_loc_conf(r, ngx_http_passenger_module);
|
1202
1204
|
|
1203
1205
|
for ( ;; ) {
|
1204
1206
|
|
@@ -1227,8 +1229,10 @@ process_header(ngx_http_request_t *r)
|
|
1227
1229
|
h->value.data = h->key.data + h->key.len + 1;
|
1228
1230
|
h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1;
|
1229
1231
|
|
1230
|
-
|
1231
|
-
|
1232
|
+
ngx_memcpy(h->key.data, r->header_name_start, h->key.len);
|
1233
|
+
h->key.data[h->key.len] = '\0';
|
1234
|
+
ngx_memcpy(h->value.data, r->header_start, h->value.len);
|
1235
|
+
h->value.data[h->value.len] = '\0';
|
1232
1236
|
|
1233
1237
|
if (h->key.len == r->lowcase_index) {
|
1234
1238
|
ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len);
|
@@ -1276,7 +1280,11 @@ process_header(ngx_http_request_t *r)
|
|
1276
1280
|
|
1277
1281
|
h->key.len = sizeof("Server") - 1;
|
1278
1282
|
h->key.data = (u_char *) "Server";
|
1279
|
-
|
1283
|
+
if( slcf->show_version_in_header == 0 ) {
|
1284
|
+
h->value.data = (u_char *) (NGINX_VER " + Phusion Passenger (mod_rails/mod_rack)");
|
1285
|
+
} else {
|
1286
|
+
h->value.data = (u_char *) (NGINX_VER " + Phusion Passenger " PASSENGER_VERSION " (mod_rails/mod_rack)");
|
1287
|
+
}
|
1280
1288
|
h->value.len = ngx_strlen(h->value.data);
|
1281
1289
|
h->lowcase_key = (u_char *) "server";
|
1282
1290
|
}
|
@@ -40,9 +40,9 @@ namespace oxt {
|
|
40
40
|
|
41
41
|
using namespace std;
|
42
42
|
using namespace boost;
|
43
|
-
|
43
|
+
struct trace_point;
|
44
44
|
class tracable_exception;
|
45
|
-
|
45
|
+
struct thread_registration;
|
46
46
|
|
47
47
|
extern boost::mutex _thread_registration_mutex;
|
48
48
|
extern list<thread_registration *> _registered_threads;
|
data/ext/oxt/system_calls.cpp
CHANGED
@@ -137,12 +137,45 @@ syscalls::writev(int fd, const struct iovec *iov, int iovcnt) {
|
|
137
137
|
|
138
138
|
int
|
139
139
|
syscalls::close(int fd) {
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
140
|
+
/* Apparently POSIX says that if close() returns EINTR the
|
141
|
+
* file descriptor will be left in an undefined state, so
|
142
|
+
* when coding for POSIX we can't just loop on EINTR or we
|
143
|
+
* could run into race conditions with other threads.
|
144
|
+
* http://www.daemonology.net/blog/2011-12-17-POSIX-close-is-broken.html
|
145
|
+
*
|
146
|
+
* On Linux, FreeBSD and OpenBSD, close() releases the file
|
147
|
+
* descriptor when it returns EINTR. HP-UX does not.
|
148
|
+
* http://news.ycombinator.com/item?id=3363884
|
149
|
+
*
|
150
|
+
* MacOS X is insane because although the system call does
|
151
|
+
* release the file descriptor, the close() function as
|
152
|
+
* implemented by libSystem may call pthread_testcancel() first
|
153
|
+
* which can also return EINTR. Whether this happens depends
|
154
|
+
* on whether unix2003 is enabled.
|
155
|
+
* http://www.reddit.com/r/programming/comments/ng6vt/posix_close2_is_broken/c38xrgu
|
156
|
+
*/
|
157
|
+
#if defined(_hpux)
|
158
|
+
int ret;
|
159
|
+
CHECK_INTERRUPTION(
|
160
|
+
ret == -1,
|
161
|
+
ret = ::close(fd)
|
162
|
+
);
|
163
|
+
return ret;
|
164
|
+
#else
|
165
|
+
/* TODO: If it's not known whether the OS releases the file
|
166
|
+
* descriptor on EINTR-on-close(), we should print some kind of
|
167
|
+
* warning here. This would actually explain why some people get
|
168
|
+
* mysterious EBADF errors. I think the best thing we can do is
|
169
|
+
* to manually whitelist operating systems as we find out their
|
170
|
+
* behaviors.
|
171
|
+
*/
|
172
|
+
int ret = ::close(fd);
|
173
|
+
if (ret == -1 && errno == EINTR && this_thread::syscalls_interruptable()) {
|
174
|
+
throw thread_interrupted();
|
175
|
+
} else {
|
176
|
+
return ret;
|
177
|
+
}
|
178
|
+
#endif
|
146
179
|
}
|
147
180
|
|
148
181
|
int
|
data/lib/phusion_passenger.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Phusion Passenger - http://www.modrails.com/
|
2
|
-
# Copyright (c) 2010, 2011 Phusion
|
2
|
+
# Copyright (c) 2010, 2011, 2012 Phusion
|
3
3
|
#
|
4
4
|
# "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
5
5
|
#
|
@@ -25,10 +25,10 @@ module PhusionPassenger
|
|
25
25
|
###### Version numbers ######
|
26
26
|
|
27
27
|
# Phusion Passenger version number. Don't forget to edit ext/common/Constants.h too.
|
28
|
-
VERSION_STRING = '3.0.
|
28
|
+
VERSION_STRING = '3.0.12'
|
29
29
|
|
30
|
-
PREFERRED_NGINX_VERSION = '1.0.
|
31
|
-
PREFERRED_PCRE_VERSION = '8.
|
30
|
+
PREFERRED_NGINX_VERSION = '1.0.15'
|
31
|
+
PREFERRED_PCRE_VERSION = '8.30'
|
32
32
|
STANDALONE_INTERFACE_VERSION = 1
|
33
33
|
|
34
34
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Phusion Passenger - http://www.modrails.com/
|
2
|
-
# Copyright (c) 2010 Phusion
|
2
|
+
# Copyright (c) 2010, 2011, 2012 Phusion
|
3
3
|
#
|
4
4
|
# "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
5
5
|
#
|
@@ -49,6 +49,7 @@ module Packaging
|
|
49
49
|
# A list of globs which match all files that should be packaged
|
50
50
|
# in the Phusion Passenger gem or tarball.
|
51
51
|
GLOB = [
|
52
|
+
'configure',
|
52
53
|
'Rakefile',
|
53
54
|
'README',
|
54
55
|
'DEVELOPERS.TXT',
|
@@ -105,4 +106,4 @@ module Packaging
|
|
105
106
|
]
|
106
107
|
end
|
107
108
|
|
108
|
-
end # module PhusionPassenger
|
109
|
+
end # module PhusionPassenger
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Phusion Passenger - http://www.modrails.com/
|
2
|
-
# Copyright (c) 2010 Phusion
|
2
|
+
# Copyright (c) 2010, 2011, 2012 Phusion
|
3
3
|
#
|
4
4
|
# "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
5
5
|
#
|
@@ -80,6 +80,17 @@ module PlatformInfo
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
memoize :httpd
|
83
|
+
|
84
|
+
# The Apache version, or nil if Apache is not found.
|
85
|
+
def self.httpd_version
|
86
|
+
if httpd
|
87
|
+
`#{httpd} -v` =~ %r{Apache/([\d\.]+)}
|
88
|
+
return $1
|
89
|
+
else
|
90
|
+
return nil
|
91
|
+
end
|
92
|
+
end
|
93
|
+
memoize :httpd_version
|
83
94
|
|
84
95
|
# The absolute path to the 'apr-config' or 'apr-1-config' executable,
|
85
96
|
# or nil if not found.
|
@@ -67,7 +67,7 @@ module PlatformInfo
|
|
67
67
|
return filename
|
68
68
|
else
|
69
69
|
STDERR.puts "Your RVM wrapper scripts are too old. Please " +
|
70
|
-
"update them first by running 'rvm
|
70
|
+
"update them first by running 'rvm get head && " +
|
71
71
|
"rvm reload && rvm repair all'."
|
72
72
|
exit 1
|
73
73
|
end
|
data/lib/phusion_passenger/templates/apache2/apache_must_be_compiled_with_compatible_mpm.txt.erb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
<red>WARNING:</red> <yellow>Apache doesn't seem to be compiled with the 'prefork' or '
|
1
|
+
<red>WARNING:</red> <yellow>Apache doesn't seem to be compiled with the 'prefork', 'worker' or 'event' MPM</yellow>
|
2
2
|
|
3
|
-
Passenger has only been tested on Apache with the 'prefork'
|
4
|
-
MPM. Your Apache installation is compiled with
|
5
|
-
you to abort this installer and to recompile
|
6
|
-
|
3
|
+
Phusion Passenger has only been tested on Apache with the 'prefork', the
|
4
|
+
'worker' and the 'worker' MPM. Your Apache installation is compiled with
|
5
|
+
the '<%= @current_mpm %>' MPM. We recommend you to abort this installer and to recompile
|
6
|
+
Apache with either the 'prefork', the 'worker' or the 'event' MPM.
|
7
7
|
|
8
8
|
<b>Press Ctrl-C to abort this installer (recommended).</b>
|
9
9
|
<b>Press Enter if you want to continue with installation anyway.</b>
|
@@ -5,10 +5,13 @@ Apache configuration file and set its DocumentRoot to <b>/somewhere/public</b>:
|
|
5
5
|
<b>
|
6
6
|
<VirtualHost *:80>
|
7
7
|
ServerName www.yourhost.com
|
8
|
-
|
8
|
+
# !!! Be sure to point DocumentRoot to 'public'!
|
9
|
+
DocumentRoot /somewhere/public
|
9
10
|
<Directory /somewhere/public>
|
10
|
-
|
11
|
-
|
11
|
+
# This relaxes Apache security settings.
|
12
|
+
AllowOverride all
|
13
|
+
# MultiViews must be turned off.
|
14
|
+
Options -MultiViews
|
12
15
|
</Directory>
|
13
16
|
</VirtualHost>
|
14
17
|
</b>
|
@@ -29,6 +29,10 @@ Listen 127.0.0.1:<%= @port %>
|
|
29
29
|
<% if !has_builtin_module?('mod_env.c') %>
|
30
30
|
LoadModule env_module "<%= modules_dir %>/mod_env.so"
|
31
31
|
<% end %>
|
32
|
+
<% if PlatformInfo.httpd_version >= '2.4.0' %>
|
33
|
+
LoadModule authz_core_module "<%= modules_dir %>/mod_authz_core.so"
|
34
|
+
LoadModule unixd_module "<%= modules_dir %>/mod_unixd.so"
|
35
|
+
<% end %>
|
32
36
|
LoadModule passenger_module "<%= @mod_passenger %>"
|
33
37
|
|
34
38
|
PassengerRoot "<%= @passenger_root %>"
|
@@ -57,6 +61,11 @@ MaxClients 10
|
|
57
61
|
MaxSpareThreads 1
|
58
62
|
ThreadsPerChild 2
|
59
63
|
</IfModule>
|
64
|
+
<IfModule mpm_event_module>
|
65
|
+
MinSpareThreads 1
|
66
|
+
MaxSpareThreads 1
|
67
|
+
ThreadsPerChild 2
|
68
|
+
</IfModule>
|
60
69
|
|
61
70
|
<Directory />
|
62
71
|
AllowOverride all
|
@@ -66,12 +75,14 @@ ServerAdmin admin@passenger.test
|
|
66
75
|
ServerName passenger.test
|
67
76
|
DocumentRoot "<%= @server_root %>"
|
68
77
|
|
69
|
-
|
78
|
+
<% if PlatformInfo.httpd_version < '2.4.0' %>
|
79
|
+
LockFile <%= @server_root %>/httpd.lock
|
80
|
+
<% end %>
|
70
81
|
PidFile <%= @server_root %>/httpd.pid
|
71
82
|
ErrorLog <%= @passenger_root %>/test/test.log
|
72
83
|
CustomLog <%= @server_root %>/access.log combined
|
73
84
|
|
74
|
-
<% if !vhosts.empty? %>
|
85
|
+
<% if !vhosts.empty? && PlatformInfo.httpd_version < '2.4.0' %>
|
75
86
|
NameVirtualHost *:<%= @port %>
|
76
87
|
<% end %>
|
77
88
|
<% for vhost in vhosts %>
|
Binary file
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: passenger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 3.0.
|
9
|
+
- 12
|
10
|
+
version: 3.0.12
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Phusion - http://www.phusion.nl/
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
19
|
-
default_executable:
|
18
|
+
date: 2012-04-13 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: rake
|
@@ -95,6 +94,7 @@ extensions: []
|
|
95
94
|
extra_rdoc_files: []
|
96
95
|
|
97
96
|
files:
|
97
|
+
- configure
|
98
98
|
- Rakefile
|
99
99
|
- README
|
100
100
|
- DEVELOPERS.TXT
|
@@ -275,7 +275,6 @@ files:
|
|
275
275
|
- doc/images/typical_isolated_web_application.svg
|
276
276
|
- doc/Security of user switching support.txt
|
277
277
|
- doc/Users guide Apache with comments.html
|
278
|
-
- doc/Users guide Apache.idmap.txt
|
279
278
|
- doc/Users guide Apache.txt
|
280
279
|
- doc/Users guide Nginx.txt
|
281
280
|
- doc/Users guide Standalone.txt
|
@@ -1509,7 +1508,6 @@ files:
|
|
1509
1508
|
- doc/Users guide Standalone.html
|
1510
1509
|
- doc/Security of user switching support.html
|
1511
1510
|
- doc/Architectural overview.html
|
1512
|
-
has_rdoc: true
|
1513
1511
|
homepage: http://www.modrails.com/
|
1514
1512
|
licenses: []
|
1515
1513
|
|
@@ -1539,7 +1537,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1539
1537
|
requirements: []
|
1540
1538
|
|
1541
1539
|
rubyforge_project: passenger
|
1542
|
-
rubygems_version: 1.
|
1540
|
+
rubygems_version: 1.8.15
|
1543
1541
|
signing_key:
|
1544
1542
|
specification_version: 3
|
1545
1543
|
summary: Easy and robust Ruby web application deployment
|
@@ -1,80 +0,0 @@
|
|
1
|
-
###### Autogenerated by Mizuho, DO NOT EDIT ######
|
2
|
-
# This file maps section names to IDs so that the commenting system knows which
|
3
|
-
# comments belong to which section. Section names may be changed at will but
|
4
|
-
# IDs always stay the same, allowing one to retain old comments even if you
|
5
|
-
# rename a section.
|
6
|
-
#
|
7
|
-
# This file is autogenerated but is not a cache; you MUST NOT DELETE this
|
8
|
-
# file and you must check it into your version control system. If you lose
|
9
|
-
# this file you may lose the ability to identity old comments.
|
10
|
-
#
|
11
|
-
# Entries marked with "fuzzy" indicate that the section title has changed
|
12
|
-
# and that Mizuho has found an ID which appears to be associated with that
|
13
|
-
# section. You should check whether it is correct, and if not, fix it.
|
14
|
-
|
15
|
-
1. Support information => support-information-1ai724i
|
16
|
-
|
17
|
-
1.1. Supported operating systems => supported-operating-systems-18x8jzn
|
18
|
-
|
19
|
-
1.2. Where to get support => where-to-get-support-h5oojh
|
20
|
-
|
21
|
-
2. Installing, upgrading and uninstalling Phusion Passenger => installing-upgrading-and-uninstalling-phusion-passenger-a1zbnb
|
22
|
-
|
23
|
-
2.1. Generic installation instructions => generic-installation-instructions-eh9xhl
|
24
|
-
|
25
|
-
2.1.1. Overview of installation methods => overview-of-installation-methods-1rv04e2
|
26
|
-
|
27
|
-
2.1.2. Preparation (gem and source tarball only) => preparation-gem-and-source-tarball-only--11ofr29
|
28
|
-
|
29
|
-
2.1.3. Installing via the gem => installing-via-the-gem-6zjt30
|
30
|
-
|
31
|
-
2.1.4. Installing via the source tarball => installing-via-the-source-tarball-mly13a
|
32
|
-
|
33
|
-
2.1.5. Installing via a native Linux package => installing-via-a-native-linux-package-7l0t4v
|
34
|
-
|
35
|
-
2.1.6. What does the installer do? => what-does-the-installer-do--1j2bczq
|
36
|
-
|
37
|
-
2.2. Operating system-specific instructions and information => operating-system-specific-instructions-and-information-pqoxte
|
38
|
-
|
39
|
-
2.2.1. MacOS X => macos-x-kvt0z1
|
40
|
-
|
41
|
-
2.2.2. Ubuntu Linux => ubuntu-linux-1uu7vpl
|
42
|
-
|
43
|
-
2.2.3. OpenSolaris => opensolaris-t7oylf
|
44
|
-
|
45
|
-
2.3. Upgrading or downgrading Phusion Passenger => upgrading-or-downgrading-phusion-passenger-maq6fw
|
46
|
-
|
47
|
-
2.3.1. Via a gem or a source tarball => via-a-gem-or-a-source-tarball-wzkten
|
48
|
-
|
49
|
-
2.3.2. Via a native Linux package => via-a-native-linux-package-12eene2
|
50
|
-
|
51
|
-
2.4. Unloading (disabling) Phusion Passenger from Apache without uninstalling it => unloading-disabling-phusion-passenger-from-apache-without-uninstalling-it-1rb6log
|
52
|
-
|
53
|
-
2.5. Uninstalling Phusion Passenger => uninstalling-phusion-passenger-u9x0gk
|
54
|
-
|
55
|
-
3. Deploying a Ruby on Rails application => deploying-a-ruby-on-rails-application-itdr6l
|
56
|
-
|
57
|
-
3.1. Deploying to a virtual host’s root => deploying-to-a-virtual-host-s-root-148jpxy
|
58
|
-
|
59
|
-
3.2. Deploying to a sub URI => deploying-to-a-sub-uri-cukfoc
|
60
|
-
|
61
|
-
3.3. Redeploying (restarting the Ruby on Rails application) => redeploying-restarting-the-ruby-on-rails-application--1unls8v
|
62
|
-
|
63
|
-
3.4. Migrations => migrations-fjdjdr
|
64
|
-
|
65
|
-
3.5. Capistrano integration => capistrano-integration-1m5sn2y
|
66
|
-
|
67
|
-
4. Deploying a Rack-based Ruby application => deploying-a-rack-based-ruby-application-1swt4rl
|
68
|
-
|
69
|
-
4.1. Tutorial/example: writing and deploying a Hello World Rack application => tutorial-example-writing-and-deploying-a-hello-world-rack-application-znzu46
|
70
|
-
|
71
|
-
4.2. Deploying to a virtual host’s root => deploying-to-a-virtual-host-s-root-5wmulv
|
72
|
-
|
73
|
-
4.3. Deploying to a sub URI => deploying-to-a-sub-uri-l6sbwx
|
74
|
-
|
75
|
-
4.4. Redeploying (restarting the Rack application) => redeploying-restarting-the-rack-application--vn8xzn
|
76
|
-
|
77
|
-
4.5. Rackup specifications for various web frameworks => rackup-specifications-for-various-web-frameworks-13g881i
|
78
|
-
|
79
|
-
4.5.1. Camping => camping-1e2lve4
|
80
|
-
|