5

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.

Tadeck
  • 132,510
  • 28
  • 152
  • 198
David W
  • 324
  • 1
  • 13
  • This sounds stupid, but I had this error happen to me when I ran out of disk space. test.log showed `SAVEPOINT active_record_1`, `INSERT INTO ...` => `SQLite3::FullException: database or disk is full`, `ROLLBACK TO SAVEPOINT active_record_1` => `SQLite3::SQLException: no such savepoint`. (The reason was stale Selenium data accumulating in /tmp.) – Jo Liss Dec 10 '11 at 18:26

1 Answers1

1

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.

Nick Sieger
  • 3,315
  • 20
  • 14
  • For the record: https://github.com/jruby/activerecord-jdbc-adapter/issues/145 - and thanks! – David W Dec 19 '11 at 18:36
  • 1
    Unfortunately, though it took an inexplicably long time, I have reproduced this even with the 1.2.0 activerecord-jdbc-adapter. I will update the bug. I am not surprised to have ultimately gotten this result - I was unclear on how the change in exception handling could have resulted in savepoints being created. – David W Jan 10 '12 at 22:56