Ruby-on-rails Heroku 错误 R14(超出内存配额):我该如何解决?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8875280/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Heroku Error R14 (Memory quota exceeded): How do I solve this?
提问by jamesc
I have a Rails 3.1 app on Heroku. I am seeing a lot of these errors:
我在 Heroku 上有一个 Rails 3.1 应用程序。我看到很多这样的错误:
Error R14 (Memory quota exceeded)
错误 R14(超出内存配额)
Typically the preceding log entry is showing:
通常,前面的日志条目显示:
Process running mem=522M(102.1%)
进程运行 mem=522M(102.1%)
This does vary a little but never by much and can occur after almost any URL request, so it's not related to a specific controller action as far as I can tell.
这确实有所不同,但不会有太大变化,并且几乎可以在任何 URL 请求之后发生,因此据我所知,它与特定的控制器操作无关。
This is a classic block of log entries:
这是一个经典的日志条目块:
2012-01-16T02:35:57+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=55ms status=401 bytes=27
2012-01-16T02:35:58+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=155ms status=200 bytes=1
2012-01-16T02:36:02+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=13ms status=401 bytes=27
2012-01-16T02:36:02+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=147ms status=200 bytes=1
2012-01-16T02:36:09+00:00 heroku[router]: POST prizequiz.herokuapp.com/mobile_users dyno=web.1 queue=0 wait=0ms service=87ms status=201 bytes=624
2012-01-16T02:36:11+00:00 heroku[router]: GET prizequiz.herokuapp.com/quizzes/1/questions dyno=web.1 queue=0 wait=0ms service=5ms status=401 bytes=27
2012-01-16T02:36:11+00:00 heroku[router]: GET prizequiz.herokuapp.com/quizzes/1/questions dyno=web.1 queue=0 wait=0ms service=290ms status=200 bytes=81412
2012-01-16T02:36:15+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=10ms status=401 bytes=27
2012-01-16T02:36:16+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=67ms status=200 bytes=1
2012-01-16T02:36:33+00:00 heroku[router]: POST prizequiz.herokuapp.com/quizzes/1/scores dyno=web.1 queue=0 wait=0ms service=10ms status=401 bytes=27
2012-01-16T02:36:33+00:00 heroku[router]: POST prizequiz.herokuapp.com/quizzes/1/scores dyno=web.1 queue=0 wait=0ms service=132ms status=201 bytes=230
2012-01-16T02:36:55+00:00 heroku[web.1]: Process running mem=522M(102.1%)
2012-01-16T02:36:55+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-16T02:37:17+00:00 app[web.1]:
2012-01-16T02:37:17+00:00 app[web.1]:
2012-01-16T02:37:17+00:00 app[web.1]: Started POST "/quizzes/1/scores" for 177.53.80.25 at 2012-01-16 02:37:17 +0000
2012-01-16T02:37:17+00:00 app[web.1]: cache: [POST /quizzes/1/scores] invalidate, pass
2012-01-16T02:37:17+00:00 app[web.1]:
2012-01-16T02:37:17+00:00 app[web.1]:
2012-01-16T02:37:17+00:00 app[web.1]: Started POST "/quizzes/1/scores" for 177.53.80.25 at 2012-01-16 02:37:17 +0000
2012-01-16T02:37:17+00:00 app[web.1]: cache: [POST /quizzes/1/scores] invalidate, pass
2012-01-16T02:37:17+00:00 heroku[router]: POST prizequiz.herokuapp.com/quizzes/1/scores dyno=web.1 queue=0 wait=0ms service=44ms status=201 bytes=230
2012-01-16T02:37:17+00:00 heroku[web.1]: Process running mem=522M(102.1%)
2012-01-16T02:37:17+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-16T02:37:17+00:00 heroku[router]: POST prizequiz.herokuapp.com/quizzes/1/scores dyno=web.1 queue=0 wait=0ms service=16ms status=401 bytes=27
2012-01-16T02:37:20+00:00 app[web.1]:
2012-01-16T02:37:20+00:00 app[web.1]:
2012-01-16T02:37:20+00:00 app[web.1]: Started GET "/quizzes/1/scores/current_game" for 177.53.80.25 at 2012-01-16 02:37:20 +0000
2012-01-16T02:37:20+00:00 app[web.1]: cache: [GET /quizzes/1/scores/current_game] miss
2012-01-16T02:37:20+00:00 app[web.1]:
2012-01-16T02:37:20+00:00 app[web.1]:
2012-01-16T02:37:20+00:00 app[web.1]: Started GET "/quizzes/1/scores/current_game" for 177.53.80.25 at 2012-01-16 02:37:20 +0000
2012-01-16T02:37:20+00:00 heroku[router]: GET prizequiz.herokuapp.com/quizzes/1/scores/current_game dyno=web.1 queue=0 wait=0ms service=8ms status=401 bytes=27
2012-01-16T02:37:20+00:00 app[web.1]: cache: [GET /quizzes/1/scores/current_game] miss
2012-01-16T02:37:20+00:00 heroku[router]: GET prizequiz.herokuapp.com/quizzes/1/scores/current_game dyno=web.1 queue=0 wait=0ms service=6ms status=401 bytes=27
2012-01-16T02:37:20+00:00 app[web.1]:
2012-01-16T02:37:20+00:00 app[web.1]:
2012-01-16T02:37:20+00:00 app[web.1]: Started POST "/quizzes/1/scores" for 177.53.80.25 at 2012-01-16 02:37:20 +0000
2012-01-16T02:37:20+00:00 heroku[router]: POST prizequiz.herokuapp.com/quizzes/1/scores dyno=web.1 queue=0 wait=0ms service=33ms status=401 bytes=27
2012-01-16T02:37:20+00:00 app[web.1]: cache: [POST /quizzes/1/scores] invalidate, pass
2012-01-16T02:37:20+00:00 app[web.1]:
2012-01-16T02:37:20+00:00 app[web.1]:
2012-01-16T02:37:20+00:00 app[web.1]: Started GET "/quizzes/1/scores/current_game" for 177.53.80.25 at 2012-01-16 02:37:20 +0000
2012-01-16T02:37:20+00:00 app[web.1]:
2012-01-16T02:37:20+00:00 app[web.1]:
I have New Relic installed but have been unable to identify anything of any use.
我安装了 New Relic,但无法识别任何有用的东西。
Will gladly supply more info if needed. I also have an outstanding support request on Heroku for this but as yet (2 days marked as urgent) I have had no response.
如果需要,将很乐意提供更多信息。我在 Heroku 上也有一个悬而未决的支持请求,但到目前为止(标记为紧急的 2 天)我没有回应。
Adding web dynos makes no difference.
添加 Web dynos 没有任何区别。
UPDATE, I have added the oink gem and this is a sample result
更新,我添加了 oink gem,这是一个示例结果
2012-01-26T08:24:25+00:00 app[web.1]:
2012-01-26T08:24:25+00:00 app[web.1]:
2012-01-26T08:24:25+00:00 app[web.1]: Started PUT "/mobile_users/1" for 110.49.234.219 at 2012-01-26 08:24:25 +0000
2012-01-26T08:24:26+00:00 app[web.1]: Oink Action: mobile_users#update
2012-01-26T08:24:26+00:00 app[web.1]: Memory usage: 286276 | PID: 16
2012-01-26T08:24:26+00:00 app[web.1]: Instantiation Breakdown: Total: 2 | MobileUser: 2
2012-01-26T08:24:26+00:00 app[web.1]: Oink Log Entry Complete
2012-01-26T08:24:26+00:00 app[web.1]: cache: [PUT /mobile_users/1] invalidate, pass
2012-01-26T08:24:26+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=460ms status=200 bytes=1
2012-01-26T08:24:38+00:00 heroku[web.1]: Process running mem=537M(104.9%)
2012-01-26T08:24:38+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:24:43+00:00 app[web.1]:
2012-01-26T08:24:43+00:00 app[web.1]:
2012-01-26T08:24:43+00:00 app[web.1]: Started PUT "/mobile_users/1" for 103.1.165.23 at 2012-01-26 08:24:43 +0000
2012-01-26T08:24:43+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=544ms status=401 bytes=27
2012-01-26T08:24:43+00:00 app[web.1]: Oink Action: mobile_users#update
2012-01-26T08:24:43+00:00 app[web.1]: Memory usage: 288876 | PID: 19
2012-01-26T08:24:43+00:00 app[web.1]: Instantiation Breakdown: Total: 0
2012-01-26T08:24:43+00:00 app[web.1]: Oink Log Entry Complete
2012-01-26T08:24:43+00:00 app[web.1]: cache: [PUT /mobile_users/1] invalidate, pass
2012-01-26T08:24:47+00:00 app[web.1]:
2012-01-26T08:24:47+00:00 app[web.1]:
2012-01-26T08:24:47+00:00 app[web.1]: Started PUT "/mobile_users/1" for 103.1.165.23 at 2012-01-26 08:24:47 +0000
2012-01-26T08:24:48+00:00 app[web.1]: Oink Action: mobile_users#update
2012-01-26T08:24:48+00:00 app[web.1]: Memory usage: 286412 | PID: 16
2012-01-26T08:24:48+00:00 app[web.1]: Instantiation Breakdown: Total: 2 | MobileUser: 2
2012-01-26T08:24:48+00:00 app[web.1]: Oink Log Entry Complete
2012-01-26T08:24:48+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=432ms status=200 bytes=1
2012-01-26T08:24:48+00:00 app[web.1]: cache: [PUT /mobile_users/1] invalidate, pass
2012-01-26T08:24:59+00:00 heroku[web.1]: Process running mem=537M(104.9%)
2012-01-26T08:24:59+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:25:20+00:00 heroku[web.1]: Process running mem=537M(104.9%)
2012-01-26T08:25:20+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:25:41+00:00 heroku[web.1]: Process running mem=537M(104.9%)
2012-01-26T08:25:41+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:26:32+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=34ms status=401 bytes=27
2012-01-26T08:27:04+00:00 app[web.1]:
2012-01-26T08:27:04+00:00 app[web.1]:
2012-01-26T08:27:04+00:00 app[web.1]: Started PUT "/mobile_users/1" for 103.1.165.23 at 2012-01-26 08:27:04 +0000
2012-01-26T08:27:04+00:00 app[web.1]: Oink Action: mobile_users#update
2012-01-26T08:27:04+00:00 app[web.1]: Memory usage: 288876 | PID: 19
2012-01-26T08:27:04+00:00 app[web.1]: Instantiation Breakdown: Total: 2 | MobileUser: 2
2012-01-26T08:27:04+00:00 app[web.1]: Oink Log Entry Complete
2012-01-26T08:27:04+00:00 app[web.1]: cache: [PUT /mobile_users/1] invalidate, pass
2012-01-26T08:27:04+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=337ms status=200 bytes=1
2012-01-26T08:27:05+00:00 heroku[web.1]: Process running mem=537M(104.9%)
2012-01-26T08:27:05+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:27:26+00:00 heroku[web.1]: Process running mem=537M(104.9%)
2012-01-26T08:27:26+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:27:48+00:00 heroku[web.1]: Process running mem=537M(104.9%)
2012-01-26T08:27:48+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:28:08+00:00 heroku[web.1]: Process running mem=537M(105.0%)
2012-01-26T08:28:08+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:28:29+00:00 heroku[web.1]: Process running mem=537M(105.0%)
2012-01-26T08:28:29+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:28:51+00:00 heroku[web.1]: Process running mem=537M(105.0%)
2012-01-26T08:28:51+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:29:08+00:00 app[web.1]:
2012-01-26T08:29:08+00:00 app[web.1]:
2012-01-26T08:29:08+00:00 app[web.1]: Started PUT "/mobile_users/1" for 85.26.234.218 at 2012-01-26 08:29:08 +0000
2012-01-26T08:29:08+00:00 app[web.1]: Oink Action: mobile_users#update
2012-01-26T08:29:08+00:00 app[web.1]: Memory usage: 382404 | PID: 13
2012-01-26T08:29:08+00:00 app[web.1]: Instantiation Breakdown: Total: 0
2012-01-26T08:29:08+00:00 app[web.1]: Oink Log Entry Complete
2012-01-26T08:29:08+00:00 app[web.1]: cache: [PUT /mobile_users/1] invalidate, pass
2012-01-26T08:29:08+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=86ms status=401 bytes=27
2012-01-26T08:29:09+00:00 app[web.1]:
2012-01-26T08:29:09+00:00 app[web.1]:
2012-01-26T08:29:09+00:00 app[web.1]: Started PUT "/mobile_users/1" for 85.26.234.218 at 2012-01-26 08:29:09 +0000
2012-01-26T08:29:09+00:00 app[web.1]: Oink Action: mobile_users#update
2012-01-26T08:29:09+00:00 app[web.1]: Memory usage: 382404 | PID: 13
2012-01-26T08:29:09+00:00 app[web.1]: Instantiation Breakdown: Total: 2 | MobileUser: 2
2012-01-26T08:29:09+00:00 app[web.1]: Oink Log Entry Complete
2012-01-26T08:29:09+00:00 app[web.1]: cache: [PUT /mobile_users/1] invalidate, pass
2012-01-26T08:29:09+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=160ms status=200 bytes=1
2012-01-26T08:29:11+00:00 app[web.1]:
2012-01-26T08:29:11+00:00 app[web.1]:
2012-01-26T08:29:11+00:00 app[web.1]: Started PUT "/mobile_users/1" for 85.26.234.218 at 2012-01-26 08:29:11 +0000
2012-01-26T08:29:11+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=101ms status=401 bytes=27
2012-01-26T08:29:11+00:00 app[web.1]: Oink Action: mobile_users#update
2012-01-26T08:29:11+00:00 app[web.1]: Memory usage: 382404 | PID: 13
2012-01-26T08:29:11+00:00 app[web.1]: Instantiation Breakdown: Total: 0
2012-01-26T08:29:11+00:00 app[web.1]: Oink Log Entry Complete
2012-01-26T08:29:11+00:00 app[web.1]: cache: [PUT /mobile_users/1] invalidate, pass
2012-01-26T08:29:12+00:00 app[web.1]:
2012-01-26T08:29:12+00:00 app[web.1]:
2012-01-26T08:29:12+00:00 app[web.1]: Started PUT "/mobile_users/1" for 85.26.234.218 at 2012-01-26 08:29:12 +0000
2012-01-26T08:29:12+00:00 heroku[web.1]: Process running mem=537M(105.0%)
2012-01-26T08:29:12+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:29:12+00:00 app[web.1]: Oink Action: mobile_users#update
2012-01-26T08:29:12+00:00 app[web.1]: Memory usage: 288876 | PID: 19
2012-01-26T08:29:12+00:00 app[web.1]: Instantiation Breakdown: Total: 2 | MobileUser: 2
2012-01-26T08:29:12+00:00 app[web.1]: Oink Log Entry Complete
2012-01-26T08:29:12+00:00 app[web.1]: cache: [PUT /mobile_users/1] invalidate, pass
2012-01-26T08:29:12+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=169ms status=200 bytes=1
2012-01-26T08:29:33+00:00 heroku[web.1]: Process running mem=537M(105.0%)
2012-01-26T08:29:33+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
I have no idea what that proves other than it seems I am not using as much memory as Heroku thinks I am Memory usage: 288876 vs Process running mem=537M(105.0%)
我不知道这证明了什么,除了似乎我使用的内存没有 Heroku 认为的那么多内存使用:288876 vs Process running mem=537M(105.0%)
采纳答案by stupied4ever
I had this problem .. to solved using find_in_batches.
我有这个问题.. 使用 find_in_batches 解决。
If someone still has this error i will put the code here. As it takes long time to run, i found a progress_bar gem that help the user. will let it here too cause i think its mandatory in almost every case.
如果有人仍然有这个错误,我会把代码放在这里。由于运行需要很长时间,我找到了一个可以帮助用户的 progress_bar gem。也会让它在这里,因为我认为它几乎在所有情况下都是强制性的。
bar = ProgressBar.new( total )
Texto.find_in_batches(:batch_size => 100) do |textos|
textos.each{| texto |
...do_stuff...
}
bar.increment! textos.size
end
Progress Bar: https://github.com/paul/progress_bar/issues
回答by tomb
Look for code with 'Model.all.each do |something|'and replace with Model.find_each do |something|. This will save memory by loading chunks of your model into memory instead of the entire model all at once.
查找代码'Model.all.each do |something|'并替换为Model.find_each do |something|。这将通过将模型的块而不是整个模型一次性加载到内存中来节省内存。
Also, look for opportunities to use in_groups_ofor :limitto decrease the number of objects that are saved in memory at one time.
此外,寻找机会使用in_groups_of或:limit减少一次保存在内存中的对象数量。
EDIT: for_each -> find_each.
编辑:for_each -> find_each。
回答by rkb
Heroku specifies a RAM limit per dyno in its Acceptable Use Policy.
Heroku 在其Acceptable Use Policy 中指定了每个 dyno 的 RAM 限制。
You could use memprof, specifically Memprof::Middleware, to help find out what's allocating all the memory in your app during requests. This is really only suitable for use in a non-production environment, since it'll slow down your app.
你可以使用memprof,特别是Memprof::Middleware,以帮助找出请求期间发生了什么分配所有的记忆在你的应用程序。这实际上只适合在非生产环境中使用,因为它会减慢您的应用程序的速度。
It's common for a Rails app to be allocating many ActiveRecord objects, so you might look for places where you're doing Model.find(:all).select{...}, or similar queries that pull a lot of records from the DB and then process them in Ruby. Better would be to use whereto limit what is returned to the Rails app using SQL.
Rails 应用程序通常会分配许多 ActiveRecord 对象,因此您可能会寻找正在执行的位置Model.find(:all).select{...},或从数据库中提取大量记录然后在 Ruby 中处理它们的类似查询。最好where使用 SQL 来限制返回到 Rails 应用程序的内容。
回答by hellion
Also, the WEB_CONCURRENCY heroku config can cause this. For example, I have an app running 2 1x dynos. If I use sensible_defaults (another heroku config), it defaults WEB_CONCURRENCY to 2 (based on my dynos). This causes a ton of R14 errors in my logs. If I turn off sensible_defaults, and set WEB_CONCURRENCY=1...the problem goes away.
此外,WEB_CONCURRENCY heroku 配置也可能导致这种情况。例如,我有一个运行 2 1x dynos 的应用程序。如果我使用 sensible_defaults(另一个 heroku 配置),它默认 WEB_CONCURRENCY 为 2(基于我的 dynos)。这会导致我的日志中出现大量 R14 错误。如果我关闭 sensible_defaults,并设置 WEB_CONCURRENCY=1...问题就会消失。
If you don't set WEB_CONCURRENCY, and you don't use sensible_defaults, and you followed the server (Im using Puma) set up via heroku docs...you'll likely have a line in puma.rb that looks like this:
如果您不设置 WEB_CONCURRENCY,并且不使用 sensible_defaults,并且您遵循通过 heroku 文档设置的服务器(我使用 Puma)...您可能会在 puma.rb 中有一行如下所示:
workers Integer(ENV['WEB_CONCURRENCY'] || 3)
If thats the case, then WEB_CONCURRENCY isn't set...so it will be 3, which is using even more memory.
如果是这样,则 WEB_CONCURRENCY 未设置...因此它将是 3,这将使用更多内存。
In console:
在控制台中:
// review existing config settings.
// 查看现有的配置设置。
heroku config
Heroku 配置
// IF sensible_defaults is enabled.
// 如果启用了 sensible_defaults。
heroku config:set sensible_defaults=disabled
heroku 配置:设置 sensible_defaults=disabled
// set WEB_CONCURRENCY
// 设置 WEB_CONCURRENCY
heroku config:set WEB_CONCURRENCY=1
heroku 配置:设置 WEB_CONCURRENCY=1
// monitor logs for R14 errors.
// 监视 R14 错误的日志。
回答by Brian Armstrong
I was using Mongoid and in my case it was from the 'identity map' being enabled in a non-web request process (so the identity map was never getting cleared and kept growing). Setting Mongoid.identity_map_enabled = falsein that process solved the problem.
我正在使用 Mongoid,在我的情况下,它来自在非 Web 请求过程中启用的“身份地图”(因此身份地图从未被清除并不断增长)。Mongoid.identity_map_enabled = false在那个过程中设置解决了这个问题。
回答by GM-Jorgensen
I had the same issue and upgraded to their 2x dynos as a stop gap while attempting to debug with the oink gem. The config change to double the dynos did not work after a heroku restartnor did taking them to 0 and back up. Doing a git pushafter adding the oink gem got the upgrade to work, and oink is not showing the same consumption the heroku logs were initially showing.
我遇到了同样的问题,并在尝试使用 oink gem 进行调试时升级到他们的 2x dynos 作为止损。将 dynos 加倍的配置更改在 a 之后不起作用,heroku restart也没有将它们设置为 0 并备份。git push在添加 oink gem 之后做一个升级工作,并且 oink 没有显示与 heroku 日志最初显示的相同的消耗。
回答by slindsey3000
Try this too
也试试这个
heroku ps
I had 2 console processes that had been running for almost 24 hours. I had some HEAVY things I needed to do in the console and who knows what happened. What I did in the console did an insane amount of writes and reads to the DB and went on for over 10 minutes. So this must have mucked something up.
我有 2 个控制台进程已经运行了近 24 小时。我需要在控制台中做一些繁重的事情,谁知道发生了什么。我在控制台中所做的事情对数据库进行了大量的写入和读取,并持续了 10 多分钟。所以这一定是搞砸了。
Runing heroku ps in your terminal will show you all your processes and you might get an "aha".
在您的终端中运行 heroku ps 将向您显示您的所有进程,您可能会得到一个“啊哈”。
Kill the zombie processes with
杀死僵尸进程
heroku ps:stop run.6654
Dont forget the "run." part
不要忘记“跑”。部分
Do heroku ps to verify they are gone and check your logs that the problem is cleared up.
执行 heroku ps 以验证它们已消失并检查您的日志是否已解决问题。
回答by Stefan Huska
For me, replacing RMagick with MiniMagick did the job. Both gems feature same resizing and cropping functions (I'm using carrierwave for image uploads)
对我来说,用 MiniMagick 替换 RMagick 完成了这项工作。两个 gem 都具有相同的调整大小和裁剪功能(我使用carrierwave 上传图片)
Gemfile update
Remove
gem 'rmagick'and add
gem 'mini_magick'Run
bundleUpdate carrierwave uploaders
Replace
include CarrierWave::RMagickwith
include CarrierWave::MiniMagickDeploy to Heroku and that's it!
Gemfile 更新
消除
gem 'rmagick'并添加
gem 'mini_magick'跑
bundle更新载波上传器
代替
include CarrierWave::RMagick和
include CarrierWave::MiniMagick部署到 Heroku,就是这样!
--
——
Finally I have no R14 Errors after each request.
最后,每次请求后我都没有 R14 错误。

