我像往常一样设置了一个虚拟机,该虚拟机具有 Apache + Passenger 的标准配置,托管一个 Rails 3.2 应用程序。该应用程序通过 thinking sphinx gem 与 Sphinxsearch 2.0.4 配合使用。
部署后,站点第一次受到 HTTP 请求时,将执行典型的 Sphinx 任务(构建索引和启动),并在几秒钟的延迟后显示错误页面,错误如下:
[ 2013-06-19 17:07:35.1643 16678/7f2ee30ef700 Pool2/Implementation.cpp:774 ]: Could not spawn process for group /srv/www/owo.biz/www/current#default: An error occurred while starting up the preloader: it did not write a startup response in time.
in 'void Passenger::ApplicationPool2::SmartSpawner::throwPreloaderSpawnException(const string&, Passenger::SpawnException::ErrorKind, Passenger::ApplicationPool2::Spawner::BackgroundIOCapturerPtr&, const DebugDirPtr&)' (SmartSpawner.h:150)
in 'std::string Passenger::ApplicationPool2::SmartSpawner::negotiatePreloaderStartup(Passenger::ApplicationPool2::SmartSpawner::StartupDetails&)' (SmartSpawner.h:558)
in 'void Passenger::ApplicationPool2::SmartSpawner::startPreloader()' (SmartSpawner.h:206)
in 'virtual Passenger::ApplicationPool2::ProcessPtr Passenger::ApplicationPool2::SmartSpawner::spawn(const Passenger::ApplicationPool2::Options&)' (SmartSpawner.h:744)
in 'void Passenger::ApplicationPool2::Group::spawnThreadRealMain(const SpawnerPtr&, const Passenger::ApplicationPool2::Options&, unsigned int)' (Implementation.cpp:707)
[ 2013-06-19 17:07:35.1646 16678/7f2ee0a53700 agents/HelperAgent/RequestHandler.h:1889 ]: [Client 20] Cannot checkout session. An error occurred while starting up the preloader: it did not write a startup response in time.
似乎请求超时了,无法答复。
是否需要预加载器?有没有办法禁用它?
这些是有趣的 Apache 指令:
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p429/gems/passenger-4.0.5/libout/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p429/gems/passenger-4.0.5
PassengerDefaultRuby /usr/local/rvm/wrappers/ruby-1.9.3-p429/ruby
PassengerHighPerformance on
PassengerMaxPoolSize 10
PassengerPreStart http://new.example.com/
PassengerMinInstances 3
答案1
对于 Passenger >= 4.0 版本,您必须检查没有特定于应用程序的语句(例如索引和启动 Thinkingsphinx)被包含在config.ru
.
已要求开发人员修复,现在问题已解决。