• /
  • ログイン
  • 無料アカウント

SystemStackError: stack level too deep

Problem

You receive the error message SystemStackError: stack level too deep on the Error details page in your APM UI.

In addition, because of a bug in Ruby versions 2.1 and lower, you might receive only a one-line stack trace that points to the Ruby agent as the issue.

Solution

In most cases, the Ruby agent is not the underlying issue. The issue is that alias_method and Module#prepend work together only in particular situations and can cause non-terminating recursions when not used together properly.

  1. Upgrade to Ruby version 2.2 or higher to fix the one-line stack trace bug. Then, review the full stack trace to see if the Ruby agent is the issue.

    ヒント

    If you can't upgrade, refer to the URL included in the SystemStackError message to troubleshoot the issue or disable the Ruby agent to see if the problem disappears.

  2. If the Ruby agent is not the cause of the error, look for evidence of non-terminating recursions including the following:

    • You don't find new_relic near the top of the trace.
    • You see repeating patterns in the trace.
  3. If you see evidence of a recursion, make sure that alias_method and Module#prepend are compatible with each other when used on the same method.

Cause

When your app uses Module#prepend on a method that the Ruby agent later uses an alias_method on, it creates a non-terminating recursion and throws the SystemStackError: stack level too deep error.

If you upgraded to Rails 5, which deprecated alias_method_chain, you might have replaced alias_method with Module#prepend, and that could be the source of your issue.

その他のヘルプ

さらに支援が必要な場合は、これらのサポートと学習リソースを確認してください:

問題を作成するこのページを編集する
Copyright © 2020 New Relic Inc.