Rails 3 / Heroku 无限僵尸测功机,具有简单的应用程序部署 - 太忙而无法打开控制台

发布于 2024-10-21 15:15:46 字数 4699 浏览 3 评论 0原文

事实上,谷歌搜索的结果很少,这让我觉得我在做一些完全错误的事情,因为这似乎是一个非常常见的问题。然而,我似乎找不到一个简单的解决方案,而且 Heroku 的文档总体来说很糟糕,而且他们的支持需要 1 天以上的时间才能响应,所以我在这里。

我有一个第一次尝试部署的应用程序。这是一个非常精简的应用程序,几乎是一个外壳应用程序。它在开发上工作,然后当我部署到 Heroku 时崩溃,并显示一个无用的 HTML 错误页面:

    Application Error
    An error occurred in the application and your page could not be served. 
Please try again in a few moments.    
    If you are the application owner, check your logs for details.

好的,最好检查日志。但 Heroku 日志没有告诉我任何信息:

Ovid:volatilityApp dlipa$ heroku logs
Ovid:volatilityApp dlipa$ 

Ovid:volatilityApp dlipa$ heroku logs -n 300
Ovid:volatilityApp dlipa$ 

好吧,嗯..最好登录控制台看看发生了什么。

Ovid:volatilityApp dlipa$ heroku console
Your application is too busy to open a console session.
Console sessions require an open dyno to use for execution.

嗯,这很糟糕,让我们看看正在运行什么。

Ovid:volatilityApp dlipa$ heroku ps
Process       State               Command
------------  ------------------  ------------------------------
web.1         crashed for 4m      thin -p $PORT -e $RACK_ENV -R $HER..

有道理..但是为什么 Heroku 的动态网格没有清除这个问题呢? Heroku 网站上没有有关该主题的信息。谷歌搜索导致 http://neilmiddleton.com/avoiding-zombie-dynos-with-heroku

好吧,很酷,所以我安装了rack-timeout gem 并添加了初始化程序并推送到heroku。我看着它完成“捆绑安装”。但仍然是同样的问题......

Ovid:volatilityApp dlipa$ heroku console
Your application is too busy to open a console session.
Console sessions require an open dyno to use for execution.

这真的很神秘并且开始变得令人沮丧。也许我应该从 Heroku 购买更多资源...这应该可以解决问题,因为这样我将有更多的 dynos 来打开控制台..

Ovid:volatilityApp dlipa$ heroku dynos
volatility is running 1 dyno

Ovid:volatilityApp dlipa$ heroku dynos 2
volatility now running 2 dynos

但是等等,Heroku 加载了与我拥有的 dynos 一样多的 Web 进程,而且它们都是僵尸出去!无论我的规模有多高,我都无法进入控制台。

Ovid:volatilityApp dlipa$ heroku dynos 10
volatility now running 10 dynos
Ovid:volatilityApp dlipa$ heroku ps
heroku consoleProcess       State               Command
------------  ------------------  ------------------------------
web.1         crashed for 2m      thin -p $PORT -e $RACK_ENV -R $HER..
web.2         crashed for 1m      thin -p $PORT -e $RACK_ENV -R $HER..
web.3         crashed for 37s     thin -p $PORT -e $RACK_ENV -R $HER..
web.4         crashed for 36s     thin -p $PORT -e $RACK_ENV -R $HER..
web.5         crashed for 35s     thin -p $PORT -e $RACK_ENV -R $HER..
web.6         crashed for 35s     thin -p $PORT -e $RACK_ENV -R $HER..
web.7         crashed for 37s     thin -p $PORT -e $RACK_ENV -R $HER..
web.8         crashed for 33s     thin -p $PORT -e $RACK_ENV -R $HER..
web.9         crashed for 38s     thin -p $PORT -e $RACK_ENV -R $HER..
web.10        crashed for 34s     thin -p $PORT -e $RACK_ENV -R $HER..
Ovid:volatilityApp dlipa$ heroku console
Your application is too busy to open a console session.
Console sessions require an open dyno to use for execution.
Ovid:volatilityApp dlipa$ 

