简体   繁体   English

Thin每台服务器启动两个ruby进程,杀死一个错误

[英]thin starts two ruby processes per server, kills wrong one

I'm starting up three thin processes with bundle exec thin start -C /etc/thin/staging.yml 我正在使用bundle exec thin start -C /etc/thin/staging.yml三个瘦进程

I use rvm, ruby version is ree-1.8.7 我使用rvm,ruby版本为ree-1.8.7

Contents of /etc/thin/staging.yml : /etc/thin/staging.yml内容:

---                                                             
timeout: 30                                                     
pid: /home/myuser/apps/g/shared/pids/thin.pid           
max_persistent_conns: 512                                       
servers: 3                                                      
chdir: /home/myuser/apps/g/current                      
port: 3040                                                      
require: []                                                     

log: /home/myuser/apps/g/shared/log/thin.log            
daemonize: true                                                 
address: 0.0.0.0                                                
max_conns: 1024                                                 
wait: 30                                                        
environment: staging                                            

lsof -i :3040-3042 will show three ruby processes listening on ports 3040-3042, but the pid files contain three different (slightly lower) pids. lsof -i :3040-3042将显示在端口3040-3042上侦听的三个ruby进程,但是pid文件包含三个不同(略低)的pid。 All six processes are called merb : merb : Master 这六个过程都称为merb : merb : Master

When I stop thin with bundle exec thin stop -C /etc/thin/staging.yml , thin first sends a QUIT signal to the processes in the pid files, then, after a timeout, a KILL signal. 当我使用bundle exec thin stop -C /etc/thin/staging.yml ,thin首先向pid文件中的进程发送QUIT信号,然后在超时后发送KILL信号。

The pid files are now gone, the thin logs show that the server has stopped, but there are still three ruby processes listening on ports 3040-3042, so a subsequent thin start will fail. pid文件现在不见了,瘦日志显示服务器已停止,但是仍然有三个ruby进程在端口3040-3042上侦听,因此后续的thin start将失败。

The only differences between the output of lsof -p of both processes is a /lib/libnss_files-2.12.so library and a postgres socket. 这两个进程的lsof -p输出之间的唯一区别是/lib/libnss_files-2.12.so库和postgres套接字。

My questions are: 我的问题是:

  • why do I get a timeout during thin stop ? 为什么在thin stop期间超时?
  • why are there two processes per server instead of one? 为什么每个服务器有两个进程而不是一个?
  • how do I fix this elegantly (without kill -9) 我如何优雅地解决此问题(不杀死-9)

Apparently the Merb bootloader does a fork. 显然,Merb引导加载程序会进行分叉。 How braindead is that! 那是多么的死脑筋!

Set Merb::Config[:fork_for_class_load] = false in your config.ru . 在您的config.ru设置Merb::Config[:fork_for_class_load] = false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM