调试卡住的渲染
如果你的渲染卡住了,请按以下步骤进行:
🌐 If your render is stuck, proceed as follows:
检查长 delayRender() 调用
🌐 Check for long delayRender() calls
如果 delayRender() 超时时间过长且未解决,渲染可能会无限期卡住而没有错误信息。
🌐 If the delayRender() timeout is too big and does not resolve, a render may get stuck indefinitely without an error message.
在 Remotion Lambda 上,这个问题可能更让人困惑,因为它的运行时也有超时。如果 delayRender() 的超时比 Lambda 函数的超时时间更长,Lambda 函数会先超时,而不是 delayRender() 调用先失败,从而不会有错误信息。
🌐 This issue may be more confusing on Remotion Lambda, whose runtime also has a timeout.
If the delayRender() timeout is bigger than the Lambda function timeout, the Lambda function will first time out without the delayRender() call failing first, leading to no error message.
调试该问题:
🌐 To debug the issue:
- 将
delayRender()超时时间设置为较小的值,这样如果它没有解决问题,就会显示错误消息。 - 始终使用
cancelRender()来处理任何阻止你调用continueRender()的错误。
启用详细日志记录
🌐 Enable verbose logging
启用详细日志记录 查看是否有来自浏览器或其他子进程的任何故障。
确保使用 Chrome 无头模式
🌐 Ensure Chrome Headless Shell is used
更新的 Chrome 版本可能不再与 Remotion 兼容,并可能导致渲染卡住,因为它们已经移除了无头模式。 相反,你需要迁移到 Chrome 无头 Shell。
🌐 Newer Chrome versions may not work with Remotion anymore and cause a render to get stuck, because they have removed the Headless mode.
Instead, you need to migrate to the Chrome Headless Shell.
这个问题在 Remotion Lambda 上不会发生。
遵循以下最佳做法:
🌐 Follow these best practices:
- 不要从 Linux 包管理器下载 Chrome。
- 不要设置
--chrome-executable选项,让 Remotion 为你下载兼容的 Chrome Headless Shell 版本。 - 在第一次渲染之前,使用
npx remotion browser ensure来确保已准备好兼容版本的 Chrome 无头浏览器。
Lambda:你在读取 errors 字段吗?
🌐 Lambda: Are you reading the errors field?
如果 overallProgress 字段卡在 Lambda,请确保你正在:
🌐 If the overallProgress field is stuck on Lambda, ensure that you are:
- 读取
errors字段以查看是否有任何错误。 - 如果
fatalErrorEncountered字段为true,则不进一步轮询getRenderProgress()。