ruby - 堆栈级别太深。功能
问题描述
我有以下方法在标题中抛出错误。我知道如果方法是递归的,如果它调用它,就会发生这种情况。但是我的方法并没有被自己调用。有谁知道我为什么会收到这个错误?
def self.send_my_message
sqs = Aws::SQS::Client.new(region: 'us-east-2')
queue_name = "something"
queue_url = sqs.get_queue_url(queue_name: queue_name).queue_url
sqs.send_message(queue_url: queue_url, message_body: 'Hello world')
end
完整堆栈跟踪错误:
Response:
{
"errorMessage": "stack level too deep",
"errorType": "Function<SystemStackError>",
"stackTrace": [
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `initialize_dup'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `dup'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:134:in `as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `block in as_json'",
"/opt/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb:152:in `map'"
]
}
解决方案
推荐阅读
- xml - Robotframework 中的 Testcase 执行生成的 output.xml 文件出错
- qt - 为什么带有后端 uia 的 pywinauto 无法识别某些 qt 元素?
- javascript - VueJS 在自定义组件日期时间选择器上使用 v-model
- c# - PayU POST 通知签名验证
- javascript - Is there any way to style list type in ordered list?
- css - Rails 5:复选框标签显示两次
- c# - 扫描后在 UI 中加载第一页
- java - Ignore enum case with JSON-B / Yasson
- c# - ASP.NET REST 服务路由
- docker - jenkins kubernetes 插件执行问题