【问题标题】:R15 Issue on Heroku without exceeding memory limitHeroku 上的 R15 问题而不超过内存限制
【发布时间】:2019-09-16 12:16:02
【问题描述】:

我有一个在 Heroku 的 performance-M 发电机上运行的 Ruby on Rails 网站,自动缩放设置为 5 个发电机。

最近,我们在网站上收到了突然的 R15 和 H12 错误。在此期间,内存使用量显示在发电机允许的内存配额之下。

以下是日志中显示的错误:

2019-09-16T10:12:08.523336+00:00 app[scheduler.2787]: Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/897302823996a945884a1d912c28d59520190916-4-1bn5w9k.jpg[0]' 2>/dev/null
2019-09-16T10:12:16.022212+00:00 heroku[scheduler.2787]: Process running mem=1022M(199.7%)
2019-09-16T10:12:16.022295+00:00 heroku[scheduler.2787]: Error R14 (Memory quota exceeded)
2019-09-16T10:12:16.365725+00:00 heroku[router]: at=info method=GET path="/favicon-16x16.png" host=www.site.com request_id=8755a947-ace9-471d-a192-a236785505b4 fwd="45.195.5.37" dyno=web.1 connect=1ms service=2ms status=200 bytes=928 protocol=https
2019-09-16T10:12:19.103405+00:00 heroku[scheduler.2787]: Process running mem=1279M(250.0%)
2019-09-16T10:12:19.103405+00:00 heroku[scheduler.2787]: Error R15 (Memory quota vastly exceeded)
2019-09-16T10:12:19.103405+00:00 heroku[scheduler.2787]: Stopping process with SIGKILL
2019-09-16T10:12:19.427029+00:00 heroku[scheduler.2787]: State changed from up to complete
2019-09-16T10:12:19.388039+00:00 heroku[scheduler.2787]: Process exited with status 137
2019-09-16T10:13:07.886016+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/favicon.ico" host=www.site.com request_id=c7cea0a2-7345-44c6-926e-3ad5a0eb2066 fwd="45.195.5.37" dyno=web.2 connect=1ms service=30000ms status=503 bytes=0 protocol=https

如您所见,就在 R15 错误之前,回形针正在尝试压缩图像。

以下屏幕截图中图表的开头显示了受影响期间 Heroku Metrics 的状态: Heroku Metrics Part 1 Heroku Metrics Part 2

谁能帮我弄清楚 R15 错误是如何发生的,它与内存泄漏有关,而指标显示内存在限制范围内很好?有关如何阻止这种情况重复发生的任何帮助都会有所帮助。

谢谢。

【问题讨论】:

    标签: ruby-on-rails heroku imagemagick paperclip


    【解决方案1】:

    您的 R15 错误发生在由 Heroku Scheduler 创建的 one-off dyno 上,与您的网络测功机完全分开。您的请求超时似乎与您计划任务中的内存问题无关。

    计划任务似乎在 1X 测功机 (mem=1022M(199.7%)) 上运行。要更改此设置,请启动 Heroku Scheduler 插件并更改 dyno 类型。

    对于您的请求超时,请查看 Scout 或 New Relic 以查找有问题的端点以及堆栈中的哪个位置需要这么长时间。

    【讨论】:

      猜你喜欢
      • 2022-11-01
      • 1970-01-01
      • 2012-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-25
      • 2023-03-28
      相关资源
      最近更新 更多