我的应用程序一次又一次崩溃。我正在使用 digital ocean 的托管服务,服务器的状态也显示在图像中 (当我重新启动服务器时它开始工作,但这不是解决方案。过了一段时间它再次崩溃。)Apache log.error 显示:
[ 2016-07-05 16:40:39.2615 1768/7ff87c09b700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /home/abc/kbs: An er$
Error ID: b1aaad3d
Error details saved to: /tmp/passenger-error-ygdDZS.html
Message from application: An error occurred while starting the web application. It exited before signalling successful startup back to Phusion$
<h2>Raw process output:</h2>
(empty)
App 21534 stdout: ^[[1m^[[35mCategoryProduct Load (23.0ms)^[[0m SELECT "category_products".* FROM "category_products" WHERE "category_product$
App 21534 stdout: ^[[1m^[[36m (0.5ms)^[[0m ^[[1mSELECT "category_products"."name" FROM "category_products" WHERE "category_products"."product$
terminate called after throwing an instance of 'Passenger::SystemException'
App 21534 stdout: ^[[1m^[[35mCACHE (0.3ms)^[[0m SELECT "countries".* FROM "countries" WHERE "countries"."id" = $1 ORDER BY name LIMIT 1 [[$
what(): Cannot fork a new process: Cannot allocate memory (errno=12)
ERROR: cannot fork a process for executing 'tee'
[ pid=1768, timestamp=1467751239 ] Process aborted! signo=SIGABRT(6), reason=SI_TKILL, signal sent by PID 1768 with UID 0, si_addr=0x6e8, random$
[ pid=1768 ] Could not create crash log file, so dumping to stderr only.
[ pid=1768 ] Could fork a child process for dumping diagnostics: fork() failed with errno=12
文件 /tmp/passenger-error-ygdDZS.html 的内容如下。
An error occurred while starting the web application. It exited before signalling successful startup back to Phusion Passenger. Please read this article for more information about this problem.
Raw process output:
(empty)
Error ID
b1aaad3d
Application root
/home/abc_user/app_name
Environment (value of RAILS_ENV, RACK_ENV, WSGI_ENV, NODE_ENV and PASSENGER_APP_ENV)
production
Ruby interpreter command
/usr/bin/passenger_free_ruby
User and groups
uid=1000(abc_user) gid=1000(abc_user) groups=1000(abc_user),27(sudo)
Environment variables
APACHE_PID_FILE=/var/run/apache2/apache2.pid
SHELL=/bin/bash
APACHE_RUN_USER=www-data
PASSENGER_DEBUG_DIR=/tmp/passenger.spawn-debug.XXXXijaXyT
USER=abc_user
PASSENGER_USE_FEEDBACK_FD=true
APACHE_LOG_DIR=/var/log/apache2
PATH=/home/abc_user/.rbenv/plugins/ruby-build/bin:/home/abc_user/.rbenv/shims:/home/abc_user/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/home/abc_user/app_name
APACHE_RUN_GROUP=www-data
LANG=C
NODE_PATH=/usr/share/passenger/node
RBENV_SHELL=bash
SHLVL=0
HOME=/home/abc_user
LOGNAME=abc_user
SERVER_SOFTWARE=Apache/2.4.7 (Ubuntu) Phusion_Passenger/5.0.26
APACHE_LOCK_DIR=/var/lock/apache2
APACHE_RUN_DIR=/var/run/apache2
IN_PASSENGER=1
PYTHONUNBUFFERED=1
RAILS_ENV=production
RACK_ENV=production
WSGI_ENV=production
NODE_ENV=production
PASSENGER_APP_ENV=production
SCRIPT_URL=/products/spray-paints-hand-tools
SCRIPT_URI=https://www.domain.com/products/name_of_brand
HTTPS=on
SSL_TLS_SNI=www.domain.com
Ulimits
Unknown
System metrics
------------- General -------------
Kernel version : 3.13.0-79-generic
Uptime : 8h 41m 28s
Load averages : 4.03%, 2.24%, 0.96%
Fork rate : unknown
------------- CPU -------------
Number of CPUs : 2
Average CPU usage : 100% -- 100% user, 0% nice, 0% system, 0% idle
CPU 1 : 100% -- 100% user, 0% nice, 0% system, 0% idle
CPU 2 : 100% -- 100% user, 0% nice, 0% system, 0% idle
I/O pressure : 0%
CPU 1 : 0%
CPU 2 : 0%
Interference from other VMs: 0%
CPU 1 : 0%
CPU 2 : 0%
------------- Memory -------------
RAM total : 2001 MB
RAM used : 1879 MB (94%)
RAM free : 122 MB
Swap total : 0 MB
Swap used : 0 MB (-nan%)
Swap free : 0 MB
Swap in : unknown
Swap out : unknown
有关我的服务器的一些信息
服务器版本:Apache/2.4.7(Ubuntu)
服务器建立时间:2016 年 1 月 14 日 17:45:23
Phusion Passenger 5.0.26
内存(Ram)2GB 磁盘空间 40Gb
答案1
请从 httpd.conf 或给定 Apache 服务器的其他配置文件中发布以下内容:::
StartServers ?
MinSpareServers ?
MaxSpareServers ?
可能是您启动的备用服务器数量远远超过该服务器能够处理简单 Web 应用程序负载的能力。Passenger 在 apache 内部运行并从中分叉。