passenger 4.0.42 → 4.0.43
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/CHANGELOG +13 -0
- data/CONTRIBUTING.md +2 -19
- data/build/agents.rb +4 -1
- data/build/cxx_tests.rb +7 -2
- data/build/debian.rb +1 -1
- data/debian.template/control.template +0 -2
- data/doc/CodingTipsAndPitfalls.md +56 -0
- data/doc/Users guide Apache.idmap.txt +16 -14
- data/doc/Users guide Nginx.idmap.txt +8 -6
- data/doc/Users guide Standalone.idmap.txt +3 -1
- data/doc/Users guide Standalone.txt +1 -1
- data/doc/users_guide_snippets/environment_variables.txt +1 -0
- data/doc/users_guide_snippets/installation.txt +5 -5
- data/doc/users_guide_snippets/support_information.txt +42 -9
- data/doc/users_guide_snippets/troubleshooting/default.txt +42 -0
- data/ext/common/ApplicationPool2/Common.h +1 -0
- data/ext/common/ApplicationPool2/DirectSpawner.h +2 -7
- data/ext/common/ApplicationPool2/DummySpawner.h +1 -1
- data/ext/common/ApplicationPool2/Group.h +4 -2
- data/ext/common/ApplicationPool2/Options.h +9 -7
- data/ext/common/ApplicationPool2/Pool.h +83 -40
- data/ext/common/ApplicationPool2/Process.h +2 -6
- data/ext/common/ApplicationPool2/README.md +0 -40
- data/ext/common/ApplicationPool2/SmartSpawner.h +2 -9
- data/ext/common/ApplicationPool2/Spawner.h +1 -4
- data/ext/common/ApplicationPool2/SpawnerFactory.h +6 -9
- data/ext/common/ApplicationPool2/SuperGroup.h +3 -3
- data/ext/common/Constants.h +1 -1
- data/ext/common/UnionStation/Connection.h +227 -0
- data/ext/common/UnionStation/Core.h +497 -0
- data/ext/common/UnionStation/ScopeLog.h +172 -0
- data/ext/common/UnionStation/Transaction.h +276 -0
- data/ext/common/Utils.cpp +83 -8
- data/ext/common/Utils.h +25 -4
- data/ext/common/Utils/AnsiColorConstants.h +1 -0
- data/ext/common/Utils/ProcessMetricsCollector.h +6 -170
- data/ext/common/Utils/SpeedMeter.h +258 -0
- data/ext/common/Utils/StrIntUtils.cpp +6 -0
- data/ext/common/Utils/StringScanning.h +277 -0
- data/ext/common/Utils/SystemMetricsCollector.h +1460 -0
- data/ext/common/agents/Base.cpp +8 -8
- data/ext/common/agents/HelperAgent/Main.cpp +12 -6
- data/ext/common/agents/HelperAgent/RequestHandler.h +15 -16
- data/ext/common/agents/HelperAgent/SystemMetricsTool.cpp +199 -0
- data/ext/common/agents/LoggingAgent/LoggingServer.h +2 -1
- data/ext/common/agents/SpawnPreparer.cpp +20 -32
- data/lib/phusion_passenger.rb +1 -1
- data/lib/phusion_passenger/config/list_instances_command.rb +118 -0
- data/lib/phusion_passenger/config/main.rb +22 -4
- data/lib/phusion_passenger/config/system_metrics_command.rb +37 -0
- data/lib/phusion_passenger/config/utils.rb +1 -1
- data/lib/phusion_passenger/loader_shared_helpers.rb +8 -5
- data/lib/phusion_passenger/platform_info/compiler.rb +1 -1
- data/resources/templates/error_layout.html.template +3 -3
- data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +3 -5
- data/test/cxx/ApplicationPool2/PoolTest.cpp +1 -3
- data/test/cxx/ApplicationPool2/ProcessTest.cpp +4 -4
- data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +5 -7
- data/test/cxx/RequestHandlerTest.cpp +9 -3
- data/test/cxx/UnionStationTest.cpp +61 -64
- metadata +13 -4
- metadata.gz.asc +7 -7
- data/ext/common/UnionStation.h +0 -968
- data/helper-scripts/system-memory-stats.py +0 -207
@@ -1,207 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python
|
2
|
-
# Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
# Copyright (c) 2013 Phusion
|
4
|
-
#
|
5
|
-
# "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
6
|
-
#
|
7
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
-
# of this software and associated documentation files (the "Software"), to deal
|
9
|
-
# in the Software without restriction, including without limitation the rights
|
10
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
-
# copies of the Software, and to permit persons to whom the Software is
|
12
|
-
# furnished to do so, subject to the following conditions:
|
13
|
-
#
|
14
|
-
# The above copyright notice and this permission notice shall be included in
|
15
|
-
# all copies or substantial portions of the Software.
|
16
|
-
#
|
17
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
-
# THE SOFTWARE.
|
24
|
-
import sys
|
25
|
-
|
26
|
-
if sys.version_info[0] >= 3:
|
27
|
-
def bytes_to_str(b):
|
28
|
-
return b.decode()
|
29
|
-
else:
|
30
|
-
def bytes_to_str(b):
|
31
|
-
return b
|
32
|
-
|
33
|
-
def linux_memory_stats():
|
34
|
-
import os
|
35
|
-
os.execlp('free', 'free', '-m')
|
36
|
-
|
37
|
-
def osx_memory_stats():
|
38
|
-
import subprocess, re, os, resource
|
39
|
-
|
40
|
-
def popen_read(command):
|
41
|
-
return bytes_to_str(subprocess.Popen(command, stdout = subprocess.PIPE).communicate()[0])
|
42
|
-
|
43
|
-
# Get process info
|
44
|
-
ps = popen_read(['ps', '-caxm', '-orss,comm'])
|
45
|
-
vm = popen_read(['vm_stat'])
|
46
|
-
|
47
|
-
# Iterate processes
|
48
|
-
process_lines = ps.split('\n')
|
49
|
-
sep = re.compile('[\s]+')
|
50
|
-
rss_total = 0 # kB
|
51
|
-
for row in range(1, len(process_lines)):
|
52
|
-
row_text = process_lines[row].strip()
|
53
|
-
row_elements = sep.split(row_text)
|
54
|
-
try:
|
55
|
-
rss = float(row_elements[0]) * 1024
|
56
|
-
except:
|
57
|
-
rss = 0 # ignore...
|
58
|
-
rss_total += rss
|
59
|
-
|
60
|
-
# Process vm_stat
|
61
|
-
vm_lines = vm.split('\n')
|
62
|
-
sep = re.compile(':[\s]+')
|
63
|
-
vm_stats = {}
|
64
|
-
for row in range(1, len(vm_lines) - 2):
|
65
|
-
row_text = vm_lines[row].strip()
|
66
|
-
row_elements = sep.split(row_text)
|
67
|
-
vm_stats[(row_elements[0])] = int(row_elements[1].strip('\.')) * resource.getpagesize()
|
68
|
-
|
69
|
-
print('---- Summary ----')
|
70
|
-
print('Wired Memory:\t\t%.1f MB' % (vm_stats["Pages wired down"] / 1024 / 1024))
|
71
|
-
print('Active Memory:\t\t%.1f MB' % (vm_stats["Pages active"] / 1024 / 1024))
|
72
|
-
print('Inactive Memory:\t%.1f MB' % (vm_stats["Pages inactive"] / 1024 / 1024))
|
73
|
-
print('Free Memory:\t\t%.1f MB' % (vm_stats["Pages free"] / 1024 / 1024))
|
74
|
-
print('Real Mem Total (ps):\t%.1f MB' % (rss_total / 1024 / 1024))
|
75
|
-
print('')
|
76
|
-
print('---- vm_stat ----')
|
77
|
-
print(vm.strip())
|
78
|
-
|
79
|
-
def freebsd_memory_stats():
|
80
|
-
# Ported from http://www.cyberciti.biz/files/scripts/freebsd-memory.pl.txt
|
81
|
-
## freebsd-memory -- List Total System Memory Usage
|
82
|
-
## Copyright (c) 2003-2004 Ralf S. Engelschall <rse@engelschall.com>
|
83
|
-
##
|
84
|
-
## Redistribution and use in source and binary forms, with or without
|
85
|
-
## modification, are permitted provided that the following conditions
|
86
|
-
## are met:
|
87
|
-
## 1. Redistributions of source code must retain the above copyright
|
88
|
-
## notice, this list of conditions and the following disclaimer.
|
89
|
-
## 2. Redistributions in binary form must reproduce the above copyright
|
90
|
-
## notice, this list of conditions and the following disclaimer in the
|
91
|
-
## documentation and/or other materials provided with the distribution.
|
92
|
-
##
|
93
|
-
## THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
94
|
-
## ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
95
|
-
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
96
|
-
## ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
|
97
|
-
## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
98
|
-
## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
99
|
-
## OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
100
|
-
## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
101
|
-
## LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
102
|
-
## OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
103
|
-
## SUCH DAMAGE.
|
104
|
-
import subprocess, re, os, resource
|
105
|
-
|
106
|
-
def popen_read(command):
|
107
|
-
return bytes_to_str(subprocess.Popen(command, stdout = subprocess.PIPE).communicate()[0])
|
108
|
-
|
109
|
-
def printf(format, *args):
|
110
|
-
print(format % args)
|
111
|
-
|
112
|
-
# round the physical memory size to the next power of two which is
|
113
|
-
# reasonable for memory cards. We do this by first determining the
|
114
|
-
# guessed memory card size under the assumption that usual computer
|
115
|
-
# hardware has an average of a maximally eight memory cards installed
|
116
|
-
# and those are usually of equal size.
|
117
|
-
def mem_rounded(mem_size):
|
118
|
-
chip_size = 1;
|
119
|
-
chip_guess = (mem_size / 8) - 1
|
120
|
-
while chip_guess != 0:
|
121
|
-
chip_guess >>= 1
|
122
|
-
chip_size <<= 1
|
123
|
-
mem_round = (mem_size / chip_size + 1) * chip_size
|
124
|
-
return mem_round
|
125
|
-
|
126
|
-
sysctl_output = popen_read(['/sbin/sysctl', '-a'])
|
127
|
-
sysctl = {}
|
128
|
-
regex = re.compile('^([^:]+):\s+(.+)\s*$', re.S | re.M)
|
129
|
-
for line in sysctl_output.split('\n'):
|
130
|
-
matches = regex.match(line)
|
131
|
-
if matches is not None:
|
132
|
-
sysctl[matches.group(1)] = matches.group(2)
|
133
|
-
|
134
|
-
# determine the individual known information
|
135
|
-
# NOTICE: forget hw.usermem, it is just (hw.physmem - vm.stats.vm.v_wire_count).
|
136
|
-
# NOTICE: forget vm.stats.misc.zero_page_count, it is just the subset of
|
137
|
-
# vm.stats.vm.v_free_count which is already pre-zeroed.
|
138
|
-
pagesize = int(sysctl["hw.pagesize"])
|
139
|
-
mem_hw = mem_rounded(int(sysctl["hw.physmem"]))
|
140
|
-
mem_phys = int(sysctl["hw.physmem"])
|
141
|
-
mem_all = int(sysctl["vm.stats.vm.v_page_count"]) * pagesize
|
142
|
-
mem_wire = int(sysctl["vm.stats.vm.v_wire_count"]) * pagesize
|
143
|
-
mem_active = int(sysctl["vm.stats.vm.v_active_count"]) * pagesize
|
144
|
-
mem_inactive = int(sysctl["vm.stats.vm.v_inactive_count"]) * pagesize
|
145
|
-
mem_cache = int(sysctl["vm.stats.vm.v_cache_count"]) * pagesize
|
146
|
-
mem_free = int(sysctl["vm.stats.vm.v_free_count"]) * pagesize
|
147
|
-
|
148
|
-
# determine the individual unknown information
|
149
|
-
mem_gap_vm = mem_all - (mem_wire + mem_active + mem_inactive + mem_cache + mem_free)
|
150
|
-
mem_gap_sys = mem_phys - mem_all
|
151
|
-
mem_gap_hw = mem_hw - mem_phys
|
152
|
-
|
153
|
-
# determine logical summary information
|
154
|
-
mem_total = mem_hw
|
155
|
-
mem_avail = mem_inactive + mem_cache + mem_free
|
156
|
-
mem_used = mem_total - mem_avail
|
157
|
-
|
158
|
-
# information annotations
|
159
|
-
info = {
|
160
|
-
"mem_wire" : 'Wired: disabled for paging out',
|
161
|
-
"mem_active" : 'Active: recently referenced',
|
162
|
-
"mem_inactive" : 'Inactive: recently not referenced',
|
163
|
-
"mem_cache" : 'Cached: almost avail. for allocation',
|
164
|
-
"mem_free" : 'Free: fully available for allocation',
|
165
|
-
"mem_gap_vm" : 'Memory gap: UNKNOWN',
|
166
|
-
"mem_all" : 'Total real memory managed',
|
167
|
-
"mem_gap_sys" : 'Memory gap: Kernel?!',
|
168
|
-
"mem_phys" : 'Total real memory available',
|
169
|
-
"mem_gap_hw" : 'Memory gap: Segment Mappings?!',
|
170
|
-
"mem_hw" : 'Total real memory installed',
|
171
|
-
"mem_used" : 'Logically used memory',
|
172
|
-
"mem_avail" : 'Logically available memory',
|
173
|
-
"mem_total" : 'Logically total memory',
|
174
|
-
}
|
175
|
-
|
176
|
-
# print system results
|
177
|
-
printf("SYSTEM MEMORY INFORMATION:")
|
178
|
-
printf("mem_wire: %7d MB [%3d%%] %s", mem_wire / (1024*1024), (float(mem_wire) / mem_all) * 100, info["mem_wire"])
|
179
|
-
printf("mem_active: + %7d MB [%3d%%] %s", mem_active / (1024*1024), (float(mem_active) / mem_all) * 100, info["mem_active"])
|
180
|
-
printf("mem_inactive:+ %7d MB [%3d%%] %s", mem_inactive / (1024*1024), (float(mem_inactive) / mem_all) * 100, info["mem_inactive"])
|
181
|
-
printf("mem_cache: + %7d MB [%3d%%] %s", mem_cache / (1024*1024), (float(mem_cache) / mem_all) * 100, info["mem_cache"])
|
182
|
-
printf("mem_free: + %7d MB [%3d%%] %s", mem_free / (1024*1024), (float(mem_free) / mem_all) * 100, info["mem_free"])
|
183
|
-
printf("mem_gap_vm: + %7d MB [%3d%%] %s", mem_gap_vm / (1024*1024), (float(mem_gap_vm) / mem_all) * 100, info["mem_gap_vm"])
|
184
|
-
printf("-------------- ---------- ------")
|
185
|
-
printf("mem_all: = %7d MB [100%%] %s", mem_all / (1024*1024), info["mem_all"])
|
186
|
-
printf("mem_gap_sys: + %7d MB %s", mem_gap_sys / (1024*1024), info["mem_gap_sys"])
|
187
|
-
printf("-------------- ----------")
|
188
|
-
printf("mem_phys: = %7d MB %s", mem_phys / (1024*1024), info["mem_phys"])
|
189
|
-
printf("mem_gap_hw: + %7d MB %s", mem_gap_hw / (1024*1024), info["mem_gap_hw"])
|
190
|
-
printf("-------------- ----------")
|
191
|
-
printf("mem_hw: = %7d MB %s", mem_hw / (1024*1024), info["mem_hw"])
|
192
|
-
|
193
|
-
# print logical results
|
194
|
-
print("")
|
195
|
-
printf("SYSTEM MEMORY SUMMARY:");
|
196
|
-
printf("mem_used: %7d MB [%3d%%] %s", mem_used / (1024*1024), (float(mem_used) / mem_total) * 100, info["mem_used"])
|
197
|
-
printf("mem_avail: + %7d MB [%3d%%] %s", mem_avail / (1024*1024), (float(mem_avail) / mem_total) * 100, info["mem_avail"])
|
198
|
-
printf("-------------- ---------- ------")
|
199
|
-
printf("mem_total: = %7d MB [100%%] %s", mem_total / (1024*1024), info["mem_total"])
|
200
|
-
|
201
|
-
|
202
|
-
if sys.platform.find('linux') > -1:
|
203
|
-
linux_memory_stats()
|
204
|
-
elif sys.platform.find('darwin') > -1:
|
205
|
-
osx_memory_stats()
|
206
|
-
elif sys.platform.find('freebsd') > -1:
|
207
|
-
freebsd_memory_stats()
|