无法从回溯 RSPEC 与 Rails 3.0.10 中找到匹配行

发布于 2024-11-30 20:33:50 字数 323 浏览 0 评论 0原文

由于sql注入漏洞,我已经更新到3.0.10。更新后,我运行了测试,所有测试都开始抛出上述错误以及以下几行。

Failure/Error: Unable to find matching line from backtrace
SystemStackError:
  stack level too deep
# /home/part/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/database_statements.rb:153

I've updated to 3.0.10 because of the sql injection vulnerability. After I updated, I ran the tests and all of them started throwing the above error along with the following lines.

Failure/Error: Unable to find matching line from backtrace
SystemStackError:
  stack level too deep
# /home/part/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/database_statements.rb:153

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北渚 2024-12-07 20:33:50

当我的项目从 Rails 2.3.8 升级到 3.2.2 时,我在运行 Cucumber 功能时遇到了类似的错误。我几乎不可能知道您可以找到此错误的堆栈跟踪。

就我而言,真正的问题是双重包含一个名为“rest-client”的库,一次作为插件,一次作为 gem。它位于我的 Gemfile 以及我的供应商/插件目录中。也许您可以快速检查一下您的项目是否存在类似的情况。

我通过在代码的几个地方使用“raise”的繁琐过程发现了这一点。在导致此错误的 rspec 语句的执行路径中,将 raise 方法调用放在不同的位置,例如

raise StandardError, 'code did reach here'

,使用一些二分搜索逻辑,将使您接近罪魁祸首代码。到达那里后,使用以下构造来获取堆栈跟踪。

begin
  # culprit code is here
rescue Exception => e
  puts e.message
  puts e.backtrace.inspect
end

这至少对我有用,希望对你有帮助。

I had experienced a similar error while running Cucumber features when upgrading my project from Rails 2.3.8 to 3.2.2. There's almost no way that I know you can find out the stack trace of this error.

The real problem, in my case, was double inclusion of a library, called rest-client, once as a plugin, and once as a gem. It was in my Gemfile, as well as in my vendor/plugins directory. Maybe you can make a quick check if there's anything like that with your project.

I found this out by a tedious process of using 'raise' at several places of my code. In your execution path of the rspec statement that causes this error, put raise method calls at different places, e.g.

raise StandardError, 'code did reach here'

That, with some binary search logic, will get you close to the culprit code. Once you're there, use the following construct to get a stack trace.

begin
  # culprit code is here
rescue Exception => e
  puts e.message
  puts e.backtrace.inspect
end

That worked for me at least, hope it helps you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文