在rails3/jruby中,什么可能会间歇性地导致此错误? SAVEPOINT active_record_1 不存在

发布于 2024-12-20 06:36:30 字数 1815 浏览 2 评论 0原文

当单个人测试系统时,不会发生这些错误。但通过 jmeter 测试,我可以非常可靠地重现一些错误:

ActiveRecord::JDBCError: SAVEPOINT active_record_1 does not exist: ROLLBACK TO SAVEPOINT active_record_1

Stack:

    gems/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract_adapter.rb:207:in `log'
    gems/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract_adapter.rb:200:in `log'
    gems/gems/activerecord-jdbc-adapter-1.2.1/lib/arjdbc/jdbc/adapter.rb:208:in `execute'
    gems/gems/activerecord-jdbc-adapter-1.2.1/lib/arjdbc/mysql/adapter.rb:156:in `rollback_to_savepoint'
    gems/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/database_statements.rb:179:in `transaction'
    gems/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/database_statements.rb:171:in `transaction'
    gems/gems/activerecord-3.0.10/lib/active_record/transactions.rb:207:in `transaction'
    gems/gems/activerecord-3.0.10/lib/active_record/transactions.rb:290:in `with_transaction_returning_status'
    gems/gems/activerecord-3.0.10/lib/active_record/transactions.rb:240:in `save'
    gems/gems/activerecord-3.0.10/lib/active_record/transactions.rb:251:in `rollback_active_record_state!'
    gems/gems/activerecord-3.0.10/lib/active_record/transactions.rb:239:in `save'
    ...(our code that simply calls save on a new instance of a model class)...

我们没有嵌套事务,甚至没有显式使用它们。我发现此错误消息周围存在一个错误,但它不相关;我们不会截断或执行任何 DDL 工作。只需创建记录并保存即可。

我们使用 Rails 3.0.10、JRuby 1.6.5、activerecord-jdbcmysql-adapter、Warbler 1.3.2,并通过 Elastic Beanstalk 部署在 64 位 Tomcat 7/Amazon RDS 上,并使用单个 Mysql 实例 v5.1.57。我们已准备好 config.threadsafe! - 这感觉就像是 ActiveRecord 内部的某种竞赛 - 但 ActiveRecord 应该在线程安全中工作,不是吗?

最后一点:我担心这是一个 JRuby 或 Warbler 问题,因为如果我们从 JRuby 切换到 MRI Ruby 1.9,我们就无法重现这个问题。

These errors do not occur when a single individual tests the system. But with a jmeter test, I can pretty reliably reproduce a few errors along the lines of:

ActiveRecord::JDBCError: SAVEPOINT active_record_1 does not exist: ROLLBACK TO SAVEPOINT active_record_1

Stack:

    gems/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract_adapter.rb:207:in `log'
    gems/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract_adapter.rb:200:in `log'
    gems/gems/activerecord-jdbc-adapter-1.2.1/lib/arjdbc/jdbc/adapter.rb:208:in `execute'
    gems/gems/activerecord-jdbc-adapter-1.2.1/lib/arjdbc/mysql/adapter.rb:156:in `rollback_to_savepoint'
    gems/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/database_statements.rb:179:in `transaction'
    gems/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/database_statements.rb:171:in `transaction'
    gems/gems/activerecord-3.0.10/lib/active_record/transactions.rb:207:in `transaction'
    gems/gems/activerecord-3.0.10/lib/active_record/transactions.rb:290:in `with_transaction_returning_status'
    gems/gems/activerecord-3.0.10/lib/active_record/transactions.rb:240:in `save'
    gems/gems/activerecord-3.0.10/lib/active_record/transactions.rb:251:in `rollback_active_record_state!'
    gems/gems/activerecord-3.0.10/lib/active_record/transactions.rb:239:in `save'
    ...(our code that simply calls save on a new instance of a model class)...

We are not nesting transactions or even using them explicitly. I find one existing bug around this error message, but it is not relevant; we are not truncating or doing any DDL work. Merely creating a record and saving it.

We use Rails 3.0.10, JRuby 1.6.5, activerecord-jdbcmysql-adapter, warbled with Warbler 1.3.2 and deployed via Elastic Beanstalk on 64-bit Tomcat 7/Amazon RDS with a single Mysql instance, v5.1.57. We are set for config.threadsafe! - and this feels like a race of some kind in the bowels of ActiveRecord - but ActiveRecord is supposed to work in threadsafe, no?

One final note: I fear this is a JRuby or Warbler problem, because we cannot reproduce this problem if we switch from JRuby to MRI Ruby 1.9.

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

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

发布评论

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

评论(1

旧夏天 2024-12-27 06:36:30

它可能与 1.2.1 中引入的此提交有关。 1.2.0 是否给您带来同样的问题?

也许我需要对支持的事务和失败的事务重新引入一些错误检查。请注意在 https://github.com/jruby/activerecord-jdbc-adapter 提交错误/问题?谢谢。

It could be related to this commit, which was introduced in 1.2.1. Does 1.2.0 give you the same issue?

Maybe I need to reintroduce some error checking for transactions supported vs. failed transaction. Care to file a bug at https://github.com/jruby/activerecord-jdbc-adapter/issues? Thanks.

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