是我的问题还是设计不好?为什么没有关于这个主题的信息?我做错了什么吗?

感谢您的帮助!

应用程序运行 3.0.5 Rails、1.9.2 ruby​​、postgresql。

--针对 BANTIC 的更新--

Ovid:volatilityApp dlipa$ heroku stack
  aspen-mri-1.8.6
  bamboo-ree-1.8.7
* bamboo-mri-1.9.2

Ovid:volatilityApp dlipa$ heroku ps
Process       State               Command
------------  ------------------  ------------------------------
web.1         crashed for 17s     thin -p $PORT -e $RACK_ENV -R $HER..
web.2         crashed for 1m      thin -p $PORT -e $RACK_ENV -R $HER..
web.3         crashed for 1m      thin -p $PORT -e $RACK_ENV -R $HER..

RubyGems Environment:
  - RUBYGEMS VERSION: 1.6.1
  - RUBY VERSION: 1.9.2 (2011-02-18 patchlevel 180) [x86_64-darwin10.6.0]
  - INSTALLATION DIRECTORY: /Users/dlipa/.rvm/gems/ruby-1.9.2-p180
  - RUBY EXECUTABLE: /Users/dlipa/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/dlipa/.rvm/gems/ruby-1.9.2-p180/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-10
  - GEM PATHS:
     - /Users/dlipa/.rvm/gems/ruby-1.9.2-p180
     - /Users/dlipa/.rvm/gems/ruby-1.9.2-p180@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["http://rubygems.org/", "http://gems.github.com"]
  - REMOTE SOURCES:
     - http://rubygems.org/
     - http://gems.github.com

链接到存储库:

https://github.com/lightserve/volatilityApp

The fact that there are so few results Googling around on this makes me think I am doing something totally wrong, because it seems like this would be an incredibly common problem. However I can't seem to find an easy solution and Heroku's docs suck in general, and their support takes >1 day to respond, so here I am.

I have an app that I am trying to deploy for the first time. It is a very lite app, almost a shell app. It works on dev and then crashes when I deploy to heroku with an unhelpful HTML error page:

    Application Error
    An error occurred in the application and your page could not be served. 
Please try again in a few moments.    
    If you are the application owner, check your logs for details.

Ok, better check the logs. But Heroku logs tells me nothing:

Ovid:volatilityApp dlipa$ heroku logs
Ovid:volatilityApp dlipa$ 

Ovid:volatilityApp dlipa$ heroku logs -n 300
Ovid:volatilityApp dlipa$ 

OK, hmm..better log into the console to see what is going on.

Ovid:volatilityApp dlipa$ heroku console
Your application is too busy to open a console session.
Console sessions require an open dyno to use for execution.

Hmm that sucks, lets look at what is running.

Ovid:volatilityApp dlipa$ heroku ps
Process       State               Command
------------  ------------------  ------------------------------
web.1         crashed for 4m      thin -p $PORT -e $RACK_ENV -R $HER..

Makes sense..but why doesn't Heroku's dyno grid clear this out? No info on topic on Heroku site. Googling around leads to http://neilmiddleton.com/avoiding-zombie-dynos-with-heroku

Ok cool so I install the rack-timeout gem and add the initializer and push to heroku. I watch it complete the 'bundle install'. But still the same problem...

Ovid:volatilityApp dlipa$ heroku console
Your application is too busy to open a console session.
Console sessions require an open dyno to use for execution.

Argh this is really cryptic and starting to become frustrating. Maybe I should just buy some more resources from Heroku...that should solve the problem, because then I will have more dynos to open the console..

Ovid:volatilityApp dlipa$ heroku dynos
volatility is running 1 dyno

Ovid:volatilityApp dlipa$ heroku dynos 2
volatility now running 2 dynos

But wait, Heroku loads as many web processes as I have dynos, and they all zombie out! And I can't get into the console no matter how high I scale.

