passenger 5.3.5 → 5.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +13 -0
- data/README.md +2 -1
- data/Rakefile +0 -5
- data/build/agent.rb +2 -1
- data/build/cxx_tests.rb +18 -20
- data/build/integration_tests.rb +6 -2
- data/build/support/cxx_dependency_map.rb +2019 -1966
- data/dev/colorize-logs +272 -0
- data/src/agent/Core/AdminPanelConnector.h +3 -3
- data/src/agent/Core/ApiServer.h +4 -4
- data/src/agent/Core/ApplicationPool/BasicProcessInfo.h +2 -2
- data/src/agent/Core/ApplicationPool/Group/OutOfBandWork.cpp +2 -2
- data/src/agent/Core/ApplicationPool/Implementation.cpp +5 -5
- data/src/agent/Core/ApplicationPool/Pool.h +4 -4
- data/src/agent/Core/ApplicationPool/Process.h +10 -15
- data/src/agent/Core/ApplicationPool/Socket.h +2 -2
- data/src/agent/Core/ApplicationPool/TestSession.h +3 -3
- data/src/agent/Core/Config.h +4 -2
- data/src/agent/Core/Controller.h +4 -4
- data/src/agent/Core/Controller/Config.h +1 -1
- data/src/agent/Core/Controller/SendRequest.cpp +2 -2
- data/src/agent/Core/Controller/TurboCaching.h +2 -2
- data/src/agent/Core/CoreMain.cpp +2 -2
- data/src/agent/Core/OptionParser.h +2 -2
- data/src/agent/Core/ResponseCache.h +3 -3
- data/src/agent/Core/SecurityUpdateChecker.h +2 -2
- data/src/agent/Core/SpawningKit/Config.h +2 -1
- data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h +1 -1
- data/src/agent/Core/SpawningKit/Context.h +1 -1
- data/src/agent/Core/SpawningKit/DirectSpawner.h +3 -3
- data/src/agent/Core/SpawningKit/DummySpawner.h +3 -3
- data/src/agent/Core/SpawningKit/ErrorRenderer.h +1 -1
- data/src/agent/Core/SpawningKit/Exceptions.h +2 -2
- data/src/agent/Core/SpawningKit/Factory.h +1 -1
- data/src/agent/Core/SpawningKit/Handshake/BackgroundIOCapturer.h +1 -1
- data/src/agent/Core/SpawningKit/Handshake/Perform.h +13 -2
- data/src/agent/Core/SpawningKit/Handshake/Prepare.h +3 -3
- data/src/agent/Core/SpawningKit/Handshake/WorkDir.h +1 -1
- data/src/agent/Core/SpawningKit/Journey.h +4 -5
- data/src/agent/Core/SpawningKit/PipeWatcher.h +1 -1
- data/src/agent/Core/SpawningKit/Result.h +20 -8
- data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h +1 -1
- data/src/agent/Core/SpawningKit/SmartSpawner.h +6 -6
- data/src/agent/Core/SpawningKit/Spawner.h +2 -2
- data/src/agent/Core/TelemetryCollector.h +13 -7
- data/src/agent/ExecHelper/ExecHelperMain.cpp +1 -1
- data/src/agent/README.md +1 -1
- data/src/agent/Shared/ApiAccountUtils.h +1 -1
- data/src/agent/Shared/ApiServerUtils.h +3 -3
- data/src/agent/Shared/ApplicationPoolApiKey.h +2 -2
- data/src/agent/Shared/Fundamentals/Initialization.cpp +4 -4
- data/src/agent/SpawnEnvSetupper/SpawnEnvSetupperMain.cpp +1 -1
- data/src/agent/SystemMetrics/SystemMetricsMain.cpp +4 -3
- data/src/agent/Watchdog/ApiServer.h +3 -3
- data/src/agent/Watchdog/Config.h +3 -2
- data/src/agent/Watchdog/CoreWatcher.cpp +2 -2
- data/src/agent/Watchdog/WatchdogMain.cpp +93 -27
- data/src/apache2_module/Config.cpp +14 -14
- data/src/apache2_module/Config.h +8 -16
- data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +505 -491
- data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp.cxxcodebuilder +39 -17
- data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp +24 -1
- data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp.cxxcodebuilder +31 -1
- data/src/{cxx_supportlib/Utils/MemoryBarrier.h → apache2_module/ConfigGeneral/Common.h} +17 -25
- data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp +12 -1
- data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp.cxxcodebuilder +16 -1
- data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp +19 -5
- data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp.cxxcodebuilder +26 -9
- data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp +6 -1
- data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp.cxxcodebuilder +10 -1
- data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp +7 -1
- data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp.cxxcodebuilder +11 -1
- data/src/apache2_module/DirConfig/AutoGeneratedStruct.h +23 -1
- data/src/apache2_module/DirConfig/AutoGeneratedStruct.h.cxxcodebuilder +34 -1
- data/src/apache2_module/Hooks.cpp +3 -3
- data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h +24 -1
- data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h.cxxcodebuilder +36 -1
- data/src/cxx_supportlib/{Utils → Algorithms}/Hasher.cpp +2 -2
- data/src/cxx_supportlib/{Utils → Algorithms}/Hasher.h +4 -4
- data/src/cxx_supportlib/AppTypeDetector/Detector.h +1 -1
- data/src/cxx_supportlib/ConfigKit/Schema.h +2 -2
- data/src/cxx_supportlib/ConfigKit/Store.h +1 -1
- data/src/cxx_supportlib/Constants.h +1 -1
- data/src/cxx_supportlib/{Utils → DataStructures}/HashMap.h +4 -4
- data/src/cxx_supportlib/DataStructures/HashedStaticString.h +5 -5
- data/src/cxx_supportlib/DataStructures/LString.h +3 -3
- data/src/cxx_supportlib/{Utils → DataStructures}/StringMap.h +36 -36
- data/src/cxx_supportlib/FileTools/FileManip.cpp +1 -1
- data/src/cxx_supportlib/FileTools/PathManip.cpp +2 -2
- data/src/cxx_supportlib/FileTools/PathSecurityCheck.cpp +1 -1
- data/src/cxx_supportlib/Hooks.h +2 -2
- data/src/cxx_supportlib/{Utils → IOTools}/BufferedIO.h +5 -5
- data/src/cxx_supportlib/{Utils → IOTools}/IOUtils.cpp +2 -2
- data/src/cxx_supportlib/{Utils → IOTools}/IOUtils.h +3 -3
- data/src/cxx_supportlib/{Utils → IOTools}/MessageIO.h +7 -7
- data/src/cxx_supportlib/{MessageReadersWriters.h → IOTools/MessageSerialization.h} +5 -5
- data/src/cxx_supportlib/InstanceDirectory.h +4 -4
- data/src/cxx_supportlib/Integrations/LibevJsonUtils.h +3 -3
- data/src/cxx_supportlib/{Utils → JsonTools}/JsonUtils.h +5 -5
- data/src/cxx_supportlib/LoggingKit/Context.h +2 -2
- data/src/cxx_supportlib/LoggingKit/Implementation.cpp +3 -3
- data/src/cxx_supportlib/MemoryKit/mbuf.cpp +2 -2
- data/src/cxx_supportlib/ProcessManagement/Spawn.cpp +5 -5
- data/src/cxx_supportlib/ProcessManagement/Utils.h +10 -0
- data/src/cxx_supportlib/RandomGenerator.h +2 -2
- data/src/cxx_supportlib/{Crypto.cpp → SecurityKit/Crypto.cpp} +4 -4
- data/src/cxx_supportlib/{Crypto.h → SecurityKit/Crypto.h} +4 -4
- data/src/cxx_supportlib/{Utils → SecurityKit}/MemZeroGuard.h +0 -0
- data/src/cxx_supportlib/ServerKit/AcceptLoadBalancer.h +2 -2
- data/src/cxx_supportlib/ServerKit/Channel.h +1 -1
- data/src/cxx_supportlib/ServerKit/Context.h +2 -2
- data/src/cxx_supportlib/ServerKit/FileBufferedChannel.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpHeaderParser.h +3 -3
- data/src/cxx_supportlib/ServerKit/HttpHeaderParserState.h +2 -2
- data/src/cxx_supportlib/ServerKit/HttpServer.h +16 -10
- data/src/cxx_supportlib/ServerKit/Server.h +3 -3
- data/src/cxx_supportlib/{Utils → StrIntTools}/DateParsing.h +5 -5
- data/src/cxx_supportlib/{Utils → StrIntTools}/StrIntUtils.cpp +3 -3
- data/src/cxx_supportlib/{Utils → StrIntTools}/StrIntUtils.h +0 -0
- data/src/cxx_supportlib/{Utils → StrIntTools}/StrIntUtilsNoStrictAliasing.cpp +2 -2
- data/src/cxx_supportlib/{Utils → StrIntTools}/StringScanning.h +5 -5
- data/src/cxx_supportlib/{Utils → StrIntTools}/Template.h +30 -5
- data/src/cxx_supportlib/SystemTools/ContainerHelpers.h +34 -0
- data/src/cxx_supportlib/{Utils → SystemTools}/ProcessMetricsCollector.h +6 -6
- data/src/cxx_supportlib/{Utils → SystemTools}/SystemMetricsCollector.h +3 -3
- data/src/cxx_supportlib/{Utils → SystemTools}/SystemTime.cpp +1 -1
- data/src/cxx_supportlib/{Utils → SystemTools}/SystemTime.h +0 -0
- data/src/cxx_supportlib/SystemTools/UserDatabase.h +1 -1
- data/src/cxx_supportlib/Utils.cpp +2 -2
- data/src/cxx_supportlib/Utils/CachedFileStat.hpp +3 -3
- data/src/cxx_supportlib/Utils/Curl.h +2 -2
- data/src/cxx_supportlib/Utils/FileChangeChecker.h +2 -2
- data/src/cxx_supportlib/Utils/MessagePassing.h +1 -1
- data/src/cxx_supportlib/Utils/SpeedMeter.h +2 -2
- data/src/cxx_supportlib/Utils/Timer.h +2 -2
- data/src/cxx_supportlib/Utils/VariantMap.h +3 -3
- data/src/cxx_supportlib/WatchdogLauncher.h +3 -3
- data/src/cxx_supportlib/WebSocketCommandReverseServer.h +1 -1
- data/src/cxx_supportlib/WrapperRegistry/Registry.h +1 -1
- data/src/cxx_supportlib/vendor-modified/psg_sysqueue.h +3 -0
- data/src/ruby_supportlib/phusion_passenger.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/common_library.rb +11 -11
- data/src/ruby_supportlib/phusion_passenger/config/agent_compiler.rb +4 -4
- data/src/ruby_supportlib/phusion_passenger/config/nginx_engine_compiler.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/message_channel.rb +2 -2
- data/src/ruby_supportlib/phusion_passenger/packaging.rb +20 -19
- data/src/ruby_supportlib/phusion_passenger/platform_info/apache.rb +22 -4
- data/src/ruby_supportlib/phusion_passenger/platform_info/ruby.rb +33 -13
- data/src/schema_printer/SchemaPrinterMain.cpp +2 -0
- metadata +28 -86
- data/.editorconfig +0 -134
- data/CODE_OF_CONDUCT.md +0 -52
- data/dev/boost-patches/0001-Patch-boost-thread-so-that-oxt-thread-can-use-it.patch +0 -48
- data/dev/boost-patches/0002-Make-boost-thread_interrupted-derive-from-oxt-tracab.patch +0 -33
- data/dev/boost-patches/0003-Disable-a-Clang-pragma-to-prevent-warnings-on-OS-X.patch +0 -25
- data/dev/ci/README.md +0 -134
- data/dev/ci/lib/functions.sh +0 -129
- data/dev/ci/lib/set-container-envvars.sh +0 -53
- data/dev/ci/lib/setup-container.sh +0 -46
- data/dev/ci/run-tests-natively +0 -24
- data/dev/ci/run-tests-with-docker +0 -42
- data/dev/ci/scripts/debug-console-wrapper.sh +0 -29
- data/dev/ci/scripts/docker-entrypoint-stage2.sh +0 -17
- data/dev/ci/scripts/docker-entrypoint.sh +0 -17
- data/dev/ci/scripts/inituidgid +0 -17
- data/dev/ci/scripts/run-tests-natively-stage2.sh +0 -17
- data/dev/ci/scripts/setup-host-natively.sh +0 -11
- data/dev/ci/setup-host +0 -56
- data/dev/ci/tests/apache2/run +0 -6
- data/dev/ci/tests/apache2/setup +0 -4
- data/dev/ci/tests/binaries/Jenkinsfile +0 -105
- data/dev/ci/tests/binaries/build-linux +0 -38
- data/dev/ci/tests/binaries/build-macos +0 -40
- data/dev/ci/tests/binaries/prepare-macos +0 -38
- data/dev/ci/tests/binaries/test-linux +0 -45
- data/dev/ci/tests/binaries/test-macos +0 -38
- data/dev/ci/tests/cxx/run +0 -9
- data/dev/ci/tests/cxx/setup +0 -4
- data/dev/ci/tests/debian/Jenkinsfile +0 -89
- data/dev/ci/tests/debian/run +0 -60
- data/dev/ci/tests/nginx-dynamic/run +0 -20
- data/dev/ci/tests/nginx-dynamic/setup +0 -4
- data/dev/ci/tests/nginx/run +0 -5
- data/dev/ci/tests/nginx/setup +0 -4
- data/dev/ci/tests/nodejs/run +0 -4
- data/dev/ci/tests/nodejs/setup +0 -4
- data/dev/ci/tests/rpm/Jenkinsfile +0 -68
- data/dev/ci/tests/rpm/run +0 -63
- data/dev/ci/tests/ruby/run +0 -4
- data/dev/ci/tests/ruby/setup +0 -4
- data/dev/ci/tests/source-packaging/run +0 -4
- data/dev/ci/tests/source-packaging/setup +0 -4
- data/dev/ci/tests/standalone/run +0 -4
- data/dev/ci/tests/standalone/setup +0 -4
- data/dev/configkit-schemas/index.json +0 -1850
- data/dev/configkit-schemas/update_schema_inline_comments.rb +0 -118
- data/dev/rack.test/config.ru +0 -5
- data/dev/rack.test/public/asset.txt +0 -1
- data/dev/vagrant/apache_default_site.conf +0 -35
- data/dev/vagrant/apache_passenger.conf +0 -5
- data/dev/vagrant/apache_passenger.load +0 -1
- data/dev/vagrant/apache_ports.conf +0 -24
- data/dev/vagrant/apache_rack_test.conf +0 -9
- data/dev/vagrant/bashrc +0 -23
- data/dev/vagrant/nginx.conf +0 -39
- data/dev/vagrant/nginx_rakefile +0 -33
- data/dev/vagrant/nginx_start +0 -32
- data/dev/vagrant/provision.sh +0 -117
- data/dev/vagrant/sudoers.conf +0 -5
- data/resources/templates/error_renderer/.editorconfig +0 -19
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
|
3
|
-
* Copyright (c) 2011-
|
|
3
|
+
* Copyright (c) 2011-2018 Phusion Holding B.V.
|
|
4
4
|
*
|
|
5
5
|
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
|
6
6
|
* trademarks of Phusion Holding B.V.
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
#include <Exceptions.h>
|
|
51
51
|
#include <DataStructures/StringKeyTable.h>
|
|
52
52
|
#include <ProcessManagement/Utils.h>
|
|
53
|
+
#include <SystemTools/ProcessMetricsCollector.h>
|
|
54
|
+
#include <SystemTools/SystemTime.h>
|
|
53
55
|
#include <FileTools/FileManip.h>
|
|
54
|
-
#include <
|
|
55
|
-
#include <
|
|
56
|
-
#include <Utils/JsonUtils.h>
|
|
56
|
+
#include <IOTools/BufferedIO.h>
|
|
57
|
+
#include <JsonTools/JsonUtils.h>
|
|
57
58
|
#include <Utils/ScopeGuard.h>
|
|
58
|
-
#include <Utils/ProcessMetricsCollector.h>
|
|
59
59
|
#include <Utils/AsyncSignalSafeUtils.h>
|
|
60
60
|
#include <LveLoggingDecorator.h>
|
|
61
61
|
#include <Core/SpawningKit/Spawner.h>
|
|
@@ -374,7 +374,7 @@ private:
|
|
|
374
374
|
dup2(stdinCopy, 0);
|
|
375
375
|
dup2(stdoutAndErrCopy, 1);
|
|
376
376
|
dup2(stdoutAndErrCopy, 2);
|
|
377
|
-
closeAllFileDescriptors(2
|
|
377
|
+
closeAllFileDescriptors(2);
|
|
378
378
|
|
|
379
379
|
execlp(agentFilename.c_str(),
|
|
380
380
|
agentFilename.c_str(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
|
3
|
-
* Copyright (c) 2011-
|
|
3
|
+
* Copyright (c) 2011-2018 Phusion Holding B.V.
|
|
4
4
|
*
|
|
5
5
|
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
|
6
6
|
* trademarks of Phusion Holding B.V.
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
#include <modp_b64.h>
|
|
33
33
|
|
|
34
34
|
#include <LoggingKit/Logging.h>
|
|
35
|
-
#include <
|
|
35
|
+
#include <SystemTools/SystemTime.h>
|
|
36
36
|
#include <Core/SpawningKit/Context.h>
|
|
37
37
|
#include <Core/SpawningKit/Result.h>
|
|
38
38
|
#include <Core/SpawningKit/UserSwitchingRules.h>
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
#include <LoggingKit/LoggingKit.h>
|
|
47
47
|
#include <ConfigKit/ConfigKit.h>
|
|
48
48
|
#include <Utils/Curl.h>
|
|
49
|
-
#include <
|
|
49
|
+
#include <StrIntTools/StrIntUtils.h>
|
|
50
50
|
|
|
51
51
|
namespace Passenger {
|
|
52
52
|
namespace Core {
|
|
@@ -57,15 +57,21 @@ using namespace std;
|
|
|
57
57
|
class TelemetryCollector {
|
|
58
58
|
public:
|
|
59
59
|
/*
|
|
60
|
-
* BEGIN ConfigKit schema: Passenger::TelemetryCollector::Schema
|
|
60
|
+
* BEGIN ConfigKit schema: Passenger::Core::TelemetryCollector::Schema
|
|
61
61
|
* (do not edit: following text is automatically generated
|
|
62
62
|
* by 'rake configkit_schemas_inline_comments')
|
|
63
63
|
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* )
|
|
64
|
+
* ca_certificate_path string - -
|
|
65
|
+
* debug_curl boolean - default(false)
|
|
66
|
+
* disabled boolean - default(false)
|
|
67
|
+
* final_run_timeout unsigned integer - default(5)
|
|
68
|
+
* first_interval unsigned integer - default(7200)
|
|
69
|
+
* interval unsigned integer - default(21600)
|
|
70
|
+
* interval_jitter unsigned integer - default(7200)
|
|
71
|
+
* proxy_url string - -
|
|
72
|
+
* timeout unsigned integer - default(180)
|
|
73
|
+
* url string - default("https://anontelemetry.phusionpassenger.com/v1/collect.json")
|
|
74
|
+
* verify_server boolean - default(true)
|
|
69
75
|
*
|
|
70
76
|
* END
|
|
71
77
|
*/
|
data/src/agent/README.md
CHANGED
|
@@ -12,7 +12,7 @@ The most important parts are:
|
|
|
12
12
|
## Minor parts
|
|
13
13
|
|
|
14
14
|
* SpawnEnvSetupper is a tool used internally by `Core/SpawningKit/` to spawn application processes. See the README in that directory for more information.
|
|
15
|
-
* SystemMetrics is a tool that shows system metrics such as CPU and memory usage. The main functionality is implemented in src/
|
|
15
|
+
* SystemMetrics is a tool that shows system metrics such as CPU and memory usage. The main functionality is implemented in src/cxx/SystemTools/SystemMetricsCollector.h. This tool is mainly useful for developing and debugging SystemMetricsCollector.h.
|
|
16
16
|
* TempDirToucher is a tool used internally by Passenger Standalone to keep a temporary directory's timestamp up-to-date so that it doesn't get removed by /tmp cleaner daemons.
|
|
17
17
|
|
|
18
18
|
## Shared code
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
#include <StaticString.h>
|
|
39
39
|
#include <FileTools/PathManip.h>
|
|
40
40
|
#include <Utils.h>
|
|
41
|
-
#include <
|
|
41
|
+
#include <StrIntTools/StrIntUtils.h>
|
|
42
42
|
|
|
43
43
|
namespace Passenger {
|
|
44
44
|
namespace ApiAccountUtils { // Avoid conflict with classes of the same name in ApiServerUtils.h, until we've migrated everything
|
|
@@ -72,9 +72,9 @@
|
|
|
72
72
|
#include <LoggingKit/LoggingKit.h>
|
|
73
73
|
#include <LoggingKit/Context.h>
|
|
74
74
|
#include <Utils.h>
|
|
75
|
-
#include <
|
|
76
|
-
#include <
|
|
77
|
-
#include <
|
|
75
|
+
#include <IOTools/IOUtils.h>
|
|
76
|
+
#include <IOTools/BufferedIO.h>
|
|
77
|
+
#include <StrIntTools/StrIntUtils.h>
|
|
78
78
|
#include <Utils/VariantMap.h>
|
|
79
79
|
#include <Shared/ApplicationPoolApiKey.h>
|
|
80
80
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
|
3
|
-
* Copyright (c) 2015-
|
|
3
|
+
* Copyright (c) 2015-2018 Phusion Holding B.V.
|
|
4
4
|
*
|
|
5
5
|
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
|
6
6
|
* trademarks of Phusion Holding B.V.
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
#include <cstring>
|
|
32
32
|
#include <Exceptions.h>
|
|
33
33
|
#include <StaticString.h>
|
|
34
|
-
#include <
|
|
34
|
+
#include <StrIntTools/StrIntUtils.h>
|
|
35
35
|
|
|
36
36
|
namespace Passenger {
|
|
37
37
|
namespace ApplicationPool2 {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
|
3
|
-
* Copyright (c) 2010-
|
|
3
|
+
* Copyright (c) 2010-2018 Phusion Holding B.V.
|
|
4
4
|
*
|
|
5
5
|
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
|
6
6
|
* trademarks of Phusion Holding B.V.
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
#include <ResourceLocator.h>
|
|
51
51
|
#include <LoggingKit/LoggingKit.h>
|
|
52
52
|
#include <LoggingKit/Context.h>
|
|
53
|
-
#include <
|
|
54
|
-
#include <
|
|
55
|
-
#include <
|
|
53
|
+
#include <StrIntTools/StrIntUtils.h>
|
|
54
|
+
#include <IOTools/MessageIO.h>
|
|
55
|
+
#include <SystemTools/SystemTime.h>
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
namespace Passenger {
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
#include <FileTools/PathManip.h>
|
|
65
65
|
#include <SystemTools/UserDatabase.h>
|
|
66
66
|
#include <Utils.h>
|
|
67
|
-
#include <
|
|
67
|
+
#include <StrIntTools/StrIntUtils.h>
|
|
68
68
|
#include <Core/SpawningKit/Handshake/WorkDir.h>
|
|
69
69
|
#include <Core/SpawningKit/Exceptions.h>
|
|
70
70
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
|
3
|
-
* Copyright (c) 2014-
|
|
3
|
+
* Copyright (c) 2014-2018 Phusion Holding B.V.
|
|
4
4
|
*
|
|
5
5
|
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
|
6
6
|
* trademarks of Phusion Holding B.V.
|
|
@@ -28,9 +28,10 @@
|
|
|
28
28
|
#include <unistd.h>
|
|
29
29
|
#include <cstdio>
|
|
30
30
|
#include <cstring>
|
|
31
|
+
|
|
32
|
+
#include <SystemTools/SystemMetricsCollector.h>
|
|
31
33
|
#include <Utils.h>
|
|
32
|
-
#include <
|
|
33
|
-
#include <Utils/SystemMetricsCollector.h>
|
|
34
|
+
#include <StrIntTools/StrIntUtils.h>
|
|
34
35
|
|
|
35
36
|
using namespace std;
|
|
36
37
|
using namespace Passenger;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
|
3
|
-
* Copyright (c) 2014-
|
|
3
|
+
* Copyright (c) 2014-2018 Phusion Holding B.V.
|
|
4
4
|
*
|
|
5
5
|
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
|
6
6
|
* trademarks of Phusion Holding B.V.
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
#include <StaticString.h>
|
|
41
41
|
#include <LoggingKit/LoggingKit.h>
|
|
42
42
|
#include <Constants.h>
|
|
43
|
-
#include <
|
|
44
|
-
#include <
|
|
43
|
+
#include <StrIntTools/StrIntUtils.h>
|
|
44
|
+
#include <IOTools/MessageIO.h>
|
|
45
45
|
|
|
46
46
|
namespace Passenger {
|
|
47
47
|
namespace Watchdog {
|
data/src/agent/Watchdog/Config.h
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
#include <Watchdog/ApiServer.h>
|
|
34
34
|
#include <Shared/ApiAccountUtils.h>
|
|
35
35
|
#include <Utils.h>
|
|
36
|
-
#include <
|
|
36
|
+
#include <StrIntTools/StrIntUtils.h>
|
|
37
37
|
|
|
38
38
|
namespace Passenger {
|
|
39
39
|
namespace Watchdog {
|
|
@@ -146,7 +146,7 @@ using namespace std;
|
|
|
146
146
|
* security_update_checker_interval unsigned integer - default(86400)
|
|
147
147
|
* security_update_checker_proxy_url string - -
|
|
148
148
|
* security_update_checker_url string - default("https://securitycheck.phusionpassenger.com/v1/check.json")
|
|
149
|
-
* server_software string - default("Phusion_Passenger/5.3.
|
|
149
|
+
* server_software string - default("Phusion_Passenger/5.3.6")
|
|
150
150
|
* setsid boolean - default(false)
|
|
151
151
|
* show_version_in_header boolean - default(true)
|
|
152
152
|
* single_app_mode_app_root string - default,read_only
|
|
@@ -296,6 +296,7 @@ public:
|
|
|
296
296
|
core.translator.finalize();
|
|
297
297
|
addSubSchema(core.schema, core.translator);
|
|
298
298
|
erase("instance_dir");
|
|
299
|
+
erase("oom_score");
|
|
299
300
|
erase("watchdog_fd_passing_password");
|
|
300
301
|
/***********/
|
|
301
302
|
/***********/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Phusion Passenger - https://www.phusionpassenger.com/
|
|
3
|
-
* Copyright (c) 2010-
|
|
3
|
+
* Copyright (c) 2010-2018 Phusion Holding B.V.
|
|
4
4
|
*
|
|
5
5
|
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
|
6
6
|
* trademarks of Phusion Holding B.V.
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
#include <Shared/Fundamentals/Utils.h>
|
|
28
|
-
#include <
|
|
28
|
+
#include <IOTools/MessageIO.h>
|
|
29
29
|
|
|
30
30
|
class CoreWatcher: public AgentWatcher {
|
|
31
31
|
protected:
|
|
@@ -73,18 +73,19 @@
|
|
|
73
73
|
#include <FileDescriptor.h>
|
|
74
74
|
#include <FileTools/PathSecurityCheck.h>
|
|
75
75
|
#include <SystemTools/UserDatabase.h>
|
|
76
|
+
#include <SystemTools/ContainerHelpers.h>
|
|
76
77
|
#include <RandomGenerator.h>
|
|
77
78
|
#include <BackgroundEventLoop.h>
|
|
78
79
|
#include <LoggingKit/LoggingKit.h>
|
|
79
80
|
#include <Exceptions.h>
|
|
80
81
|
#include <StaticString.h>
|
|
81
82
|
#include <Hooks.h>
|
|
83
|
+
#include <IOTools/IOUtils.h>
|
|
84
|
+
#include <IOTools/MessageIO.h>
|
|
82
85
|
#include <Utils.h>
|
|
83
86
|
#include <Utils/Timer.h>
|
|
84
87
|
#include <Utils/ScopeGuard.h>
|
|
85
|
-
#include <
|
|
86
|
-
#include <Utils/IOUtils.h>
|
|
87
|
-
#include <Utils/MessageIO.h>
|
|
88
|
+
#include <StrIntTools/StrIntUtils.h>
|
|
88
89
|
#include <Utils/OptionParsing.h>
|
|
89
90
|
#include <Utils/VariantMap.h>
|
|
90
91
|
|
|
@@ -180,8 +181,22 @@ static void cleanup(const WorkingObjectsPtr &wo);
|
|
|
180
181
|
/***** Functions *****/
|
|
181
182
|
|
|
182
183
|
#if !BOOST_OS_MACOS
|
|
184
|
+
|
|
185
|
+
struct WatchdogOomAdjustResult {
|
|
186
|
+
struct Message {
|
|
187
|
+
LoggingKit::Level level;
|
|
188
|
+
string text;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
string oldScore;
|
|
192
|
+
// LoggingKit has not been initialized yet when setOomScoreNeverKill()
|
|
193
|
+
// is called, so we store the messages here and print them after
|
|
194
|
+
// LoggingKit initialization.
|
|
195
|
+
vector<Message> messages;
|
|
196
|
+
};
|
|
197
|
+
|
|
183
198
|
static FILE *
|
|
184
|
-
openOomAdjFileGetType(const char *mode, OomFileType &type) {
|
|
199
|
+
openOomAdjFileGetType(const char *mode, OomFileType &type, string &path) {
|
|
185
200
|
FILE *f = fopen("/proc/self/oom_score_adj", mode);
|
|
186
201
|
if (f == NULL) {
|
|
187
202
|
f = fopen("/proc/self/oom_adj", mode);
|
|
@@ -189,40 +204,46 @@ openOomAdjFileGetType(const char *mode, OomFileType &type) {
|
|
|
189
204
|
return NULL;
|
|
190
205
|
} else {
|
|
191
206
|
type = OOM_ADJ;
|
|
207
|
+
path = "/proc/self/oom_adj";
|
|
192
208
|
return f;
|
|
193
209
|
}
|
|
194
210
|
} else {
|
|
195
211
|
type = OOM_SCORE_ADJ;
|
|
212
|
+
path = "/proc/self/oom_score_adj";
|
|
196
213
|
return f;
|
|
197
214
|
}
|
|
198
215
|
}
|
|
199
216
|
|
|
200
|
-
static FILE *
|
|
201
|
-
openOomAdjFileForcedType(const char *mode, OomFileType &type) {
|
|
202
|
-
if (type == OOM_SCORE_ADJ) {
|
|
203
|
-
return fopen("/proc/self/oom_score_adj", mode);
|
|
204
|
-
} else {
|
|
205
|
-
assert(type == OOM_ADJ);
|
|
206
|
-
return fopen("/proc/self/oom_adj", mode);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
217
|
/**
|
|
211
218
|
* Set the current process's OOM score to "never kill".
|
|
212
219
|
*/
|
|
213
|
-
static
|
|
220
|
+
static WatchdogOomAdjustResult
|
|
214
221
|
setOomScoreNeverKill() {
|
|
215
|
-
|
|
222
|
+
WatchdogOomAdjustResult result;
|
|
216
223
|
FILE *f;
|
|
224
|
+
string path;
|
|
217
225
|
OomFileType type;
|
|
226
|
+
int e;
|
|
227
|
+
|
|
228
|
+
if (geteuid() != 0) {
|
|
229
|
+
WatchdogOomAdjustResult::Message msg;
|
|
230
|
+
msg.level = LoggingKit::DEBUG;
|
|
231
|
+
msg.text = "Not adjusting Watchdog's OOM score because not running with root privileges";
|
|
232
|
+
result.messages.push_back(msg);
|
|
233
|
+
return result;
|
|
234
|
+
}
|
|
218
235
|
|
|
219
|
-
f = openOomAdjFileGetType("r", type);
|
|
236
|
+
f = openOomAdjFileGetType("r", type, path);
|
|
220
237
|
if (f == NULL) {
|
|
221
|
-
|
|
238
|
+
e = errno;
|
|
239
|
+
P_ERROR("Error adjusting Watchdog's OOM score: error opening both"
|
|
240
|
+
" /proc/self/oom_score_adj and /proc/self/oom_adj for reading: " <<
|
|
241
|
+
strerror(e) << " (errno=" << e << ")");
|
|
242
|
+
return result;
|
|
222
243
|
}
|
|
223
244
|
// mark if this is a legacy score so we won't try to write it as OOM_SCORE_ADJ
|
|
224
245
|
if (type == OOM_ADJ) {
|
|
225
|
-
oldScore.append("l");
|
|
246
|
+
result.oldScore.append("l");
|
|
226
247
|
}
|
|
227
248
|
char buf[1024];
|
|
228
249
|
size_t bytesRead;
|
|
@@ -231,17 +252,27 @@ setOomScoreNeverKill() {
|
|
|
231
252
|
if (bytesRead == 0 && feof(f)) {
|
|
232
253
|
break;
|
|
233
254
|
} else if (bytesRead == 0 && ferror(f)) {
|
|
255
|
+
P_ERROR("Error adjusting Watchdog's OOM score: error reading " << path);
|
|
234
256
|
fclose(f);
|
|
235
|
-
|
|
257
|
+
result.oldScore.clear();
|
|
258
|
+
return result;
|
|
236
259
|
} else {
|
|
237
|
-
oldScore.append(buf, bytesRead);
|
|
260
|
+
result.oldScore.append(buf, bytesRead);
|
|
238
261
|
}
|
|
239
262
|
}
|
|
240
263
|
fclose(f);
|
|
241
264
|
|
|
242
|
-
f =
|
|
265
|
+
f = fopen(path.c_str(), "w");
|
|
243
266
|
if (f == NULL) {
|
|
244
|
-
|
|
267
|
+
e = errno;
|
|
268
|
+
WatchdogOomAdjustResult::Message msg;
|
|
269
|
+
msg.level = LoggingKit::ERROR;
|
|
270
|
+
msg.text = "Error adjusting Watchdog's OOM score: error opening "
|
|
271
|
+
+ path + " for writing: " + strerror(e) + " (errno="
|
|
272
|
+
+ toString(e) + ")";
|
|
273
|
+
result.messages.push_back(msg);
|
|
274
|
+
result.oldScore.clear();
|
|
275
|
+
return result;
|
|
245
276
|
}
|
|
246
277
|
if (type == OOM_SCORE_ADJ) {
|
|
247
278
|
fprintf(f, "-1000\n");
|
|
@@ -249,10 +280,44 @@ setOomScoreNeverKill() {
|
|
|
249
280
|
assert(type == OOM_ADJ);
|
|
250
281
|
fprintf(f, "-17\n");
|
|
251
282
|
}
|
|
252
|
-
fclose(f);
|
|
253
283
|
|
|
254
|
-
|
|
284
|
+
e = fflush(f);
|
|
285
|
+
if (e != 0) {
|
|
286
|
+
e = errno;
|
|
287
|
+
WatchdogOomAdjustResult::Message msg;
|
|
288
|
+
if (autoDetectInContainer()) {
|
|
289
|
+
msg.level = LoggingKit::INFO;
|
|
290
|
+
msg.text = "Running in container, so couldn't adjust Watchdog's"
|
|
291
|
+
" OOM score through " + path;
|
|
292
|
+
} else {
|
|
293
|
+
msg.level = LoggingKit::ERROR;
|
|
294
|
+
msg.text = "Error adjusting Watchdog's OOM score: error writing to "
|
|
295
|
+
+ path + ": " + strerror(e) + " (errno=" + toString(e) + ")";
|
|
296
|
+
}
|
|
297
|
+
result.messages.push_back(msg);
|
|
298
|
+
}
|
|
299
|
+
e = fclose(f);
|
|
300
|
+
if (e == EOF) {
|
|
301
|
+
e = errno;
|
|
302
|
+
WatchdogOomAdjustResult::Message msg;
|
|
303
|
+
msg.level = LoggingKit::ERROR;
|
|
304
|
+
msg.text = "Error adjusting Watchdog's OOM score: error closing "
|
|
305
|
+
+ path + ": " + strerror(e) + " (errno=" + toString(e) + ")";
|
|
306
|
+
result.messages.push_back(msg);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return result;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
static void
|
|
313
|
+
printOomAdjustResultMessages(const WatchdogOomAdjustResult &result) {
|
|
314
|
+
vector<WatchdogOomAdjustResult::Message>::const_iterator it;
|
|
315
|
+
|
|
316
|
+
for (it = result.messages.begin(); it != result.messages.end(); it++) {
|
|
317
|
+
P_LOG(LoggingKit::context, it->level, __FILE__, __LINE__, it->text);
|
|
318
|
+
}
|
|
255
319
|
}
|
|
320
|
+
|
|
256
321
|
#endif
|
|
257
322
|
|
|
258
323
|
static void
|
|
@@ -798,7 +863,7 @@ initializeBareEssentials(int argc, char *argv[], WorkingObjectsPtr &wo) {
|
|
|
798
863
|
* so we need to restore it after each fork().
|
|
799
864
|
*/
|
|
800
865
|
#if !BOOST_OS_MACOS
|
|
801
|
-
|
|
866
|
+
WatchdogOomAdjustResult oomAdjustResult = setOomScoreNeverKill();
|
|
802
867
|
#endif
|
|
803
868
|
|
|
804
869
|
watchdogWrapperRegistry = new WrapperRegistry::Registry();
|
|
@@ -815,7 +880,8 @@ initializeBareEssentials(int argc, char *argv[], WorkingObjectsPtr &wo) {
|
|
|
815
880
|
wo = boost::make_shared<WorkingObjects>();
|
|
816
881
|
workingObjects = wo.get();
|
|
817
882
|
#if !BOOST_OS_MACOS
|
|
818
|
-
|
|
883
|
+
printOomAdjustResultMessages(oomAdjustResult);
|
|
884
|
+
wo->extraConfigToPassToSubAgents["oom_score"] = oomAdjustResult.oldScore;
|
|
819
885
|
#endif
|
|
820
886
|
}
|
|
821
887
|
|