[英]Unicorn Freezes on Start
I am doing some troubleshooting to figure out why my site will not load. 我正在做一些故障排除,以弄清为什么我的网站无法加载。
I am using Amazon OopsWorks. 我正在使用Amazon OopsWorks。 I have an Amazon Linux server running Rails 4.2.0 and Ruby 2.2.0.
我有一台运行Rails 4.2.0和Ruby 2.2.0的Amazon Linux服务器。 I'm using Nginx and Unicorn.
我正在使用Nginx和Unicorn。 I have verified Nginx is running.
我已验证Nginx正在运行。 When I try to start Unicorn with
bundle exec unicorn -E production -c /srv/www/likeminds/current/config/unicorn.rb
I do not get an error. 当我尝试使用
bundle exec unicorn -E production -c /srv/www/likeminds/current/config/unicorn.rb
启动Unicorn时,我没有收到错误。 I do not get anything, actually. 我什么也没得到。 That's the problem, nothing happens.
那是问题,什么都没有发生。
What's going on with Unicorn? 独角兽怎么了? It seems like it is freezing on start.
似乎一开始就冻结了。 Thanks in advance for the help.
先谢谢您的帮助。
Here is what is running on my server. 这是我的服务器上正在运行的内容。
2278 aws 20 0 323m 69m 4212 S 0.7 7.0 0:00.99 opsworks-agent
1 root 20 0 19596 1608 1292 S 0.0 0.2 0:00.55 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:00.81 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
6 root 20 0 0 0 0 S 0.0 0.0 0:00.08 kworker/u30:0
7 root 20 0 0 0 0 S 0.0 0.0 0:00.54 rcu_sched
8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh
9 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
10 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 khelper
11 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs
12 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 netns
13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/u30:1
19 root 20 0 0 0 0 S 0.0 0.0 0:00.00 xenwatch
20 root 20 0 0 0 0 S 0.0 0.0 0:00.00 xenbus
21 root 20 0 0 0 0 S 0.0 0.0 0:00.09 kworker/0:1
115 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 writeback
Updating my Unicorn.rb file did not work. 更新我的Unicorn.rb文件不起作用。 Now EC2 outputs
现在EC2输出
/home/deploy/.bundler/likeminds/ruby/2.2.0/gems/unicorn-4.9.0/lib/unicorn/configurator.rb:657:in `parse_rackup_file': rackup file (config.ru) not readable (ArgumentError)
Here is the Unicorn.rb that causes Unicorn to freeze 这是导致Unicorn冻结的Unicorn.rb
# Set the working application directory
# working_directory "/path/to/your/app"
working_directory "/srv/www/likeminds/current/"
# Unicorn PID file location
# pid "/path/to/pids/unicorn.pid"
pid "/srv/www/likeminds/shared/pids/unicorn.pid"
# Path to logs
# stderr_path "/path/to/log/unicorn.log"
# stdout_path "/path/to/log/unicorn.log"
stderr_path "/srv/www/likeminds/shared/log/unicorn.log"
stdout_path "/srv/www/likeminds/shared/log/unicorn.log"
# Unicorn socket
listen "/srv/www/likeminds/shared/sockets/unicorn.likeminds.sock"
listen "/srv/www/likeminds/shared/sockets/unicorn.likeminds.sock"
# Number of processes
# worker_processes 4
worker_processes 2
# Time-out
timeout 30
Here is the version that outputs an error, but does run successfully on my localhost. 这是一个输出错误但在我的本地主机上成功运行的版本。
if ENV["RAILS_ENV"] == "development"
worker_processes 1
else
worker_processes 3
end
timeout 30
After changing permissions I was able to start Unicorn. 更改权限后,我能够启动Unicorn。 But I am receiving errors.
但是我收到错误。
E, [2015-05-17T00:21:47.129959 #7004] ERROR -- : reaped #<Process::Status: pid 8943 exit 1> worker=0
I, [2015-05-17T00:21:47.130085 #7004] INFO -- : worker=0 spawning...
I, [2015-05-17T00:21:47.130878 #8953] INFO -- : worker=2 spawned pid=8953
I, [2015-05-17T00:21:47.132421 #8953] INFO -- : Refreshing Gem list
I, [2015-05-17T00:21:47.136806 #8955] INFO -- : worker=0 spawned pid=8955
I, [2015-05-17T00:21:47.140432 #8955] INFO -- : Refreshing Gem list
E, [2015-05-17T00:21:50.288644 #8950] ERROR -- : undefined local variable or method `ru' for #<LikeMinds::Apps
checking manually from the command line should show you some output. 从命令行手动检查应该显示一些输出。 for example, I see:
例如,我看到:
I, [2015-05-16T16:36:12.487217 #63958] INFO -- : listening on addr=0.0.0.0:8080 fd=9
I, [2015-05-16T16:36:12.487321 #63958] INFO -- : worker=0 spawning...
I, [2015-05-16T16:36:12.488381 #63958] INFO -- : master process ready
I, [2015-05-16T16:36:12.489353 #63959] INFO -- : worker=0 spawned pid=63959
I, [2015-05-16T16:36:12.489799 #63959] INFO -- : Refreshing Gem list
I, [2015-05-16T16:36:16.198329 #63959] INFO -- : worker=0 ready
Do you see anything using this method or in unicorn.sterr.log? 使用此方法或在unicorn.sterr.log中是否看到任何内容? Please post your unicorn config file.
请发布您的独角兽配置文件。
SOLUTION: it appears that the pid filepath was not writable by the unicorn process. 解决方案:看来麒麟进程无法写入pid文件路径。 Changing the permission to allow for access by the owner of the process seems to have worked.
更改权限以允许该进程的所有者进行访问似乎已奏效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.