简体   繁体   English

使用领班启动时,Rails服务器挂起

[英]Rails server hangs when started with foreman

Here's what my Procfile looks like: 这是我的Procfile的样子:

web: bundle exec rails server thin -p $PORT -e $RACK_ENV
worker: bundle exec rake jobs:work

I intend to add a worker process because I wish to run some background jobs. 我打算添加一个工作进程,因为我希望运行一些后台作业。 I'm following these instructions 我正在按照以下说明进行操作

This is what I noticed: 这是我注意到的:

  • No problems encountered if the worker is started separately. 如果单独启动该工作程序,则不会遇到任何问题。
  • When I keep the second line in the Procfile and don't not change anything else, the rails server serves a couple of requests and hangs after that 当我将第二行保留在Procfile中并且不进行任何其他更改时,rails服务器会处理几个请求并在此之后挂起
  • As mentioned here , I've added STDOUT.sync = true to config/environments/development.rb and verified the same in the rails console. 如前所述在这里 ,我已经添加STDOUT.sync = true到配置/环境/ development.rb并验证在轨控制台相同。 Did not work. 不工作。
  • Tailed log/development.log and compared it against the stuff that foreman outputted to the shell and noticed that both matched for a couple of requests and then foreman stopped printing out stuff to the shell - the next request would then hang 跟踪log / development.log并将其与领班输出到shell的内容进行比较,并注意到两者都匹配了几个请求,然后领班停止了将内容打印到shell -接下来的请求将挂起
  • I updated foreman using foreman.pkg as mentioned here and verified the same with [6] 我使用这里提到的foreman.pkg更新了工头并使用[6]进行了验证
  • It was mentioned here that this might be caused due to a stray debug statement. 这里提到,这可能是由于杂散的调试语句引起的。 I'm not using the debugger and I do not have the pry gem or the ruby-debug gem in my Gemfile.lock 我没有使用调试器,我的Gemfile.lock中没有撬动的宝石或红宝石的调试宝石。
  • I believe the symptoms are similar to this related unanswered question 我认为症状类似于此相关的未解决问题

Please help! 请帮忙!

[6]: [6]:

which foreman
/usr/bin/foreman
ls -lah /usr/bin/foreman  # checked the updated date

Tracked and resolved here: 在此处跟踪并解决:

https://github.com/ddollar/foreman/issues/244 https://github.com/ddollar/foreman/issues/244

TL;DR: Install the gem, don't use foreman.pkg TL; DR:安装gem,请不要使用foreman.pkg

I'll add than if you're using Heroku, the foreman version included with the heroku toolbelt has the same issue. 我要补充的是,如果您使用的是Heroku,heroku工具带随附的工头版本也会出现相同的问题。

Use the one you can get with gem install foreman instead. 请改用您可以通过gem install foreman获得的版本。

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

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