Ovid:volatilityApp dlipa$ heroku dynos 10
volatility now running 10 dynos
Ovid:volatilityApp dlipa$ heroku ps
heroku consoleProcess       State               Command
------------  ------------------  ------------------------------
web.1         crashed for 2m      thin -p $PORT -e $RACK_ENV -R $HER..
web.2         crashed for 1m      thin -p $PORT -e $RACK_ENV -R $HER..
web.3         crashed for 37s     thin -p $PORT -e $RACK_ENV -R $HER..
web.4         crashed for 36s     thin -p $PORT -e $RACK_ENV -R $HER..
web.5         crashed for 35s     thin -p $PORT -e $RACK_ENV -R $HER..
web.6         crashed for 35s     thin -p $PORT -e $RACK_ENV -R $HER..
web.7         crashed for 37s     thin -p $PORT -e $RACK_ENV -R $HER..
web.8         crashed for 33s     thin -p $PORT -e $RACK_ENV -R $HER..
web.9         crashed for 38s     thin -p $PORT -e $RACK_ENV -R $HER..
web.10        crashed for 34s     thin -p $PORT -e $RACK_ENV -R $HER..
Ovid:volatilityApp dlipa$ heroku console
Your application is too busy to open a console session.
Console sessions require an open dyno to use for execution.
Ovid:volatilityApp dlipa$ 

Is it me or is this poorly designed? Why is there no information on this subject? Am I doing something totally wrong?

Thanks for your help!

App running 3.0.5 rails, 1.9.2 ruby, postgresql.

--UPDATE IN RESPONSE TO BANTIC--

Ovid:volatilityApp dlipa$ heroku stack
  aspen-mri-1.8.6
  bamboo-ree-1.8.7
* bamboo-mri-1.9.2

Ovid:volatilityApp dlipa$ heroku ps
Process       State               Command
------------  ------------------  ------------------------------
web.1         crashed for 17s     thin -p $PORT -e $RACK_ENV -R $HER..
web.2         crashed for 1m      thin -p $PORT -e $RACK_ENV -R $HER..
web.3         crashed for 1m      thin -p $PORT -e $RACK_ENV -R $HER..

RubyGems Environment:
  - RUBYGEMS VERSION: 1.6.1
  - RUBY VERSION: 1.9.2 (2011-02-18 patchlevel 180) [x86_64-darwin10.6.0]
  - INSTALLATION DIRECTORY: /Users/dlipa/.rvm/gems/ruby-1.9.2-p180
  - RUBY EXECUTABLE: /Users/dlipa/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/dlipa/.rvm/gems/ruby-1.9.2-p180/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-10
  - GEM PATHS:
     - /Users/dlipa/.rvm/gems/ruby-1.9.2-p180
     - /Users/dlipa/.rvm/gems/ruby-1.9.2-p180@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["http://rubygems.org/", "http://gems.github.com"]
  - REMOTE SOURCES:
     - http://rubygems.org/
     - http://gems.github.com

Link to repo:

https://github.com/lightserve/volatilityApp

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

流云如水 2024-10-28 15:15:46

您在 Heroku 上运行的堆栈与在本地运行的堆栈相同吗? Heroku 新应用程序 defaulto mr ruby​​ 187,据我所知。您可以尝试将 Heroku 堆栈迁移到 1.9.2。您可以通过以下方式执行此操作:

heroku stack:migrate bamboo-mri-1.9.2

下次推送到 heroku git 存储库时,堆栈将被迁移。

您能否提供有关您的应用程序功能的更多信息?是产生新进程还是使用线程?

Are you running the same stack on heroku as locally? Heroku new apps defaulto mri ruby 187, afaik. You might try migrating your heroku stack to 1.9.2. You can do that via:

heroku stack:migrate bamboo-mri-1.9.2

Next time you push to your heroku git repo, the stack will get migrated.

Can you give more information about what your app does? Is it spawning new processes or using threads?

心意如水 2024-10-28 15:15:46

我来到这个线程是因为我遇到了同样的问题。就我而言,问题是“routes.rb”文件中的错误。

I came to this thread because I had the same problem. In my case, the problem was an error in the "routes.rb" file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文