passenger 6.2.0 → 6.2.1
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 +33 -1
- data/CONTRIBUTING.md +7 -311
- data/CONTRIBUTORS +1 -0
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/bin/passenger +1 -1
- data/bin/passenger-config +1 -1
- data/bin/passenger-install-apache2-module +1 -1
- data/bin/passenger-install-nginx-module +4 -9
- data/bin/passenger-memory-stats +1 -1
- data/bin/passenger-status +1 -1
- data/build/agent.rb +13 -15
- data/build/apache2.rb +13 -16
- data/build/basics.rb +10 -13
- data/build/common_library.rb +5 -9
- data/build/cxx_tests.rb +37 -12
- data/build/integration_tests.rb +5 -2
- data/build/misc.rb +1 -1
- data/build/nginx.rb +1 -1
- data/build/node_tests.rb +1 -1
- data/build/oxt_tests.rb +6 -8
- data/build/packaging.rb +1 -1
- data/build/ruby_extension.rb +1 -1
- data/build/ruby_tests.rb +1 -1
- data/build/schema_printer.rb +13 -15
- data/build/support/cplusplus.rb +61 -69
- data/build/support/cxx_dependency_map.rb +2 -1
- data/build/support/general.rb +1 -1
- data/build/support/vendor/cxx_hinted_parser/LICENSE.md +1 -1
- data/build/support/vendor/cxx_hinted_parser/lib/cxx_hinted_parser/parser.rb +1 -1
- data/build/support/vendor/cxx_hinted_parser/lib/cxx_hinted_parser.rb +1 -1
- data/build/support/vendor/cxxcodebuilder/LICENSE.md +1 -1
- data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder/builder.rb +1 -1
- data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder/initializer_builder.rb +1 -1
- data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder.rb +1 -1
- data/build/test_basics.rb +1 -1
- data/dev/copy_boost_headers +1 -1
- data/dev/index_cxx_dependencies.rb +5 -1
- data/dev/libev-changes.patch +108 -0
- data/dev/nginx_version_sha256 +1 -1
- data/dev/ruby_server.rb +1 -6
- data/dev/upgrading_libuv.sh +16 -0
- data/doc/BasicArchitectureOverview.md +55 -0
- data/doc/BuildCaching.md +23 -0
- data/doc/BuildSystem.md +49 -0
- data/doc/DebuggingAndStressTesting.md +2 -0
- data/doc/DesignAspects/LimitedGemDependencies.md +1 -0
- data/doc/DevEnvironmentSetup.md +46 -0
- data/doc/DevHandbook.md +28 -0
- data/doc/Packaging.md +1 -1
- data/doc/RunningTests.md +88 -0
- data/doc/{TempFileHandling.md → SecureTempFileHandling.md} +1 -1
- data/doc/{CxxTestingGuide.md → WritingCxxTests.md} +1 -20
- data/src/agent/AgentMain.cpp +1 -1
- data/src/agent/Core/ApiServer.h +1 -1
- data/src/agent/Core/ApplicationPool/AbstractSession.h +1 -1
- data/src/agent/Core/ApplicationPool/BasicGroupInfo.h +1 -1
- data/src/agent/Core/ApplicationPool/BasicProcessInfo.h +1 -1
- data/src/agent/Core/ApplicationPool/Common.h +1 -1
- data/src/agent/Core/ApplicationPool/Context.h +1 -1
- data/src/agent/Core/ApplicationPool/Group/InitializationAndShutdown.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/InternalUtils.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/LifetimeAndBasics.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/Miscellaneous.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/OutOfBandWork.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/ProcessListManagement.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/SessionManagement.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/SpawningAndRestarting.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/StateInspection.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group/Verification.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Group.h +1 -1
- data/src/agent/Core/ApplicationPool/Implementation.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Options.h +1 -1
- data/src/agent/Core/ApplicationPool/Pool/AnalyticsCollection.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/GarbageCollection.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/GeneralUtils.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/GroupUtils.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/InitializationAndShutdown.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/Miscellaneous.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/ProcessUtils.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/StateInspection.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool.h +1 -1
- data/src/agent/Core/ApplicationPool/Process.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Process.h +1 -1
- data/src/agent/Core/ApplicationPool/Session.h +1 -1
- data/src/agent/Core/ApplicationPool/Socket.h +1 -1
- data/src/agent/Core/ApplicationPool/TestSession.h +1 -1
- data/src/agent/Core/Config.h +3 -2
- data/src/agent/Core/ConfigChange.cpp +1 -1
- data/src/agent/Core/ConfigChange.h +1 -1
- data/src/agent/Core/Controller/AppResponse.h +1 -1
- data/src/agent/Core/Controller/BufferBody.cpp +1 -1
- data/src/agent/Core/Controller/CheckoutSession.cpp +8 -5
- data/src/agent/Core/Controller/Client.h +1 -1
- data/src/agent/Core/Controller/Config.cpp +1 -1
- data/src/agent/Core/Controller/Config.h +2 -2
- data/src/agent/Core/Controller/ForwardResponse.cpp +2 -2
- data/src/agent/Core/Controller/Hooks.cpp +12 -9
- data/src/agent/Core/Controller/Implementation.cpp +1 -1
- data/src/agent/Core/Controller/InitRequest.cpp +1 -1
- data/src/agent/Core/Controller/InitializationAndShutdown.cpp +1 -1
- data/src/agent/Core/Controller/InternalUtils.cpp +1 -1
- data/src/agent/Core/Controller/Miscellaneous.cpp +1 -1
- data/src/agent/Core/Controller/Request.h +1 -1
- data/src/agent/Core/Controller/SendRequest.cpp +1 -1
- data/src/agent/Core/Controller/StateInspection.cpp +1 -1
- data/src/agent/Core/Controller/TurboCaching.h +1 -1
- data/src/agent/Core/Controller.h +1 -1
- data/src/agent/Core/CoreMain.cpp +1 -1
- data/src/agent/Core/OptionParser.h +1 -1
- data/src/agent/Core/ResponseCache.h +1 -1
- data/src/agent/Core/SecurityUpdateChecker.h +1 -1
- data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h +1 -1
- data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h.cxxcodebuilder +1 -1
- data/src/agent/Core/SpawningKit/Config.h +1 -1
- data/src/agent/Core/SpawningKit/Context.h +1 -1
- data/src/agent/Core/SpawningKit/DirectSpawner.h +1 -1
- data/src/agent/Core/SpawningKit/DummySpawner.h +1 -1
- data/src/agent/Core/SpawningKit/ErrorRenderer.h +1 -1
- data/src/agent/Core/SpawningKit/Exceptions.h +63 -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 +3 -2
- data/src/agent/Core/SpawningKit/Handshake/Prepare.h +1 -1
- data/src/agent/Core/SpawningKit/Handshake/Session.h +1 -1
- data/src/agent/Core/SpawningKit/Handshake/WorkDir.h +1 -1
- data/src/agent/Core/SpawningKit/Journey.h +1 -1
- data/src/agent/Core/SpawningKit/PipeWatcher.h +1 -1
- data/src/agent/Core/SpawningKit/README.md +3 -3
- data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h +1 -1
- data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h.cxxcodebuilder +1 -1
- data/src/agent/Core/SpawningKit/Result.h +1 -1
- data/src/agent/Core/SpawningKit/SmartSpawner.h +17 -17
- data/src/agent/Core/SpawningKit/Spawner.h +1 -1
- data/src/agent/Core/SpawningKit/UserSwitchingRules.h +1 -1
- data/src/agent/Core/TelemetryCollector.h +1 -1
- data/src/agent/ExecHelper/ExecHelperMain.cpp +1 -1
- data/src/agent/FileReadHelper/FileReadHelperMain.cpp +1 -1
- data/src/agent/MainFunctions.h +1 -1
- data/src/agent/Shared/ApiAccountUtils.h +4 -3
- data/src/agent/Shared/ApiServerUtils.h +1 -2
- data/src/agent/Shared/ApplicationPoolApiKey.h +1 -1
- data/src/agent/Shared/Fundamentals/AbortHandler.cpp +1 -1
- data/src/agent/Shared/Fundamentals/AbortHandler.h +1 -1
- data/src/agent/Shared/Fundamentals/Initialization.cpp +1 -1
- data/src/agent/Shared/Fundamentals/Initialization.h +1 -1
- data/src/agent/Shared/Fundamentals/Utils.cpp +1 -1
- data/src/agent/Shared/Fundamentals/Utils.h +1 -1
- data/src/agent/SpawnEnvSetupper/SpawnEnvSetupperMain.cpp +1 -1
- data/src/agent/SystemMetrics/SystemMetricsMain.cpp +1 -1
- data/src/agent/TempDirToucher/TempDirToucherMain.cpp +1 -1
- data/src/agent/Watchdog/ApiServer.h +7 -6
- data/src/agent/Watchdog/Config.h +2 -2
- data/src/apache2_module/Bucket.cpp +1 -1
- data/src/apache2_module/Bucket.h +1 -1
- data/src/apache2_module/CBindings.cpp +1 -1
- data/src/apache2_module/Config.cpp +1 -1
- data/src/apache2_module/Config.h +1 -1
- data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +104 -104
- data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp.cxxcodebuilder +2 -2
- data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp +1 -1
- data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp.cxxcodebuilder +1 -1
- data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp +1 -1
- data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp.cxxcodebuilder +1 -1
- data/src/apache2_module/ConfigGeneral/Common.h +1 -1
- data/src/apache2_module/ConfigGeneral/ManifestGeneration.h +1 -1
- data/src/apache2_module/ConfigGeneral/SetterFuncs.h +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp.cxxcodebuilder +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp.cxxcodebuilder +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp.cxxcodebuilder +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp.cxxcodebuilder +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedStruct.h +1 -1
- data/src/apache2_module/DirConfig/AutoGeneratedStruct.h.cxxcodebuilder +1 -1
- data/src/apache2_module/DirectoryMapper.h +1 -1
- data/src/apache2_module/Hooks.cpp +8 -2
- data/src/apache2_module/Hooks.h +1 -1
- data/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp +1 -1
- data/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp.cxxcodebuilder +1 -1
- data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h +1 -1
- data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h.cxxcodebuilder +1 -1
- data/src/apache2_module/Utils.h +1 -1
- data/src/apache2_module/mod_passenger.c +1 -1
- data/src/cxx_supportlib/Algorithms/Hasher.cpp +1 -1
- data/src/cxx_supportlib/Algorithms/Hasher.h +1 -1
- data/src/cxx_supportlib/Algorithms/MovingAverage.h +1 -1
- data/src/cxx_supportlib/AppLocalConfigFileUtils.h +1 -1
- data/src/cxx_supportlib/AppTypeDetector/CBindings.cpp +1 -1
- data/src/cxx_supportlib/AppTypeDetector/CBindings.h +1 -1
- data/src/cxx_supportlib/AppTypeDetector/Detector.h +1 -1
- data/src/cxx_supportlib/BackgroundEventLoop.cpp +1 -1
- data/src/cxx_supportlib/BackgroundEventLoop.h +1 -1
- data/src/cxx_supportlib/ConfigKit/AsyncUtils.h +1 -1
- data/src/cxx_supportlib/ConfigKit/Common.h +1 -1
- data/src/cxx_supportlib/ConfigKit/ConfigKit.h +1 -1
- data/src/cxx_supportlib/ConfigKit/DummyTranslator.h +1 -1
- data/src/cxx_supportlib/ConfigKit/IN_PRACTICE.md +1 -3
- data/src/cxx_supportlib/ConfigKit/PrefixTranslator.h +3 -3
- data/src/cxx_supportlib/ConfigKit/Schema.h +1 -1
- data/src/cxx_supportlib/ConfigKit/SchemaUtils.h +1 -1
- data/src/cxx_supportlib/ConfigKit/Store.h +1 -1
- data/src/cxx_supportlib/ConfigKit/SubComponentUtils.h +1 -1
- data/src/cxx_supportlib/ConfigKit/TableTranslator.h +1 -1
- data/src/cxx_supportlib/ConfigKit/Translator.h +1 -1
- data/src/cxx_supportlib/ConfigKit/Utils.h +1 -1
- data/src/cxx_supportlib/Constants.h +2 -2
- data/src/cxx_supportlib/Constants.h.cxxcodebuilder +1 -1
- data/src/cxx_supportlib/DataStructures/HashedStaticString.h +1 -1
- data/src/cxx_supportlib/DataStructures/LString.cpp +1 -1
- data/src/cxx_supportlib/DataStructures/LString.h +1 -1
- data/src/cxx_supportlib/DataStructures/StringKeyTable.h +1 -1
- data/src/cxx_supportlib/DataStructures/StringMap.h +1 -1
- data/src/cxx_supportlib/Exceptions.cpp +1 -1
- data/src/cxx_supportlib/Exceptions.h +1 -1
- data/src/cxx_supportlib/FileDescriptor.h +1 -1
- data/src/cxx_supportlib/FileTools/FileManip.cpp +1 -1
- data/src/cxx_supportlib/FileTools/FileManip.h +1 -1
- data/src/cxx_supportlib/FileTools/PathManip.cpp +1 -1
- data/src/cxx_supportlib/FileTools/PathManip.h +1 -1
- data/src/cxx_supportlib/FileTools/PathManipCBindings.cpp +1 -1
- data/src/cxx_supportlib/FileTools/PathManipCBindings.h +1 -1
- data/src/cxx_supportlib/FileTools/PathSecurityCheck.cpp +1 -1
- data/src/cxx_supportlib/FileTools/PathSecurityCheck.h +1 -1
- data/src/cxx_supportlib/Hooks.h +1 -1
- data/src/cxx_supportlib/IOTools/BufferedIO.h +1 -1
- data/src/cxx_supportlib/IOTools/IOUtils.cpp +10 -10
- data/src/cxx_supportlib/IOTools/IOUtils.h +1 -1
- data/src/cxx_supportlib/IOTools/MessageIO.h +1 -1
- data/src/cxx_supportlib/IOTools/MessageSerialization.h +1 -1
- data/src/cxx_supportlib/InstanceDirectory.h +1 -1
- data/src/cxx_supportlib/Integrations/LibevJsonUtils.h +1 -1
- data/src/cxx_supportlib/JsonTools/Autocast.h +1 -1
- data/src/cxx_supportlib/JsonTools/CBindings.cpp +1 -1
- data/src/cxx_supportlib/JsonTools/CBindings.h +1 -1
- data/src/cxx_supportlib/JsonTools/JsonUtils.h +1 -1
- data/src/cxx_supportlib/LoggingKit/Assert.h +1 -1
- data/src/cxx_supportlib/LoggingKit/Config.h +2 -1
- data/src/cxx_supportlib/LoggingKit/Context.h +1 -1
- data/src/cxx_supportlib/LoggingKit/Forward.h +1 -1
- data/src/cxx_supportlib/LoggingKit/Implementation.cpp +11 -1
- data/src/cxx_supportlib/LoggingKit/Logging.h +1 -1
- data/src/cxx_supportlib/LoggingKit/LoggingKit.h +1 -1
- data/src/cxx_supportlib/LveLoggingDecorator.h +1 -1
- data/src/cxx_supportlib/MemoryKit/mbuf.cpp +1 -1
- data/src/cxx_supportlib/MemoryKit/mbuf.h +1 -1
- data/src/cxx_supportlib/MemoryKit/palloc.cpp +1 -1
- data/src/cxx_supportlib/MemoryKit/palloc.h +1 -1
- data/src/cxx_supportlib/ProcessManagement/Ruby.cpp +1 -1
- data/src/cxx_supportlib/ProcessManagement/Ruby.h +1 -1
- data/src/cxx_supportlib/ProcessManagement/Spawn.cpp +1 -1
- data/src/cxx_supportlib/ProcessManagement/Spawn.h +1 -1
- data/src/cxx_supportlib/ProcessManagement/Utils.cpp +1 -1
- data/src/cxx_supportlib/ProcessManagement/Utils.h +1 -1
- data/src/cxx_supportlib/RandomGenerator.h +1 -1
- data/src/cxx_supportlib/ResourceLocator.h +1 -1
- data/src/cxx_supportlib/SafeLibev.h +1 -1
- data/src/cxx_supportlib/SecurityKit/Crypto.cpp +9 -27
- data/src/cxx_supportlib/SecurityKit/Crypto.h +2 -2
- data/src/cxx_supportlib/SecurityKit/MemZeroGuard.h +1 -1
- data/src/cxx_supportlib/ServerKit/AcceptLoadBalancer.h +1 -1
- data/src/cxx_supportlib/ServerKit/Channel.h +1 -1
- data/src/cxx_supportlib/ServerKit/Client.h +1 -1
- data/src/cxx_supportlib/ServerKit/ClientRef.h +1 -1
- data/src/cxx_supportlib/ServerKit/Config.h +1 -1
- data/src/cxx_supportlib/ServerKit/Context.h +1 -1
- data/src/cxx_supportlib/ServerKit/CookieUtils.h +1 -1
- data/src/cxx_supportlib/ServerKit/Errors.h +1 -1
- data/src/cxx_supportlib/ServerKit/FdSinkChannel.h +1 -1
- data/src/cxx_supportlib/ServerKit/FdSourceChannel.h +1 -1
- data/src/cxx_supportlib/ServerKit/FileBufferedChannel.h +54 -2
- data/src/cxx_supportlib/ServerKit/FileBufferedFdSinkChannel.h +1 -1
- data/src/cxx_supportlib/ServerKit/HeaderTable.h +1 -1
- data/src/cxx_supportlib/ServerKit/Hooks.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpChunkedBodyParser.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpChunkedBodyParserState.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpClient.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpHeaderParser.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpHeaderParserState.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpRequest.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpRequestRef.h +1 -1
- data/src/cxx_supportlib/ServerKit/HttpServer.h +1 -1
- data/src/cxx_supportlib/ServerKit/Implementation.cpp +1 -1
- data/src/cxx_supportlib/ServerKit/Server.h +4 -2
- data/src/cxx_supportlib/StaticString.h +1 -1
- data/src/cxx_supportlib/StrIntTools/DateParsing.h +1 -1
- data/src/cxx_supportlib/StrIntTools/StrIntUtils.cpp +1 -1
- data/src/cxx_supportlib/StrIntTools/StrIntUtils.h +1 -1
- data/src/cxx_supportlib/StrIntTools/StrIntUtilsNoStrictAliasing.cpp +1 -1
- data/src/cxx_supportlib/StrIntTools/StringScanning.h +1 -1
- data/src/cxx_supportlib/StrIntTools/Template.h +1 -1
- data/src/cxx_supportlib/SystemTools/ContainerHelpers.h +1 -1
- data/src/cxx_supportlib/SystemTools/ProcessMetricsCollector.h +1 -1
- data/src/cxx_supportlib/SystemTools/SystemMetricsCollector.h +1 -1
- data/src/cxx_supportlib/SystemTools/SystemTime.cpp +1 -1
- data/src/cxx_supportlib/SystemTools/SystemTime.h +1 -1
- data/src/cxx_supportlib/SystemTools/UserDatabase.cpp +1 -1
- data/src/cxx_supportlib/SystemTools/UserDatabase.h +1 -1
- data/src/cxx_supportlib/Utils/AnsiColorConstants.h +1 -1
- data/src/cxx_supportlib/Utils/AsyncSignalSafeUtils.h +1 -1
- data/src/cxx_supportlib/Utils/BlockingQueue.h +1 -1
- data/src/cxx_supportlib/Utils/CachedFileStat.cpp +1 -1
- data/src/cxx_supportlib/Utils/CachedFileStat.h +1 -1
- data/src/cxx_supportlib/Utils/CachedFileStat.hpp +1 -1
- data/src/cxx_supportlib/Utils/ClassUtils.h +1 -1
- data/src/cxx_supportlib/Utils/Curl.h +1 -1
- data/src/cxx_supportlib/Utils/FastStringStream.h +1 -1
- data/src/cxx_supportlib/Utils/FileChangeChecker.h +1 -1
- data/src/cxx_supportlib/Utils/HttpConstants.h +1 -1
- data/src/cxx_supportlib/Utils/IniFile.h +1 -1
- data/src/cxx_supportlib/Utils/MessagePassing.h +1 -1
- data/src/cxx_supportlib/Utils/OptionParsing.h +1 -1
- data/src/cxx_supportlib/Utils/ReleaseableScopedPointer.h +1 -1
- data/src/cxx_supportlib/Utils/ScopeGuard.h +1 -1
- data/src/cxx_supportlib/Utils/SpeedMeter.h +1 -1
- data/src/cxx_supportlib/Utils/Timer.h +1 -1
- data/src/cxx_supportlib/Utils/VariantMap.h +1 -1
- data/src/cxx_supportlib/Utils.cpp +1 -1
- data/src/cxx_supportlib/Utils.h +1 -1
- data/src/cxx_supportlib/WatchdogLauncher.cpp +1 -1
- data/src/cxx_supportlib/WatchdogLauncher.h +1 -1
- data/src/cxx_supportlib/WrapperRegistry/CBindings.cpp +1 -1
- data/src/cxx_supportlib/WrapperRegistry/CBindings.h +1 -1
- data/src/cxx_supportlib/WrapperRegistry/Entry.h +1 -1
- data/src/cxx_supportlib/WrapperRegistry/Registry.h +1 -1
- data/src/cxx_supportlib/oxt/backtrace.hpp +1 -1
- data/src/cxx_supportlib/oxt/detail/backtrace_disabled.hpp +1 -1
- data/src/cxx_supportlib/oxt/detail/backtrace_enabled.hpp +1 -1
- data/src/cxx_supportlib/oxt/detail/context.hpp +1 -1
- data/src/cxx_supportlib/oxt/detail/tracable_exception_disabled.hpp +1 -1
- data/src/cxx_supportlib/oxt/detail/tracable_exception_enabled.hpp +1 -1
- data/src/cxx_supportlib/oxt/dynamic_thread_group.hpp +1 -1
- data/src/cxx_supportlib/oxt/implementation.cpp +1 -1
- data/src/cxx_supportlib/oxt/initialize.hpp +1 -1
- data/src/cxx_supportlib/oxt/macros.hpp +1 -1
- data/src/cxx_supportlib/oxt/spin_lock.hpp +1 -1
- data/src/cxx_supportlib/oxt/system_calls.cpp +1 -1
- data/src/cxx_supportlib/oxt/system_calls.hpp +1 -1
- data/src/cxx_supportlib/oxt/thread.hpp +1 -1
- data/src/cxx_supportlib/oxt/tracable_exception.hpp +1 -1
- data/src/cxx_supportlib/vendor-copy/adhoc_lve.h +1 -1
- data/src/cxx_supportlib/vendor-copy/libuv/AUTHORS +353 -3
- data/src/cxx_supportlib/vendor-copy/libuv/ChangeLog +3981 -2
- data/src/cxx_supportlib/vendor-copy/libuv/LICENSE +1 -28
- data/src/cxx_supportlib/vendor-copy/libuv/LICENSE-docs +396 -0
- data/src/cxx_supportlib/vendor-copy/libuv/LICENSE-extra +36 -0
- data/src/cxx_supportlib/vendor-copy/libuv/Makefile.am +275 -58
- data/src/cxx_supportlib/vendor-copy/libuv/Makefile.in +4380 -2125
- data/src/cxx_supportlib/vendor-copy/libuv/aclocal.m4 +425 -221
- data/src/cxx_supportlib/vendor-copy/libuv/ar-lib +30 -10
- data/src/cxx_supportlib/vendor-copy/libuv/compile +31 -14
- data/src/cxx_supportlib/vendor-copy/libuv/config.guess +1084 -690
- data/src/cxx_supportlib/vendor-copy/libuv/config.sub +1844 -1297
- data/src/cxx_supportlib/vendor-copy/libuv/configure +6935 -3664
- data/src/cxx_supportlib/vendor-copy/libuv/configure.ac +43 -19
- data/src/cxx_supportlib/vendor-copy/libuv/depcomp +12 -11
- data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-darwin.h → uv/darwin.h} +3 -3
- data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-errno.h → uv/errno.h} +119 -60
- data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-linux.h → uv/linux.h} +1 -1
- data/src/cxx_supportlib/vendor-copy/libuv/include/uv/os390.h +33 -0
- data/src/cxx_supportlib/vendor-copy/libuv/include/uv/posix.h +31 -0
- data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-threadpool.h → uv/threadpool.h} +1 -1
- data/src/cxx_supportlib/vendor-copy/libuv/include/{tree.h → uv/tree.h} +3 -250
- data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-unix.h → uv/unix.h} +186 -60
- data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-version.h → uv/version.h} +3 -3
- data/src/cxx_supportlib/vendor-copy/libuv/include/uv/win.h +703 -0
- data/src/cxx_supportlib/vendor-copy/libuv/include/uv.h +528 -40
- data/src/cxx_supportlib/vendor-copy/libuv/install-sh +110 -70
- data/src/cxx_supportlib/vendor-copy/libuv/libuv-static.pc.in +12 -0
- data/src/cxx_supportlib/vendor-copy/libuv/libuv.pc.in +4 -2
- data/src/cxx_supportlib/vendor-copy/libuv/ltmain.sh +995 -619
- data/src/cxx_supportlib/vendor-copy/libuv/m4/ax_pthread.m4 +485 -0
- data/src/cxx_supportlib/vendor-copy/libuv/m4/libtool.m4 +438 -289
- data/src/cxx_supportlib/vendor-copy/libuv/m4/libuv-check-flags.m4 +21 -4
- data/src/cxx_supportlib/vendor-copy/libuv/m4/libuv-check-versions.m4 +7 -0
- data/src/cxx_supportlib/vendor-copy/libuv/m4/ltoptions.m4 +69 -39
- data/src/cxx_supportlib/vendor-copy/libuv/m4/ltsugar.m4 +1 -1
- data/src/cxx_supportlib/vendor-copy/libuv/m4/ltversion.m4 +7 -6
- data/src/cxx_supportlib/vendor-copy/libuv/m4/lt~obsolete.m4 +2 -2
- data/src/cxx_supportlib/vendor-copy/libuv/missing +55 -34
- data/src/cxx_supportlib/vendor-copy/libuv/src/fs-poll.c +52 -20
- data/src/cxx_supportlib/vendor-copy/libuv/src/idna.c +560 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/idna.h +31 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/inet.c +5 -16
- data/src/cxx_supportlib/vendor-copy/libuv/src/queue.h +68 -86
- data/src/cxx_supportlib/vendor-copy/libuv/src/random.c +123 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/strscpy.c +38 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/strscpy.h +39 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/strtok.c +52 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/strtok.h +27 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/thread-common.c +175 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/threadpool.c +172 -57
- data/src/cxx_supportlib/vendor-copy/libuv/src/{unix/timer.c → timer.c} +57 -29
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/aix-common.c +89 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/aix.c +418 -256
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/async.c +168 -129
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/bsd-ifaddrs.c +163 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/bsd-proctitle.c +99 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/core.c +1312 -378
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/cygwin.c +93 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/darwin-proctitle.c +18 -32
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/darwin-stub.h +97 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/darwin-syscalls.h +17 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/darwin.c +41 -139
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/dl.c +1 -1
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/freebsd.c +75 -235
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/fs.c +1308 -299
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/fsevents.c +150 -148
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/getaddrinfo.c +58 -8
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/getnameinfo.c +3 -2
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/haiku.c +172 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/hurd.c +172 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/ibmi.c +542 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/internal.h +297 -106
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/kqueue.c +325 -94
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux.c +2708 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/loop-watcher.c +11 -11
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/loop.c +105 -24
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/netbsd.c +51 -157
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/no-fsevents.c +42 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/no-proctitle.c +45 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/openbsd.c +42 -183
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/os390-proctitle.c +136 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/os390-syscalls.c +536 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/os390-syscalls.h +75 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/os390.c +1070 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/pipe.c +324 -55
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/poll.c +58 -11
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/posix-hrtime.c +36 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/posix-poll.c +385 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/process.c +795 -248
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/procfs-exepath.c +45 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/proctitle.c +77 -22
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/qnx.c +142 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/random-devurandom.c +93 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/random-getentropy.c +57 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/random-getrandom.c +86 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/random-sysctl-linux.c +99 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/signal.c +147 -39
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/stream.c +426 -474
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/sunos.c +240 -98
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/sysinfo-loadavg.c +36 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/sysinfo-memory.c +42 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/tcp.c +402 -91
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/thread.c +497 -145
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/tty.c +269 -45
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/udp.c +695 -165
- data/src/cxx_supportlib/vendor-copy/libuv/src/uv-common.c +463 -61
- data/src/cxx_supportlib/vendor-copy/libuv/src/uv-common.h +248 -44
- data/src/cxx_supportlib/vendor-copy/libuv/src/uv-data-getter-setters.c +119 -0
- data/src/cxx_supportlib/vendor-copy/libuv/tsansupp.txt +2 -0
- data/src/cxx_supportlib/vendor-modified/libev/Changes +109 -0
- data/src/cxx_supportlib/vendor-modified/libev/Makefile.am +2 -1
- data/src/cxx_supportlib/vendor-modified/libev/Makefile.in +47 -33
- data/src/cxx_supportlib/vendor-modified/libev/README +2 -1
- data/src/cxx_supportlib/vendor-modified/libev/aclocal.m4 +1653 -1224
- data/src/cxx_supportlib/vendor-modified/libev/config.guess +376 -316
- data/src/cxx_supportlib/vendor-modified/libev/config.h.in +13 -2
- data/src/cxx_supportlib/vendor-modified/libev/config.sub +156 -154
- data/src/cxx_supportlib/vendor-modified/libev/configure +1431 -940
- data/src/cxx_supportlib/vendor-modified/libev/configure.ac +3 -3
- data/src/cxx_supportlib/vendor-modified/libev/depcomp +5 -5
- data/src/cxx_supportlib/vendor-modified/libev/ev++.h +109 -107
- data/src/cxx_supportlib/vendor-modified/libev/ev.c +807 -319
- data/src/cxx_supportlib/vendor-modified/libev/ev.h +111 -105
- data/src/cxx_supportlib/vendor-modified/libev/ev_epoll.c +42 -29
- data/src/cxx_supportlib/vendor-modified/libev/ev_iouring.c +694 -0
- data/src/cxx_supportlib/vendor-modified/libev/ev_kqueue.c +15 -9
- data/src/cxx_supportlib/vendor-modified/libev/ev_linuxaio.c +620 -0
- data/src/cxx_supportlib/vendor-modified/libev/ev_poll.c +19 -14
- data/src/cxx_supportlib/vendor-modified/libev/ev_port.c +8 -5
- data/src/cxx_supportlib/vendor-modified/libev/ev_select.c +6 -6
- data/src/cxx_supportlib/vendor-modified/libev/ev_vars.h +48 -3
- data/src/cxx_supportlib/vendor-modified/libev/ev_win32.c +2 -2
- data/src/cxx_supportlib/vendor-modified/libev/ev_wrap.h +72 -0
- data/src/cxx_supportlib/vendor-modified/libev/install-sh +23 -13
- data/src/cxx_supportlib/vendor-modified/libev/libev.m4 +6 -1
- data/src/cxx_supportlib/vendor-modified/libev/ltmain.sh +3581 -1993
- data/src/cxx_supportlib/vendor-modified/libev/missing +8 -8
- data/src/cxx_supportlib/vendor-modified/libev/mkinstalldirs +3 -3
- data/src/cxx_supportlib/vendor-modified/modp_b64_strict_aliasing.cpp +1 -1
- data/src/helper-scripts/backtrace-sanitizer.rb +1 -1
- data/src/helper-scripts/crash-watch.rb +1 -1
- data/src/helper-scripts/download_binaries/extconf.rb +1 -1
- data/src/helper-scripts/meteor-loader.rb +1 -1
- data/src/helper-scripts/node-loader.js +1 -1
- data/src/helper-scripts/prespawn +1 -1
- data/src/helper-scripts/rack-loader.rb +1 -1
- data/src/helper-scripts/rack-preloader.rb +1 -1
- data/src/helper-scripts/wsgi-loader.py +1 -1
- data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c +1 -1
- data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c.cxxcodebuilder +1 -1
- data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c +1 -1
- data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c.cxxcodebuilder +1 -1
- data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c +1 -1
- data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c.cxxcodebuilder +1 -1
- data/src/nginx_module/Configuration.c +1 -1
- data/src/nginx_module/Configuration.h +1 -1
- data/src/nginx_module/ContentHandler.c +1 -1
- data/src/nginx_module/ContentHandler.h +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c.cxxcodebuilder +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedHeaderSerialization.c +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedHeaderSerialization.c.cxxcodebuilder +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c.cxxcodebuilder +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedMergeFunction.c +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedMergeFunction.c.cxxcodebuilder +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h +1 -1
- data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h.cxxcodebuilder +1 -1
- data/src/nginx_module/MainConfig/AutoGeneratedCreateFunction.c +1 -1
- data/src/nginx_module/MainConfig/AutoGeneratedCreateFunction.c.cxxcodebuilder +1 -1
- data/src/nginx_module/MainConfig/AutoGeneratedManifestGeneration.c +1 -1
- data/src/nginx_module/MainConfig/AutoGeneratedManifestGeneration.c.cxxcodebuilder +1 -1
- data/src/nginx_module/MainConfig/AutoGeneratedStruct.h +1 -1
- data/src/nginx_module/MainConfig/AutoGeneratedStruct.h.cxxcodebuilder +1 -1
- data/src/nginx_module/StaticContentHandler.c +1 -1
- data/src/nginx_module/StaticContentHandler.h +1 -1
- data/src/nginx_module/ngx_http_passenger_module.c +1 -1
- data/src/nginx_module/ngx_http_passenger_module.h +1 -1
- data/src/nodejs_supportlib/phusion_passenger/line_reader.js +1 -1
- data/src/ruby_native_extension/extconf.rb +1 -1
- data/src/ruby_native_extension/passenger_native_support.c +1 -1
- data/src/ruby_supportlib/phusion_passenger/abstract_installer.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/admin_tools/instance.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/admin_tools/instance_registry.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/admin_tools/memory_stats.rb +2 -12
- data/src/ruby_supportlib/phusion_passenger/admin_tools.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/apache2/config_utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/common_library.rb +8 -10
- data/src/ruby_supportlib/phusion_passenger/config/about_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/agent_compiler.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/api_call_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/build_native_support_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/compile_agent_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/compile_nginx_engine_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/detach_process_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/download_agent_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/download_nginx_engine_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/install_agent_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/install_standalone_runtime_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/installation_utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/list_instances_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/main.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/nginx_engine_compiler.rb +3 -2
- data/src/ruby_supportlib/phusion_passenger/config/reopen_logs_command.rb +6 -1
- data/src/ruby_supportlib/phusion_passenger/config/restart_app_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/system_metrics_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/system_properties_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/config/validate_install_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/console_text_template.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/constants.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/debug_logging.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/message_channel.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/message_client.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/native_support.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/packaging.rb +4 -3
- data/src/ruby_supportlib/phusion_passenger/platform_info/apache.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/apache_detector.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/binary_compatibility.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/compiler.rb +195 -11
- data/src/ruby_supportlib/phusion_passenger/platform_info/crypto.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/curl.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/cxx_portability.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/linux.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/networking.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/openssl.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/operating_system.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/pcre.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/ruby.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/zlib.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/plugin.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/preloader_shared_helpers.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/public_api.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/rack/handler.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/rack/out_of_band_gc.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/rack_handler.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb +2 -7
- data/src/ruby_supportlib/phusion_passenger/request_handler.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/ruby_core_enhancements.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/ruby_core_io_enhancements.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/simple_benchmarking.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/app_finder.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/config_utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/control_utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/main.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +2 -2
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb +4 -8
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/status_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/stop_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/version_command.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/ansi_colors.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/download.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/file_system_watcher.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/hosts_file_parser.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/lock.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/native_support_utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/progress_bar.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/strscan.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/terminal_choice_menu.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/utils/unseekable_socket.rb +3 -13
- data/src/ruby_supportlib/phusion_passenger/utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/app.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/base.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/gdb_controller.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/lldb_controller.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/utils.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/crash_watch/version.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/lock_file.rb +8 -6
- data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/spawn.rb +4 -3
- data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/version.rb +6 -4
- data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller.rb +395 -579
- data/src/ruby_supportlib/phusion_passenger.rb +8 -8
- data/src/schema_printer/SchemaPrinterMain.cpp +1 -1
- data/src/schema_printer/SchemaPrinterMain.cpp.cxxcodebuilder +1 -1
- metadata +69 -32
- data/doc/DeveloperQuickstart.md +0 -70
- data/src/README.md +0 -7
- data/src/cxx_supportlib/vendor-copy/libuv/README.md +0 -245
- data/src/cxx_supportlib/vendor-copy/libuv/checksparse.sh +0 -234
- data/src/cxx_supportlib/vendor-copy/libuv/common.gypi +0 -210
- data/src/cxx_supportlib/vendor-copy/libuv/gyp_uv.py +0 -93
- data/src/cxx_supportlib/vendor-copy/libuv/include/android-ifaddrs.h +0 -54
- data/src/cxx_supportlib/vendor-copy/libuv/include/pthread-fixes.h +0 -72
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/android-ifaddrs.c +0 -703
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/atomic-ops.h +0 -77
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-core.c +0 -899
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-inotify.c +0 -285
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-syscalls.c +0 -471
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-syscalls.h +0 -158
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/pthread-fixes.c +0 -104
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/spinlock.h +0 -53
- data/src/cxx_supportlib/vendor-copy/libuv/uv.gyp +0 -508
- /data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-aix.h → uv/aix.h} +0 -0
- /data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-bsd.h → uv/bsd.h} +0 -0
- /data/src/cxx_supportlib/vendor-copy/libuv/include/{uv-sunos.h → uv/sunos.h} +0 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# daemon_controller, library for robust daemon management
|
|
2
|
-
# Copyright (c) 2010-
|
|
4
|
+
# Copyright (c) 2010-2026 Asynchronous B.V.
|
|
3
5
|
#
|
|
4
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
7
|
# of this software and associated documentation files (the "Software"), to deal
|
|
@@ -19,16 +21,14 @@
|
|
|
19
21
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
22
|
# THE SOFTWARE.
|
|
21
23
|
|
|
22
|
-
require
|
|
23
|
-
require
|
|
24
|
-
require
|
|
25
|
-
require
|
|
26
|
-
require
|
|
27
|
-
|
|
28
|
-
require 'rbconfig'
|
|
29
|
-
end
|
|
24
|
+
require "tempfile"
|
|
25
|
+
require "fcntl"
|
|
26
|
+
require "socket"
|
|
27
|
+
require "pathname"
|
|
28
|
+
require "timeout"
|
|
29
|
+
require "rbconfig"
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
require_relative "daemon_controller/lock_file"
|
|
32
32
|
|
|
33
33
|
module PhusionPassenger
|
|
34
34
|
|
|
@@ -38,184 +38,66 @@ class DaemonController
|
|
|
38
38
|
Errno::ETIMEDOUT, Errno::ECONNRESET, Errno::EINVAL,
|
|
39
39
|
Errno::EADDRNOTAVAIL ]
|
|
40
40
|
|
|
41
|
-
SPAWNER_FILE = File.
|
|
41
|
+
SPAWNER_FILE = File.absolute_path(File.join(File.dirname(__FILE__),
|
|
42
42
|
"daemon_controller", "spawn.rb"))
|
|
43
43
|
|
|
44
44
|
class Error < StandardError
|
|
45
45
|
end
|
|
46
|
+
|
|
46
47
|
class TimeoutError < Error
|
|
47
48
|
end
|
|
49
|
+
|
|
48
50
|
class AlreadyStarted < Error
|
|
49
51
|
end
|
|
52
|
+
|
|
50
53
|
class StartError < Error
|
|
51
54
|
end
|
|
55
|
+
|
|
52
56
|
class StartTimeout < TimeoutError
|
|
53
57
|
end
|
|
58
|
+
|
|
54
59
|
class StopError < Error
|
|
55
60
|
end
|
|
61
|
+
|
|
56
62
|
class StopTimeout < TimeoutError
|
|
57
63
|
end
|
|
64
|
+
|
|
58
65
|
class ConnectError < Error
|
|
59
66
|
end
|
|
60
|
-
|
|
61
|
-
|
|
67
|
+
|
|
68
|
+
InternalCommandOkResult = Struct.new(:pid, :output)
|
|
69
|
+
InternalCommandErrorResult = Struct.new(:pid, :output, :exit_status)
|
|
70
|
+
InternalCommandTimeoutResult = Struct.new(:pid, :output)
|
|
62
71
|
|
|
63
72
|
# Create a new DaemonController object.
|
|
64
73
|
#
|
|
65
|
-
#
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
# - [:tcp, host_name, port]
|
|
93
|
-
# - [:unix, filename]
|
|
94
|
-
#
|
|
95
|
-
# The value may also be a Proc, which returns an expression that evaluates to
|
|
96
|
-
# true (indicating that the daemon can be connected to) or false (failure).
|
|
97
|
-
# If the Proc raises Errno::ECONNREFUSED, Errno::ENETUNREACH, Errno::ETIMEDOUT
|
|
98
|
-
# Errno::ECONNRESET, Errno::EINVAL or Errno::EADDRNOTAVAIL then that also
|
|
99
|
-
# means that the daemon cannot be connected to.
|
|
100
|
-
# <b>NOTE:</b> if the ping command returns an object which responds to
|
|
101
|
-
# <tt>#close</tt>, then that method will be called on it.
|
|
102
|
-
# This makes it possible to specify a ping command such as
|
|
103
|
-
# <tt>lambda { TCPSocket.new('localhost', 1234) }</tt>, without having to worry
|
|
104
|
-
# about closing it afterwards.
|
|
105
|
-
# Any exceptions raised by #close are ignored.
|
|
106
|
-
#
|
|
107
|
-
# [:pid_file]
|
|
108
|
-
# The PID file that the daemon will write to. Used to check whether the daemon
|
|
109
|
-
# is running.
|
|
110
|
-
#
|
|
111
|
-
# [:lock_file]
|
|
112
|
-
# The lock file to use for serializing concurrent daemon management operations.
|
|
113
|
-
# Defaults to "(filename of PID file).lock".
|
|
114
|
-
#
|
|
115
|
-
# [:log_file]
|
|
116
|
-
# The log file that the daemon will write to. It will be consulted to see
|
|
117
|
-
# whether the daemon has printed any error messages during startup.
|
|
118
|
-
#
|
|
119
|
-
# === Optional options
|
|
120
|
-
# [:stop_command]
|
|
121
|
-
# A command to stop the daemon with, e.g. "/etc/rc.d/nginx stop". If no stop
|
|
122
|
-
# command is given (i.e. +nil+), then DaemonController will stop the daemon
|
|
123
|
-
# by killing the PID written in the PID file.
|
|
124
|
-
#
|
|
125
|
-
# The default value is +nil+.
|
|
126
|
-
#
|
|
127
|
-
# [:restart_command]
|
|
128
|
-
# A command to restart the daemon with, e.g. "/etc/rc.d/nginx restart". If
|
|
129
|
-
# no restart command is given (i.e. +nil+), then DaemonController will
|
|
130
|
-
# restart the daemon by calling #stop and #start.
|
|
131
|
-
#
|
|
132
|
-
# The default value is +nil+.
|
|
133
|
-
#
|
|
134
|
-
# [:before_start]
|
|
135
|
-
# This may be a Proc. It will be called just before running the start command.
|
|
136
|
-
# The before_start proc is not subject to the start timeout.
|
|
137
|
-
#
|
|
138
|
-
# [:start_timeout]
|
|
139
|
-
# The maximum amount of time, in seconds, that #start may take to start
|
|
140
|
-
# the daemon. Since #start also waits until the daemon can be connected to,
|
|
141
|
-
# that wait time is counted as well. If the daemon does not start in time,
|
|
142
|
-
# then #start will raise an exception.
|
|
143
|
-
#
|
|
144
|
-
# The default value is 15.
|
|
145
|
-
#
|
|
146
|
-
# [:stop_timeout]
|
|
147
|
-
# The maximum amount of time, in seconds, that #stop may take to stop
|
|
148
|
-
# the daemon. Since #stop also waits until the daemon is no longer running,
|
|
149
|
-
# that wait time is counted as well. If the daemon does not stop in time,
|
|
150
|
-
# then #stop will raise an exception.
|
|
151
|
-
#
|
|
152
|
-
# The default value is 15.
|
|
153
|
-
#
|
|
154
|
-
# [:log_file_activity_timeout]
|
|
155
|
-
# Once a daemon has gone into the background, it will become difficult to
|
|
156
|
-
# know for certain whether it is still initializing or whether it has
|
|
157
|
-
# failed and exited, until it has written its PID file. Suppose that it
|
|
158
|
-
# failed with an error after daemonizing but before it has written its PID file;
|
|
159
|
-
# not many system administrators want to wait 15 seconds (the default start
|
|
160
|
-
# timeout) to be notified of whether the daemon has terminated with an error.
|
|
161
|
-
#
|
|
162
|
-
# An alternative way to check whether the daemon has terminated with an error,
|
|
163
|
-
# is by checking whether its log file has been recently updated. If, after the
|
|
164
|
-
# daemon has started, the log file hasn't been updated for the amount of seconds
|
|
165
|
-
# given by the :log_file_activity_timeout option, then the daemon is assumed to
|
|
166
|
-
# have terminated with an error.
|
|
167
|
-
#
|
|
168
|
-
# The default value is 7.
|
|
169
|
-
#
|
|
170
|
-
# [:dont_stop_if_pid_file_invalid]
|
|
171
|
-
# If the :stop_command option is given, then normally daemon_controller will
|
|
172
|
-
# always execute this command upon calling #stop. But if :dont_stop_if_pid_file_invalid
|
|
173
|
-
# is given, then daemon_controller will not do that if the PID file does not contain
|
|
174
|
-
# a valid number.
|
|
175
|
-
#
|
|
176
|
-
# The default is false.
|
|
177
|
-
#
|
|
178
|
-
# [:daemonize_for_me]
|
|
179
|
-
# Normally daemon_controller will wait until the daemon has daemonized into the
|
|
180
|
-
# background, in order to capture any errors that it may print on stdout or
|
|
181
|
-
# stderr before daemonizing. However, if the daemon doesn't support daemonization
|
|
182
|
-
# for some reason, then setting this option to true will cause daemon_controller
|
|
183
|
-
# to do the daemonization for the daemon.
|
|
184
|
-
#
|
|
185
|
-
# The default is false.
|
|
186
|
-
#
|
|
187
|
-
# [:keep_ios]
|
|
188
|
-
# Upon spawning the daemon, daemon_controller will normally close all file
|
|
189
|
-
# descriptors except stdin, stdout and stderr. However if there are any file
|
|
190
|
-
# descriptors you want to keep open, specify the IO objects here. This must be
|
|
191
|
-
# an array of IO objects.
|
|
192
|
-
#
|
|
193
|
-
# [:env]
|
|
194
|
-
# This must be a Hash. The hash will contain the environment variables available
|
|
195
|
-
# to be made available to the daemon. Hash keys must be strings, not symbols.
|
|
196
|
-
def initialize(options)
|
|
197
|
-
[ :identifier, :start_command, :ping_command, :pid_file, :log_file ].each do |option|
|
|
198
|
-
if !options.has_key?(option)
|
|
199
|
-
raise ArgumentError, "The ':#{option}' option is mandatory."
|
|
200
|
-
end
|
|
201
|
-
end
|
|
202
|
-
@identifier = options[:identifier]
|
|
203
|
-
@start_command = options[:start_command]
|
|
204
|
-
@stop_command = options[:stop_command]
|
|
205
|
-
@ping_command = options[:ping_command]
|
|
206
|
-
@restart_command = options[:restart_command]
|
|
207
|
-
@ping_interval = options[:ping_interval] || 0.1
|
|
208
|
-
@pid_file = options[:pid_file]
|
|
209
|
-
@log_file = options[:log_file]
|
|
210
|
-
@before_start = options[:before_start]
|
|
211
|
-
@start_timeout = options[:start_timeout] || 15
|
|
212
|
-
@stop_timeout = options[:stop_timeout] || 15
|
|
213
|
-
@log_file_activity_timeout = options[:log_file_activity_timeout] || 7
|
|
214
|
-
@dont_stop_if_pid_file_invalid = options[:dont_stop_if_pid_file_invalid]
|
|
215
|
-
@daemonize_for_me = options[:daemonize_for_me]
|
|
216
|
-
@keep_ios = options[:keep_ios] || []
|
|
217
|
-
@lock_file = determine_lock_file(options, @identifier, @pid_file)
|
|
218
|
-
@env = options[:env] || {}
|
|
74
|
+
# See doc/OPTIONS.md for options docs.
|
|
75
|
+
def initialize(identifier:, start_command:, ping_command:, pid_file:, log_file:,
|
|
76
|
+
lock_file: nil, stop_command: nil, restart_command: nil, before_start: nil,
|
|
77
|
+
start_timeout: 30, start_abort_timeout: 10, stop_timeout: 30,
|
|
78
|
+
log_file_activity_timeout: 10, ping_interval: 0.1, stop_graceful_signal: "TERM", dont_stop_if_pid_file_invalid: false,
|
|
79
|
+
daemonize_for_me: false, keep_ios: nil, env: {}, logger: nil)
|
|
80
|
+
@identifier = identifier
|
|
81
|
+
@start_command = start_command
|
|
82
|
+
@ping_command = ping_command
|
|
83
|
+
@pid_file = pid_file
|
|
84
|
+
@log_file = log_file
|
|
85
|
+
|
|
86
|
+
@lock_file = determine_lock_file(lock_file, identifier, pid_file)
|
|
87
|
+
@stop_command = stop_command
|
|
88
|
+
@restart_command = restart_command
|
|
89
|
+
@before_start = before_start
|
|
90
|
+
@start_timeout = start_timeout
|
|
91
|
+
@start_abort_timeout = start_abort_timeout
|
|
92
|
+
@stop_timeout = stop_timeout
|
|
93
|
+
@log_file_activity_timeout = log_file_activity_timeout
|
|
94
|
+
@ping_interval = ping_interval
|
|
95
|
+
@stop_graceful_signal = stop_graceful_signal
|
|
96
|
+
@dont_stop_if_pid_file_invalid = dont_stop_if_pid_file_invalid
|
|
97
|
+
@daemonize_for_me = daemonize_for_me
|
|
98
|
+
@keep_ios = keep_ios
|
|
99
|
+
@env = env
|
|
100
|
+
@logger = logger
|
|
219
101
|
end
|
|
220
102
|
|
|
221
103
|
# Start the daemon and wait until it can be pinged.
|
|
@@ -254,15 +136,13 @@ class DaemonController
|
|
|
254
136
|
def connect
|
|
255
137
|
connection = nil
|
|
256
138
|
@lock_file.shared_lock do
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
connection = nil
|
|
261
|
-
end
|
|
139
|
+
connection = yield
|
|
140
|
+
rescue *ALLOWED_CONNECT_EXCEPTIONS
|
|
141
|
+
connection = nil
|
|
262
142
|
end
|
|
263
143
|
if connection.nil?
|
|
264
144
|
@lock_file.exclusive_lock do
|
|
265
|
-
|
|
145
|
+
unless daemon_is_running?
|
|
266
146
|
start_without_locking
|
|
267
147
|
end
|
|
268
148
|
connect_exception = nil
|
|
@@ -299,17 +179,17 @@ class DaemonController
|
|
|
299
179
|
# - StopTimeout - the daemon didn't stop in time.
|
|
300
180
|
def stop
|
|
301
181
|
@lock_file.exclusive_lock do
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
kill_daemon
|
|
305
|
-
wait_until
|
|
306
|
-
!daemon_is_running?
|
|
307
|
-
end
|
|
182
|
+
timeoutable(@stop_timeout) do
|
|
183
|
+
allow_timeout do
|
|
184
|
+
kill_daemon
|
|
185
|
+
wait_until { !daemon_is_running? }
|
|
308
186
|
end
|
|
309
|
-
rescue Timeout::Error
|
|
310
|
-
raise StopTimeout, "Daemon '#{@identifier}' did not exit in time"
|
|
311
187
|
end
|
|
312
188
|
end
|
|
189
|
+
rescue Timeout::Error
|
|
190
|
+
kill_daemon_with_signal(force: true)
|
|
191
|
+
wait_until { !daemon_is_running? }
|
|
192
|
+
raise StopTimeout, "Daemon '#{@identifier}' did not exit in time (force killed)"
|
|
313
193
|
end
|
|
314
194
|
|
|
315
195
|
# Restarts the daemon. Uses the restart_command if provided, otherwise
|
|
@@ -355,71 +235,89 @@ class DaemonController
|
|
|
355
235
|
RUBY_PLATFORM != "java"
|
|
356
236
|
end
|
|
357
237
|
|
|
358
|
-
private
|
|
238
|
+
private
|
|
239
|
+
|
|
359
240
|
def start_without_locking
|
|
360
|
-
if daemon_is_running?
|
|
361
|
-
|
|
362
|
-
end
|
|
241
|
+
raise AlreadyStarted, "Daemon '#{@identifier}' is already started" if daemon_is_running?
|
|
242
|
+
|
|
363
243
|
save_log_file_information
|
|
364
244
|
delete_pid_file
|
|
245
|
+
spawn_result = nil
|
|
246
|
+
|
|
365
247
|
begin
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
spawn_daemon
|
|
248
|
+
_, remaining_time = timeoutable(@start_timeout) do
|
|
249
|
+
allow_timeout { before_start }
|
|
250
|
+
spawn_result = allow_timeout { spawn_daemon }
|
|
251
|
+
daemon_spawned
|
|
371
252
|
record_activity
|
|
372
253
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
254
|
+
if spawn_result.is_a?(InternalCommandOkResult)
|
|
255
|
+
allow_timeout do
|
|
256
|
+
# We wait until the PID file is available and until
|
|
257
|
+
# the daemon responds to pings, but we wait no longer
|
|
258
|
+
# than @start_timeout seconds in total (including daemon
|
|
259
|
+
# spawn time).
|
|
260
|
+
# Furthermore, if the log file hasn't changed for
|
|
261
|
+
# @log_file_activity_timeout seconds, and the PID file
|
|
262
|
+
# still isn't available or the daemon still doesn't
|
|
263
|
+
# respond to pings, then assume that the daemon has
|
|
264
|
+
# terminated with an error.
|
|
265
|
+
wait_until do
|
|
266
|
+
if log_file_has_changed?
|
|
267
|
+
record_activity
|
|
268
|
+
elsif no_activity?(@log_file_activity_timeout)
|
|
269
|
+
raise Timeout::Error, "Log file inactivity"
|
|
270
|
+
end
|
|
271
|
+
pid_file_available?
|
|
272
|
+
end
|
|
273
|
+
wait_until(sleep_interval: @ping_interval) do
|
|
274
|
+
if log_file_has_changed?
|
|
275
|
+
record_activity
|
|
276
|
+
elsif no_activity?(@log_file_activity_timeout)
|
|
277
|
+
raise Timeout::Error, "Log file inactivity"
|
|
278
|
+
end
|
|
279
|
+
run_ping_command || !daemon_is_running?
|
|
280
|
+
end
|
|
395
281
|
end
|
|
396
|
-
run_ping_command || !daemon_is_running?
|
|
397
282
|
end
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
rescue
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
283
|
+
|
|
284
|
+
spawn_result
|
|
285
|
+
end
|
|
286
|
+
rescue Timeout::Error
|
|
287
|
+
# If we got here then it means either the #before_start timed out (= no PID),
|
|
288
|
+
# or the code after #spawn_daemon timed out (already daemonized, so use PID file).
|
|
289
|
+
# #spawn_daemon itself won't trigger Timeout:Error because that's handled as
|
|
290
|
+
# InternalCommandTimeoutResult.
|
|
291
|
+
pid = spawn_result ? read_pid_file : nil
|
|
292
|
+
start_timed_out(pid)
|
|
293
|
+
debug "Timeout waiting for daemon to be ready, PID #{pid.inspect}"
|
|
294
|
+
abort_start(pid: pid, is_direct_child: false) if pid
|
|
295
|
+
raise StartTimeout, concat_spawn_output_and_logs(spawn_result ? spawn_result.output : nil,
|
|
296
|
+
differences_in_log_file, nil, "timed out")
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
case spawn_result
|
|
300
|
+
when InternalCommandOkResult
|
|
301
|
+
success, _ = timeoutable(remaining_time) { allow_timeout { run_ping_command } }
|
|
302
|
+
if success
|
|
303
|
+
true
|
|
408
304
|
else
|
|
409
|
-
|
|
305
|
+
raise StartError, concat_spawn_output_and_logs(spawn_result.output, differences_in_log_file)
|
|
410
306
|
end
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
raise
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
307
|
+
|
|
308
|
+
when InternalCommandErrorResult
|
|
309
|
+
raise StartError, concat_spawn_output_and_logs(spawn_result.output,
|
|
310
|
+
differences_in_log_file, spawn_result.exit_status)
|
|
311
|
+
|
|
312
|
+
when InternalCommandTimeoutResult
|
|
313
|
+
daemonization_timed_out(spawn_result.pid)
|
|
314
|
+
abort_start(pid: spawn_result.pid, is_direct_child: true)
|
|
315
|
+
debug "Timeout waiting for daemon to fork, PID #{spawn_result.pid}"
|
|
316
|
+
raise StartTimeout, concat_spawn_output_and_logs(spawn_result.output,
|
|
317
|
+
differences_in_log_file, nil, "timed out")
|
|
318
|
+
|
|
421
319
|
else
|
|
422
|
-
|
|
320
|
+
raise "Bug: unexpected result from #spawn_daemon: #{spawn_result.inspect}"
|
|
423
321
|
end
|
|
424
322
|
end
|
|
425
323
|
|
|
@@ -439,42 +337,39 @@ private
|
|
|
439
337
|
|
|
440
338
|
def kill_daemon
|
|
441
339
|
if @stop_command
|
|
442
|
-
if @dont_stop_if_pid_file_invalid && read_pid_file.nil?
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
340
|
+
return if @dont_stop_if_pid_file_invalid && read_pid_file.nil?
|
|
341
|
+
|
|
342
|
+
result = run_command(@stop_command)
|
|
343
|
+
case result
|
|
344
|
+
when InternalCommandOkResult
|
|
345
|
+
# Success
|
|
346
|
+
when InternalCommandErrorResult
|
|
347
|
+
raise StopError, concat_spawn_output_and_logs(result.output, nil, result.exit_status)
|
|
348
|
+
when InternalCommandTimeoutResult
|
|
349
|
+
raise StopError, concat_spawn_output_and_logs(result.output, nil, nil, "timed out")
|
|
350
|
+
else
|
|
351
|
+
raise "Bug: unexpected result from #run_command: #{result.inspect}"
|
|
449
352
|
end
|
|
450
353
|
else
|
|
451
354
|
kill_daemon_with_signal
|
|
452
355
|
end
|
|
453
356
|
end
|
|
454
357
|
|
|
455
|
-
def kill_daemon_with_signal(force
|
|
456
|
-
pid = read_pid_file
|
|
457
|
-
if pid
|
|
358
|
+
def kill_daemon_with_signal(force: false)
|
|
359
|
+
if (pid = read_pid_file)
|
|
458
360
|
if force
|
|
459
|
-
Process.kill(
|
|
361
|
+
Process.kill("SIGKILL", pid)
|
|
460
362
|
else
|
|
461
|
-
Process.kill(
|
|
363
|
+
Process.kill(normalize_signal_name(@stop_graceful_signal), pid)
|
|
462
364
|
end
|
|
463
365
|
end
|
|
464
366
|
rescue Errno::ESRCH, Errno::ENOENT
|
|
465
367
|
end
|
|
466
368
|
|
|
467
369
|
def daemon_is_running?
|
|
468
|
-
|
|
469
|
-
pid = read_pid_file
|
|
470
|
-
rescue Errno::ENOENT
|
|
471
|
-
# The PID file may not exist, or another thread/process
|
|
472
|
-
# executing #running? may have just deleted the PID file.
|
|
473
|
-
# So we catch this error.
|
|
474
|
-
pid = nil
|
|
475
|
-
end
|
|
370
|
+
pid = read_pid_file
|
|
476
371
|
if pid.nil?
|
|
477
|
-
|
|
372
|
+
nil
|
|
478
373
|
elsif check_pid(pid)
|
|
479
374
|
true
|
|
480
375
|
else
|
|
@@ -484,16 +379,11 @@ private
|
|
|
484
379
|
end
|
|
485
380
|
|
|
486
381
|
def read_pid_file
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
rescue Errno::ENOENT
|
|
490
|
-
return nil
|
|
491
|
-
end
|
|
492
|
-
if pid =~ /\A\d+\Z/
|
|
382
|
+
pid = File.read(@pid_file).strip
|
|
383
|
+
if /\A\d+\Z/.match?(pid)
|
|
493
384
|
pid.to_i
|
|
494
|
-
else
|
|
495
|
-
nil
|
|
496
385
|
end
|
|
386
|
+
rescue Errno::ENOENT
|
|
497
387
|
end
|
|
498
388
|
|
|
499
389
|
def delete_pid_file
|
|
@@ -514,21 +404,21 @@ private
|
|
|
514
404
|
true
|
|
515
405
|
end
|
|
516
406
|
|
|
517
|
-
def wait_until(sleep_interval
|
|
518
|
-
|
|
407
|
+
def wait_until(sleep_interval: 0.1)
|
|
408
|
+
until yield
|
|
519
409
|
sleep(sleep_interval)
|
|
520
410
|
end
|
|
521
411
|
end
|
|
522
412
|
|
|
523
413
|
def wait_until_pid_file_is_available_or_log_file_has_changed
|
|
524
|
-
|
|
414
|
+
until pid_file_available? || log_file_has_changed?
|
|
525
415
|
sleep 0.1
|
|
526
416
|
end
|
|
527
417
|
pid_file_is_available?
|
|
528
418
|
end
|
|
529
419
|
|
|
530
420
|
def wait_until_daemon_responds_to_ping_or_has_exited_or_log_file_has_changed
|
|
531
|
-
|
|
421
|
+
until run_ping_command || !daemon_is_running? || log_file_has_changed?
|
|
532
422
|
sleep(@ping_interval)
|
|
533
423
|
end
|
|
534
424
|
run_ping_command
|
|
@@ -544,28 +434,90 @@ private
|
|
|
544
434
|
end
|
|
545
435
|
|
|
546
436
|
def pid_file_available?
|
|
547
|
-
File.exist?(@pid_file) && File.
|
|
437
|
+
File.exist?(@pid_file) && !File.zero?(@pid_file)
|
|
548
438
|
end
|
|
549
439
|
|
|
550
440
|
# This method does nothing and only serves as a hook for the unit test.
|
|
551
|
-
def
|
|
441
|
+
def daemon_spawned
|
|
552
442
|
end
|
|
553
443
|
|
|
554
444
|
# This method does nothing and only serves as a hook for the unit test.
|
|
555
|
-
def
|
|
445
|
+
def start_timed_out(pid)
|
|
446
|
+
end
|
|
447
|
+
|
|
448
|
+
# This method does nothing and only serves as a hook for the unit test.
|
|
449
|
+
def daemonization_timed_out(pid)
|
|
450
|
+
end
|
|
451
|
+
|
|
452
|
+
# Aborts a daemon that we tried to start, but timed out.
|
|
453
|
+
def abort_start(pid:, is_direct_child:)
|
|
454
|
+
begin
|
|
455
|
+
debug "Killing process #{pid}"
|
|
456
|
+
Process.kill("SIGTERM", pid)
|
|
457
|
+
rescue SystemCallError
|
|
458
|
+
end
|
|
459
|
+
|
|
460
|
+
begin
|
|
461
|
+
timeoutable(@start_abort_timeout) do
|
|
462
|
+
allow_timeout do
|
|
463
|
+
wait_for_aborted_process(pid: pid, is_direct_child: is_direct_child)
|
|
464
|
+
end
|
|
465
|
+
end
|
|
466
|
+
rescue Timeout::Error
|
|
467
|
+
begin
|
|
468
|
+
Process.kill("SIGKILL", pid)
|
|
469
|
+
rescue SystemCallError
|
|
470
|
+
end
|
|
471
|
+
|
|
472
|
+
allow_timeout do
|
|
473
|
+
wait_for_aborted_process(pid: pid, is_direct_child: is_direct_child)
|
|
474
|
+
end
|
|
475
|
+
end
|
|
476
|
+
end
|
|
477
|
+
|
|
478
|
+
def wait_for_aborted_process(pid:, is_direct_child:)
|
|
479
|
+
if is_direct_child
|
|
480
|
+
begin
|
|
481
|
+
debug "Waiting directly for process #{pid}"
|
|
482
|
+
Process.waitpid(pid)
|
|
483
|
+
rescue SystemCallError
|
|
484
|
+
end
|
|
485
|
+
|
|
486
|
+
# The daemon may have:
|
|
487
|
+
# 1. Written a PID file before forking. We delete this PID file.
|
|
488
|
+
# -OR-
|
|
489
|
+
# 2. It might have forked (and written a PID file) right before
|
|
490
|
+
# we terminated it. We'll want the fork to stay alive rather
|
|
491
|
+
# than going through the (complicated) trouble of killing it.
|
|
492
|
+
# Don't touch the PID file.
|
|
493
|
+
pid2 = read_pid_file
|
|
494
|
+
debug "PID file contains #{pid2.inspect}"
|
|
495
|
+
delete_pid_file if pid == pid2
|
|
496
|
+
else
|
|
497
|
+
debug "Waiting until daemon is no longer running"
|
|
498
|
+
wait_until { !daemon_is_running? }
|
|
499
|
+
end
|
|
556
500
|
end
|
|
557
501
|
|
|
558
502
|
def save_log_file_information
|
|
559
|
-
@original_log_file_stat =
|
|
503
|
+
@original_log_file_stat = begin
|
|
504
|
+
File.stat(@log_file)
|
|
505
|
+
rescue
|
|
506
|
+
nil
|
|
507
|
+
end
|
|
560
508
|
@current_log_file_stat = @original_log_file_stat
|
|
561
509
|
end
|
|
562
510
|
|
|
563
511
|
def log_file_has_changed?
|
|
564
512
|
if @current_log_file_stat
|
|
565
|
-
stat =
|
|
513
|
+
stat = begin
|
|
514
|
+
File.stat(@log_file)
|
|
515
|
+
rescue
|
|
516
|
+
nil
|
|
517
|
+
end
|
|
566
518
|
if stat
|
|
567
519
|
result = @current_log_file_stat.mtime != stat.mtime ||
|
|
568
|
-
|
|
520
|
+
@current_log_file_stat.size != stat.size
|
|
569
521
|
@current_log_file_stat = stat
|
|
570
522
|
result
|
|
571
523
|
else
|
|
@@ -578,45 +530,88 @@ private
|
|
|
578
530
|
|
|
579
531
|
def differences_in_log_file
|
|
580
532
|
if @original_log_file_stat && @original_log_file_stat.file?
|
|
581
|
-
File.open(@log_file,
|
|
533
|
+
File.open(@log_file, "r") do |f|
|
|
582
534
|
f.seek(@original_log_file_stat.size, IO::SEEK_SET)
|
|
583
|
-
|
|
584
|
-
if diff.empty?
|
|
585
|
-
nil
|
|
586
|
-
else
|
|
587
|
-
diff
|
|
588
|
-
end
|
|
535
|
+
f.read.strip
|
|
589
536
|
end
|
|
590
|
-
else
|
|
591
|
-
nil
|
|
592
537
|
end
|
|
593
538
|
rescue Errno::ENOENT, Errno::ESPIPE
|
|
594
539
|
# ESPIPE means the log file is a pipe.
|
|
595
540
|
nil
|
|
596
541
|
end
|
|
597
542
|
|
|
598
|
-
def determine_lock_file(
|
|
599
|
-
if
|
|
600
|
-
LockFile.new(File.
|
|
543
|
+
def determine_lock_file(given_lock_file, identifier, pid_file)
|
|
544
|
+
if given_lock_file
|
|
545
|
+
LockFile.new(File.absolute_path(given_lock_file))
|
|
601
546
|
else
|
|
602
|
-
LockFile.new(File.
|
|
547
|
+
LockFile.new(File.absolute_path(pid_file + ".lock"))
|
|
603
548
|
end
|
|
604
549
|
end
|
|
605
550
|
|
|
606
|
-
def self.fork_supported?
|
|
607
|
-
RUBY_PLATFORM != "java" && RUBY_PLATFORM !~ /win32/
|
|
608
|
-
end
|
|
609
|
-
|
|
610
|
-
def self.spawn_supported?
|
|
611
|
-
# Process.spawn doesn't work very well in JRuby.
|
|
612
|
-
Process.respond_to?(:spawn) && RUBY_PLATFORM != "java"
|
|
613
|
-
end
|
|
614
|
-
|
|
615
551
|
def run_command(command)
|
|
616
552
|
if should_capture_output_while_running_command?
|
|
617
|
-
|
|
553
|
+
# Create tempfile for storing the command's output.
|
|
554
|
+
tempfile = Tempfile.new("daemon-output")
|
|
555
|
+
tempfile.chmod(0o666)
|
|
556
|
+
tempfile_path = tempfile.path
|
|
557
|
+
tempfile.close
|
|
558
|
+
|
|
559
|
+
spawn_options = {
|
|
560
|
+
in: "/dev/null",
|
|
561
|
+
out: tempfile_path,
|
|
562
|
+
err: tempfile_path,
|
|
563
|
+
close_others: true,
|
|
564
|
+
}
|
|
565
|
+
else
|
|
566
|
+
spawn_options = {
|
|
567
|
+
in: "/dev/null",
|
|
568
|
+
out: :out,
|
|
569
|
+
err: :err,
|
|
570
|
+
close_others: true,
|
|
571
|
+
}
|
|
572
|
+
end
|
|
573
|
+
|
|
574
|
+
if @keep_ios
|
|
575
|
+
@keep_ios.each do |io|
|
|
576
|
+
spawn_options[io] = io
|
|
577
|
+
end
|
|
578
|
+
end
|
|
579
|
+
|
|
580
|
+
pid = if @daemonize_for_me
|
|
581
|
+
Process.spawn(@env, ruby_interpreter, SPAWNER_FILE,
|
|
582
|
+
command, spawn_options)
|
|
583
|
+
else
|
|
584
|
+
Process.spawn(@env, command, spawn_options)
|
|
585
|
+
end
|
|
586
|
+
|
|
587
|
+
# run_command might be running in a timeout block (like
|
|
588
|
+
# in #start_without_locking).
|
|
589
|
+
begin
|
|
590
|
+
Process.waitpid(pid)
|
|
591
|
+
rescue Errno::ECHILD
|
|
592
|
+
# Maybe a background thread or whatever waitpid()'ed
|
|
593
|
+
# this child process before we had the chance. There's
|
|
594
|
+
# no way to obtain the exit status now. Assume that
|
|
595
|
+
# it started successfully; if it didn't we'll know
|
|
596
|
+
# that later by checking the PID file and by pinging
|
|
597
|
+
# it.
|
|
598
|
+
return InternalCommandOkResult.new(pid, tempfile_path && File.read(tempfile_path).strip)
|
|
599
|
+
rescue Timeout::Error
|
|
600
|
+
return InternalCommandTimeoutResult.new(pid, tempfile_path && File.read(tempfile_path).strip)
|
|
601
|
+
end
|
|
602
|
+
|
|
603
|
+
child_status = $?
|
|
604
|
+
output = File.read(tempfile_path).strip if tempfile_path
|
|
605
|
+
if child_status.success?
|
|
606
|
+
InternalCommandOkResult.new(pid, output)
|
|
618
607
|
else
|
|
619
|
-
|
|
608
|
+
InternalCommandErrorResult.new(pid, output, child_status)
|
|
609
|
+
end
|
|
610
|
+
ensure
|
|
611
|
+
begin
|
|
612
|
+
tempfile.unlink if tempfile
|
|
613
|
+
rescue SystemCallError
|
|
614
|
+
nil
|
|
620
615
|
end
|
|
621
616
|
end
|
|
622
617
|
|
|
@@ -645,192 +640,16 @@ private
|
|
|
645
640
|
path =~ %r{\A/proc/([0-9]+|self)/fd/[12]\Z}
|
|
646
641
|
end
|
|
647
642
|
|
|
648
|
-
def run_command_while_capturing_output(command)
|
|
649
|
-
# Create tempfile for storing the command's output.
|
|
650
|
-
tempfile = Tempfile.new('daemon-output')
|
|
651
|
-
tempfile.chmod(0666)
|
|
652
|
-
tempfile_path = tempfile.path
|
|
653
|
-
tempfile.close
|
|
654
|
-
|
|
655
|
-
if self.class.fork_supported? || self.class.spawn_supported?
|
|
656
|
-
if Process.respond_to?(:spawn)
|
|
657
|
-
options = {
|
|
658
|
-
in: "/dev/null",
|
|
659
|
-
out: tempfile_path,
|
|
660
|
-
err: tempfile_path,
|
|
661
|
-
close_others: true,
|
|
662
|
-
}
|
|
663
|
-
@keep_ios.each do |io|
|
|
664
|
-
options[io] = io
|
|
665
|
-
end
|
|
666
|
-
if @daemonize_for_me
|
|
667
|
-
pid = Process.spawn(@env, ruby_interpreter, SPAWNER_FILE,
|
|
668
|
-
command, options)
|
|
669
|
-
else
|
|
670
|
-
pid = Process.spawn(@env, command, options)
|
|
671
|
-
end
|
|
672
|
-
else
|
|
673
|
-
pid = safe_fork(@daemonize_for_me) do
|
|
674
|
-
ObjectSpace.each_object(IO) do |obj|
|
|
675
|
-
if !@keep_ios.include?(obj)
|
|
676
|
-
obj.close rescue nil
|
|
677
|
-
end
|
|
678
|
-
end
|
|
679
|
-
STDIN.reopen("/dev/null", "r")
|
|
680
|
-
STDOUT.reopen(tempfile_path, "w")
|
|
681
|
-
STDERR.reopen(tempfile_path, "w")
|
|
682
|
-
ENV.update(@env)
|
|
683
|
-
exec(command)
|
|
684
|
-
end
|
|
685
|
-
end
|
|
686
|
-
|
|
687
|
-
# run_command might be running in a timeout block (like
|
|
688
|
-
# in #start_without_locking).
|
|
689
|
-
begin
|
|
690
|
-
interruptable_waitpid(pid)
|
|
691
|
-
rescue Errno::ECHILD
|
|
692
|
-
# Maybe a background thread or whatever waitpid()'ed
|
|
693
|
-
# this child process before we had the chance. There's
|
|
694
|
-
# no way to obtain the exit status now. Assume that
|
|
695
|
-
# it started successfully; if it didn't we'll know
|
|
696
|
-
# that later by checking the PID file and by pinging
|
|
697
|
-
# it.
|
|
698
|
-
return
|
|
699
|
-
rescue Timeout::Error
|
|
700
|
-
daemonization_timed_out
|
|
701
|
-
|
|
702
|
-
# If the daemon doesn't fork into the background
|
|
703
|
-
# in time, then kill it.
|
|
704
|
-
begin
|
|
705
|
-
Process.kill('SIGTERM', pid)
|
|
706
|
-
rescue SystemCallError
|
|
707
|
-
end
|
|
708
|
-
begin
|
|
709
|
-
Timeout.timeout(5, Timeout::Error) do
|
|
710
|
-
begin
|
|
711
|
-
interruptable_waitpid(pid)
|
|
712
|
-
rescue SystemCallError
|
|
713
|
-
end
|
|
714
|
-
end
|
|
715
|
-
rescue Timeout::Error
|
|
716
|
-
begin
|
|
717
|
-
Process.kill('SIGKILL', pid)
|
|
718
|
-
interruptable_waitpid(pid)
|
|
719
|
-
rescue SystemCallError
|
|
720
|
-
end
|
|
721
|
-
end
|
|
722
|
-
raise DaemonizationTimeout
|
|
723
|
-
end
|
|
724
|
-
if $?.exitstatus != 0
|
|
725
|
-
raise StartError, File.read(tempfile_path).strip
|
|
726
|
-
end
|
|
727
|
-
else
|
|
728
|
-
if @env && !@env.empty?
|
|
729
|
-
raise "Setting the :env option is not supported on this Ruby implementation."
|
|
730
|
-
elsif @daemonize_for_me
|
|
731
|
-
raise "Setting the :daemonize_for_me option is not supported on this Ruby implementation."
|
|
732
|
-
end
|
|
733
|
-
|
|
734
|
-
cmd = "#{command} >\"#{tempfile_path}\""
|
|
735
|
-
cmd << " 2>\"#{tempfile_path}\"" unless PLATFORM =~ /mswin/
|
|
736
|
-
if !system(cmd)
|
|
737
|
-
raise StartError, File.read(tempfile_path).strip
|
|
738
|
-
end
|
|
739
|
-
end
|
|
740
|
-
ensure
|
|
741
|
-
File.unlink(tempfile_path) rescue nil
|
|
742
|
-
end
|
|
743
|
-
|
|
744
|
-
def run_command_without_capturing_output(command)
|
|
745
|
-
if self.class.fork_supported? || self.class.spawn_supported?
|
|
746
|
-
if Process.respond_to?(:spawn)
|
|
747
|
-
options = {
|
|
748
|
-
in: "/dev/null",
|
|
749
|
-
out: :out,
|
|
750
|
-
err: :err,
|
|
751
|
-
close_others: true,
|
|
752
|
-
}
|
|
753
|
-
@keep_ios.each do |io|
|
|
754
|
-
options[io] = io
|
|
755
|
-
end
|
|
756
|
-
if @daemonize_for_me
|
|
757
|
-
pid = Process.spawn(@env, ruby_interpreter, SPAWNER_FILE,
|
|
758
|
-
command, options)
|
|
759
|
-
else
|
|
760
|
-
pid = Process.spawn(@env, command, options)
|
|
761
|
-
end
|
|
762
|
-
else
|
|
763
|
-
pid = safe_fork(@daemonize_for_me) do
|
|
764
|
-
ObjectSpace.each_object(IO) do |obj|
|
|
765
|
-
if !@keep_ios.include?(obj)
|
|
766
|
-
obj.close rescue nil
|
|
767
|
-
end
|
|
768
|
-
end
|
|
769
|
-
STDIN.reopen("/dev/null", "r")
|
|
770
|
-
ENV.update(@env)
|
|
771
|
-
exec(command)
|
|
772
|
-
end
|
|
773
|
-
end
|
|
774
|
-
|
|
775
|
-
# run_command might be running in a timeout block (like
|
|
776
|
-
# in #start_without_locking).
|
|
777
|
-
begin
|
|
778
|
-
interruptable_waitpid(pid)
|
|
779
|
-
rescue Errno::ECHILD
|
|
780
|
-
# Maybe a background thread or whatever waitpid()'ed
|
|
781
|
-
# this child process before we had the chance. There's
|
|
782
|
-
# no way to obtain the exit status now. Assume that
|
|
783
|
-
# it started successfully; if it didn't we'll know
|
|
784
|
-
# that later by checking the PID file and by pinging
|
|
785
|
-
# it.
|
|
786
|
-
return
|
|
787
|
-
rescue Timeout::Error
|
|
788
|
-
daemonization_timed_out
|
|
789
|
-
|
|
790
|
-
# If the daemon doesn't fork into the background
|
|
791
|
-
# in time, then kill it.
|
|
792
|
-
begin
|
|
793
|
-
Process.kill('SIGTERM', pid)
|
|
794
|
-
rescue SystemCallError
|
|
795
|
-
end
|
|
796
|
-
begin
|
|
797
|
-
Timeout.timeout(5, Timeout::Error) do
|
|
798
|
-
begin
|
|
799
|
-
interruptable_waitpid(pid)
|
|
800
|
-
rescue SystemCallError
|
|
801
|
-
end
|
|
802
|
-
end
|
|
803
|
-
rescue Timeout::Error
|
|
804
|
-
begin
|
|
805
|
-
Process.kill('SIGKILL', pid)
|
|
806
|
-
interruptable_waitpid(pid)
|
|
807
|
-
rescue SystemCallError
|
|
808
|
-
end
|
|
809
|
-
end
|
|
810
|
-
raise DaemonizationTimeout
|
|
811
|
-
end
|
|
812
|
-
if $?.exitstatus != 0
|
|
813
|
-
raise StartError, "Daemon '#{@identifier}' failed to start."
|
|
814
|
-
end
|
|
815
|
-
else
|
|
816
|
-
if @env && !@env.empty?
|
|
817
|
-
raise "Setting the :env option is not supported on this Ruby implementation."
|
|
818
|
-
elsif @daemonize_for_me
|
|
819
|
-
raise "Setting the :daemonize_for_me option is not supported on this Ruby implementation."
|
|
820
|
-
end
|
|
821
|
-
|
|
822
|
-
if !system(command)
|
|
823
|
-
raise StartError, "Daemon '#{@identifier}' failed to start."
|
|
824
|
-
end
|
|
825
|
-
end
|
|
826
|
-
end
|
|
827
|
-
|
|
828
643
|
def run_ping_command
|
|
829
644
|
if @ping_command.respond_to?(:call)
|
|
830
645
|
begin
|
|
831
646
|
value = @ping_command.call
|
|
832
647
|
if value.respond_to?(:close)
|
|
833
|
-
|
|
648
|
+
begin
|
|
649
|
+
value.close
|
|
650
|
+
rescue
|
|
651
|
+
nil
|
|
652
|
+
end
|
|
834
653
|
end
|
|
835
654
|
value
|
|
836
655
|
rescue *ALLOWED_CONNECT_EXCEPTIONS
|
|
@@ -867,27 +686,55 @@ private
|
|
|
867
686
|
end
|
|
868
687
|
end
|
|
869
688
|
|
|
870
|
-
if
|
|
871
|
-
|
|
689
|
+
if can_ping_unix_sockets?
|
|
690
|
+
def ping_socket(socket_domain, sockaddr)
|
|
691
|
+
socket = Socket.new(socket_domain, Socket::Constants::SOCK_STREAM, 0)
|
|
692
|
+
begin
|
|
693
|
+
socket.connect_nonblock(sockaddr)
|
|
694
|
+
rescue Errno::ENOENT, Errno::EINPROGRESS, Errno::EAGAIN, Errno::EWOULDBLOCK
|
|
695
|
+
if select(nil, [ socket ], nil, 0.1)
|
|
696
|
+
begin
|
|
697
|
+
socket.connect_nonblock(sockaddr)
|
|
698
|
+
rescue Errno::EISCONN
|
|
699
|
+
rescue Errno::EINVAL
|
|
700
|
+
if RUBY_PLATFORM.match?(/freebsd/i)
|
|
701
|
+
raise Errno::ECONNREFUSED
|
|
702
|
+
else
|
|
703
|
+
raise
|
|
704
|
+
end
|
|
705
|
+
end
|
|
706
|
+
else
|
|
707
|
+
raise Errno::ECONNREFUSED
|
|
708
|
+
end
|
|
709
|
+
end
|
|
710
|
+
true
|
|
711
|
+
rescue Errno::ECONNREFUSED, Errno::ENOENT
|
|
712
|
+
false
|
|
713
|
+
ensure
|
|
714
|
+
socket.close if socket
|
|
715
|
+
end
|
|
716
|
+
|
|
717
|
+
def ping_tcp_socket(sockaddr)
|
|
718
|
+
ping_socket(Socket::Constants::AF_INET, sockaddr)
|
|
719
|
+
rescue Errno::EAFNOSUPPORT
|
|
720
|
+
ping_socket(Socket::Constants::AF_INET6, sockaddr)
|
|
721
|
+
end
|
|
722
|
+
else
|
|
723
|
+
require "java"
|
|
872
724
|
|
|
873
725
|
def ping_socket(host_name, port)
|
|
874
726
|
channel = java.nio.channels.SocketChannel.open
|
|
875
727
|
begin
|
|
876
728
|
address = java.net.InetSocketAddress.new(host_name, port)
|
|
877
729
|
channel.configure_blocking(false)
|
|
878
|
-
if channel.connect(address)
|
|
879
|
-
return true
|
|
880
|
-
end
|
|
730
|
+
return true if channel.connect(address)
|
|
881
731
|
|
|
882
732
|
deadline = Time.now.to_f + 0.1
|
|
883
|
-
|
|
884
|
-
while true
|
|
733
|
+
loop do
|
|
885
734
|
begin
|
|
886
|
-
if channel.finish_connect
|
|
887
|
-
return true
|
|
888
|
-
end
|
|
735
|
+
return true if channel.finish_connect
|
|
889
736
|
rescue java.net.ConnectException => e
|
|
890
|
-
if
|
|
737
|
+
if /Connection refused/i.match?(e.message)
|
|
891
738
|
return false
|
|
892
739
|
else
|
|
893
740
|
throw e
|
|
@@ -896,116 +743,85 @@ private
|
|
|
896
743
|
|
|
897
744
|
# Not done connecting and no error.
|
|
898
745
|
sleep 0.01
|
|
899
|
-
if Time.now.to_f >= deadline
|
|
900
|
-
return false
|
|
901
|
-
end
|
|
746
|
+
return false if Time.now.to_f >= deadline
|
|
902
747
|
end
|
|
903
748
|
ensure
|
|
904
749
|
channel.close
|
|
905
750
|
end
|
|
906
751
|
end
|
|
907
|
-
|
|
908
|
-
def ping_socket(socket_domain, sockaddr)
|
|
909
|
-
begin
|
|
910
|
-
socket = Socket.new(socket_domain, Socket::Constants::SOCK_STREAM, 0)
|
|
911
|
-
begin
|
|
912
|
-
socket.connect_nonblock(sockaddr)
|
|
913
|
-
rescue Errno::ENOENT, Errno::EINPROGRESS, Errno::EAGAIN, Errno::EWOULDBLOCK
|
|
914
|
-
if select(nil, [ socket ], nil, 0.1)
|
|
915
|
-
begin
|
|
916
|
-
socket.connect_nonblock(sockaddr)
|
|
917
|
-
rescue Errno::EISCONN
|
|
918
|
-
rescue Errno::EINVAL
|
|
919
|
-
if RUBY_PLATFORM =~ /freebsd/i
|
|
920
|
-
raise Errno::ECONNREFUSED
|
|
921
|
-
else
|
|
922
|
-
raise
|
|
923
|
-
end
|
|
924
|
-
end
|
|
925
|
-
else
|
|
926
|
-
raise Errno::ECONNREFUSED
|
|
927
|
-
end
|
|
928
|
-
end
|
|
929
|
-
true
|
|
930
|
-
rescue Errno::ECONNREFUSED, Errno::ENOENT
|
|
931
|
-
false
|
|
932
|
-
ensure
|
|
933
|
-
socket.close if socket
|
|
934
|
-
end
|
|
935
|
-
end
|
|
752
|
+
end
|
|
936
753
|
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
754
|
+
def ruby_interpreter
|
|
755
|
+
File.join(
|
|
756
|
+
RbConfig::CONFIG["bindir"],
|
|
757
|
+
RbConfig::CONFIG.values_at("RUBY_INSTALL_NAME", "EXEEXT").join
|
|
758
|
+
)
|
|
759
|
+
end
|
|
760
|
+
|
|
761
|
+
def timeoutable(amount, &block)
|
|
762
|
+
Thread.handle_interrupt(Timeout::Error => :never) do
|
|
763
|
+
start_time = monotonic_time
|
|
764
|
+
result = Timeout.timeout(amount, Timeout::Error, &block)
|
|
765
|
+
[ result, [ monotonic_time - start_time, 0 ].max ]
|
|
943
766
|
end
|
|
944
767
|
end
|
|
945
768
|
|
|
946
|
-
def
|
|
947
|
-
|
|
948
|
-
|
|
769
|
+
def allow_timeout(&block)
|
|
770
|
+
Thread.handle_interrupt(Timeout::Error => :on_blocking, &block)
|
|
771
|
+
end
|
|
772
|
+
|
|
773
|
+
def monotonic_time
|
|
774
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
775
|
+
end
|
|
776
|
+
|
|
777
|
+
def signal_termination_message(process_status)
|
|
778
|
+
if process_status.signaled?
|
|
779
|
+
"terminated with signal #{signal_name_for(process_status.termsig)}"
|
|
949
780
|
else
|
|
950
|
-
|
|
781
|
+
"exited with status #{process_status.exitstatus}"
|
|
951
782
|
end
|
|
952
|
-
File.join(
|
|
953
|
-
rb_config['bindir'],
|
|
954
|
-
rb_config['RUBY_INSTALL_NAME']
|
|
955
|
-
) + rb_config['EXEEXT']
|
|
956
783
|
end
|
|
957
784
|
|
|
958
|
-
def
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
Process.setsid
|
|
966
|
-
yield
|
|
967
|
-
end
|
|
968
|
-
else
|
|
969
|
-
yield
|
|
970
|
-
end
|
|
971
|
-
rescue Exception => e
|
|
972
|
-
message = "*** Exception #{e.class} " <<
|
|
973
|
-
"(#{e}) (process #{$$}):\n" <<
|
|
974
|
-
"\tfrom " << e.backtrace.join("\n\tfrom ")
|
|
975
|
-
STDERR.write(e)
|
|
976
|
-
STDERR.flush
|
|
977
|
-
exit!
|
|
978
|
-
ensure
|
|
979
|
-
exit!(0)
|
|
980
|
-
end
|
|
785
|
+
def normalize_signal_name(name)
|
|
786
|
+
name.start_with?("SIG") ? name : "SIG#{name}"
|
|
787
|
+
end
|
|
788
|
+
|
|
789
|
+
def signal_name_for(num)
|
|
790
|
+
if (name = Signal.list.key(num))
|
|
791
|
+
"SIG#{name}"
|
|
981
792
|
else
|
|
982
|
-
|
|
983
|
-
Process.waitpid(pid) rescue nil
|
|
984
|
-
pid
|
|
985
|
-
else
|
|
986
|
-
pid
|
|
987
|
-
end
|
|
793
|
+
num.to_s
|
|
988
794
|
end
|
|
989
795
|
end
|
|
990
796
|
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
797
|
+
def concat_spawn_output_and_logs(output, logs, exit_status = nil, suffix_message = nil)
|
|
798
|
+
format_full_suffix_message = lambda do |main_message = nil|
|
|
799
|
+
[
|
|
800
|
+
main_message,
|
|
801
|
+
exit_status ? signal_termination_message(exit_status) : nil,
|
|
802
|
+
suffix_message,
|
|
803
|
+
].compact.join("; ")
|
|
994
804
|
end
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
805
|
+
|
|
806
|
+
if output.nil? && logs.nil?
|
|
807
|
+
"(#{format_full_suffix_message.call("logs not available")})"
|
|
808
|
+
elsif (output && output.empty? && logs && logs.empty?) || (output && output.empty? && logs.nil?) || (output.nil? && logs && logs.empty?)
|
|
809
|
+
"(#{format_full_suffix_message.call("logs empty")})"
|
|
810
|
+
else
|
|
811
|
+
full_suffix_message = format_full_suffix_message.call
|
|
812
|
+
if full_suffix_message.empty?
|
|
813
|
+
"#{output}\n#{logs}".strip
|
|
814
|
+
elsif logs && logs.empty?
|
|
815
|
+
"#{output}\n(#{full_suffix_message})".strip
|
|
816
|
+
else
|
|
817
|
+
"#{output}\n#{logs}\n(#{full_suffix_message})".strip
|
|
1005
818
|
end
|
|
1006
|
-
result
|
|
1007
819
|
end
|
|
1008
820
|
end
|
|
821
|
+
|
|
822
|
+
def debug(message)
|
|
823
|
+
@logger.debug(message) if @logger
|
|
824
|
+
end
|
|
1009
825
|
end
|
|
1010
826
|
|
|
1011
827
|
end # module PhusionPassenger
|