ruby-on-rails - heroku 中的 wkhtmltopdf : memory issues

标签 ruby-on-rails ruby heroku wkhtmltopdf

我有一个 Rails 4.2.3/Ruby 2.2.2 应用程序在 Heroku 的免费测功机中运行。

我正在使用 wkhtmltopdf-buildpack但是每次我尝试生成 PDF 文件时,Heroku 日志都会向我显示错误 R14(超出内存配额)。这是一个例子:

2015-07-31T02:06:52.005696+00:00 app[web.1]: Started GET "/orders/1.pdf" for 200.149.16.70 at 2015-07-31 02:06:52 +0000
2015-07-31T02:06:52.162915+00:00 app[web.1]:   Rendered clients/_client.html.erb (85.3ms)
2015-07-31T02:06:52.015043+00:00 app[web.1]: Processing by OrdersController#show as PDF
2015-07-31T02:06:52.015049+00:00 app[web.1]:   Parameters: {"id"=>"1"}
2015-07-31T02:06:52.071357+00:00 app[web.1]: ***************WICKED***************
2015-07-31T02:06:52.309300+00:00 app[web.1]:   Rendered orders/_order_products.html.erb (145.6ms)
2015-07-31T02:06:52.339531+00:00 app[web.1]:   Rendered orders/show.html.erb (267.2ms)
2015-07-31T02:06:52.339015+00:00 app[web.1]:   Rendered orders/_order.html.erb (262.6ms)
2015-07-31T02:07:12.162183+00:00 heroku[web.1]: Process running mem=662M(129.4%)
2015-07-31T02:07:12.162183+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2015-07-31T02:07:22.005012+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/orders/1.pdf" host=app.herokuapp.com request_id=50f6840e-1907-4730-ab0d-1a6f415eb3db fwd="200.*.*.*" dyno=web.1 connect=3ms service=30001ms status=503 bytes=0

我在 wkhtmltopdf-heroku gem 之前尝试过,但我遇到了同样的内存问题。 我不确定如何调试这个问题,但你能帮忙吗?在这种情况下添加测功机是一种选择吗?

最佳答案

已解决:我使用 gem wkhtmltopdf-binary 解决了这个问题。我还尝试了 gem wkhtmltopdf-heroku,但这没有用。

关于ruby-on-rails - heroku 中的 wkhtmltopdf : memory issues,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31737342/

相关文章:

ruby-on-rails - 您带指纹的 key (...) 无权访问 <yourapp>

ruby-on-rails - 在 redis 中使用 ZINCRBY 存储哈希

ruby-on-rails - 使用 rails RPUSH gem 为 APNS 编码 JWT key

ruby - Sinatra session 自动销毁

ruby - float 数字的 floor 函数

docker - 能够将我的 Docker 容器放到 Heroku 上,但我不知道如何访问端点

git - 通过 heroku flask 应用程序更新网站

ruby-on-rails - 没有 InnoDB,Rails 3 不能在 MySQL MyISAM 模式下运行吗?

ruby-on-rails - 使用 find_by_id(comment.user_id).name 检索用户名不起作用

ruby - 可以像添加 java jar 文件一样添加 ruby​​ gem/模块吗?