Skip to content

test_mysql using MariaDB raises Mysql2::Error: SAVEPOINT active_record_1 does not exist (ActiveRecord::StatementInvalid) #53727

@yahonda

Description

@yahonda

Managed to reproduce CI failure against MariaDB https://buildkite.com/rails/rails/builds/114040#0193581b-e8af-4324-9429-42f56cea8085

Steps to reproduce

Install MariaDB 11.7.1.

$ mysql -uroot
mysql: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb' instead
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 379
Server version: 11.7.1-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> select version();
+----------------+
| version()      |
+----------------+
| 11.7.1-MariaDB |
+----------------+
1 row in set (0.001 sec)

MariaDB [(none)]>
cd activerecord
ARCONN=mysql2 bin/test test/cases/relations_test.rb -n test_multiple_find_or_create_by_within_transactions

Expected behavior

It should pass.

Actual behavior

$ ARCONN=mysql2 bin/test test/cases/relations_test.rb -n test_multiple_find_or_create_by_within_transactions
Using mysql2
Run options: -n test_multiple_find_or_create_by_within_transactions --seed 36869

# Running:

#<Thread:0x00007f2ee63a7b38 /home/yahonda/src/github.com/rails/rails/activerecord/test/cases/relations_test.rb:2497 run> terminated with exception (report_on_exception is true):
/home/yahonda/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/mysql2-0.5.6/lib/mysql2/client.rb:151:in `_query': Mysql2::Error: SAVEPOINT active_record_1 does not exist (ActiveRecord::StatementInvalid)
	from /home/yahonda/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/mysql2-0.5.6/lib/mysql2/client.rb:151:in `block in query'
	from /home/yahonda/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/mysql2-0.5.6/lib/mysql2/client.rb:150:in `handle_interrupt'
	from /home/yahonda/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/mysql2-0.5.6/lib/mysql2/client.rb:150:in `query'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2/database_statements.rb:67:in `perform_query'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:556:in `block (2 levels) in raw_execute'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:1011:in `block in with_raw_connection'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:983:in `with_raw_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:555:in `block in raw_execute'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:1129:in `log'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:554:in `raw_execute'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:591:in `internal_execute'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/savepoints.rb:16:in `exec_rollback_to_savepoint'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:465:in `rollback_to_savepoint'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:27:in `rollback_to_savepoint'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:433:in `rollback'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:614:in `block in rollback_transaction'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:611:in `rollback_transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:628:in `rescue in block in within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:627:in `block in within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:623:in `within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:367:in `within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:359:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:234:in `block in transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:406:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_handling.rb:310:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:233:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation/delegation.rb:106:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:275:in `block in create_or_find_by'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:406:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_handling.rb:310:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation/delegation.rb:106:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:274:in `create_or_find_by'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:232:in `find_or_create_by'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/querying.rb:24:in `find_or_create_by'
	from /home/yahonda/src/github.com/rails/rails/activerecord/test/cases/relations_test.rb:2475:in `block in test_multiple_find_or_create_by_within_transactions'
	from /home/yahonda/src/github.com/rails/rails/activerecord/test/cases/relations_test.rb:2504:in `block (2 levels) in duel'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:626:in `block in within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:623:in `within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:367:in `within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:359:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:234:in `block in transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:412:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_handling.rb:310:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:233:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/test/cases/relations_test.rb:2498:in `block in duel'
/home/yahonda/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/mysql2-0.5.6/lib/mysql2/client.rb:151:in `_query': SAVEPOINT active_record_1 does not exist (Mysql2::Error)
	from /home/yahonda/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/mysql2-0.5.6/lib/mysql2/client.rb:151:in `block in query'
	from /home/yahonda/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/mysql2-0.5.6/lib/mysql2/client.rb:150:in `handle_interrupt'
	from /home/yahonda/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/mysql2-0.5.6/lib/mysql2/client.rb:150:in `query'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2/database_statements.rb:67:in `perform_query'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:556:in `block (2 levels) in raw_execute'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:1011:in `block in with_raw_connection'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:983:in `with_raw_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:555:in `block in raw_execute'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:1129:in `log'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:554:in `raw_execute'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:591:in `internal_execute'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/savepoints.rb:16:in `exec_rollback_to_savepoint'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:465:in `rollback_to_savepoint'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:27:in `rollback_to_savepoint'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:433:in `rollback'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:614:in `block in rollback_transaction'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:611:in `rollback_transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:628:in `rescue in block in within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:627:in `block in within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:623:in `within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:367:in `within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:359:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:234:in `block in transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:406:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_handling.rb:310:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:233:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation/delegation.rb:106:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:275:in `block in create_or_find_by'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:406:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_handling.rb:310:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation/delegation.rb:106:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:274:in `create_or_find_by'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:232:in `find_or_create_by'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/querying.rb:24:in `find_or_create_by'
	from /home/yahonda/src/github.com/rails/rails/activerecord/test/cases/relations_test.rb:2475:in `block in test_multiple_find_or_create_by_within_transactions'
	from /home/yahonda/src/github.com/rails/rails/activerecord/test/cases/relations_test.rb:2504:in `block (2 levels) in duel'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:626:in `block in within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:623:in `within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:367:in `within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:359:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:234:in `block in transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:412:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_handling.rb:310:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:233:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/test/cases/relations_test.rb:2498:in `block in duel'
/home/yahonda/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/mysql2-0.5.6/lib/mysql2/client.rb:151:in `_query': Mysql2::Error: Record has changed since last read in table 'subscribers' (ActiveRecord::StatementInvalid)
	from /home/yahonda/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/mysql2-0.5.6/lib/mysql2/client.rb:151:in `block in query'
	from /home/yahonda/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/mysql2-0.5.6/lib/mysql2/client.rb:150:in `handle_interrupt'
	from /home/yahonda/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/mysql2-0.5.6/lib/mysql2/client.rb:150:in `query'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2/database_statements.rb:67:in `perform_query'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:556:in `block (2 levels) in raw_execute'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:1011:in `block in with_raw_connection'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:983:in `with_raw_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:555:in `block in raw_execute'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:1129:in `log'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:554:in `raw_execute'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:591:in `internal_execute'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:547:in `internal_exec_query'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:159:in `exec_insert'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:197:in `insert'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:27:in `insert'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/persistence.rb:257:in `_insert_record'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/persistence.rb:927:in `block in _create_record'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:406:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_handling.rb:310:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/persistence.rb:924:in `_create_record'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/counter_cache.rb:226:in `_create_record'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/locking/optimistic.rb:84:in `_create_record'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/encryption/encryptable_record.rb:184:in `_create_record'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/attribute_methods/dirty.rb:240:in `_create_record'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/callbacks.rb:445:in `block in _create_record'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/callbacks.rb:109:in `run_callbacks'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/callbacks.rb:912:in `_run_create_callbacks'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/callbacks.rb:445:in `_create_record'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/timestamp.rb:116:in `_create_record'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/persistence.rb:895:in `create_or_update'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/callbacks.rb:441:in `block in create_or_update'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/callbacks.rb:120:in `block in run_callbacks'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/autosave_association.rb:396:in `around_save_collection_association'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/callbacks.rb:129:in `block in run_callbacks'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/callbacks.rb:140:in `run_callbacks'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/callbacks.rb:912:in `_run_save_callbacks'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/callbacks.rb:441:in `create_or_update'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/timestamp.rb:127:in `create_or_update'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/persistence.rb:391:in `save'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/validations.rb:48:in `save'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:362:in `block in save'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:418:in `block (2 levels) in with_transaction_returning_status'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:357:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:414:in `block in with_transaction_returning_status'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:406:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_handling.rb:310:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:410:in `with_transaction_returning_status'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:362:in `save'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/suppressor.rb:52:in `save'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/persistence.rb:38:in `create'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:1358:in `_create'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:159:in `block in create'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:1373:in `_scoping'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:548:in `scoping'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:159:in `create'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:275:in `block (2 levels) in create_or_find_by'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:626:in `block in within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:623:in `within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:367:in `within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:359:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:234:in `block in transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:406:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_handling.rb:310:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:233:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation/delegation.rb:106:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:275:in `block in create_or_find_by'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:406:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_handling.rb:310:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation/delegation.rb:106:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:274:in `create_or_find_by'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:232:in `find_or_create_by'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/querying.rb:24:in `find_or_create_by'
	from /home/yahonda/src/github.com/rails/rails/activerecord/test/cases/relations_test.rb:2475:in `block in test_multiple_find_or_create_by_within_transactions'
	from /home/yahonda/src/github.com/rails/rails/activerecord/test/cases/relations_test.rb:2504:in `block (2 levels) in duel'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:626:in `block in within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:623:in `within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:367:in `within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:359:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:234:in `block in transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:412:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_handling.rb:310:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:233:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/test/cases/relations_test.rb:2498:in `block in duel'
/home/yahonda/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/mysql2-0.5.6/lib/mysql2/client.rb:151:in `_query': Record has changed since last read in table 'subscribers' (Mysql2::Error)
	from /home/yahonda/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/mysql2-0.5.6/lib/mysql2/client.rb:151:in `block in query'
	from /home/yahonda/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/mysql2-0.5.6/lib/mysql2/client.rb:150:in `handle_interrupt'
	from /home/yahonda/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/mysql2-0.5.6/lib/mysql2/client.rb:150:in `query'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/mysql2/database_statements.rb:67:in `perform_query'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:556:in `block (2 levels) in raw_execute'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:1011:in `block in with_raw_connection'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:983:in `with_raw_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:555:in `block in raw_execute'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:1129:in `log'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:554:in `raw_execute'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:591:in `internal_execute'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:547:in `internal_exec_query'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:159:in `exec_insert'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:197:in `insert'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:27:in `insert'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/persistence.rb:257:in `_insert_record'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/persistence.rb:927:in `block in _create_record'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:406:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_handling.rb:310:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/persistence.rb:924:in `_create_record'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/counter_cache.rb:226:in `_create_record'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/locking/optimistic.rb:84:in `_create_record'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/encryption/encryptable_record.rb:184:in `_create_record'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/attribute_methods/dirty.rb:240:in `_create_record'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/callbacks.rb:445:in `block in _create_record'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/callbacks.rb:109:in `run_callbacks'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/callbacks.rb:912:in `_run_create_callbacks'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/callbacks.rb:445:in `_create_record'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/timestamp.rb:116:in `_create_record'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/persistence.rb:895:in `create_or_update'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/callbacks.rb:441:in `block in create_or_update'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/callbacks.rb:120:in `block in run_callbacks'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/autosave_association.rb:396:in `around_save_collection_association'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/callbacks.rb:129:in `block in run_callbacks'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/callbacks.rb:140:in `run_callbacks'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/callbacks.rb:912:in `_run_save_callbacks'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/callbacks.rb:441:in `create_or_update'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/timestamp.rb:127:in `create_or_update'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/persistence.rb:391:in `save'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/validations.rb:48:in `save'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:362:in `block in save'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:418:in `block (2 levels) in with_transaction_returning_status'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:357:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:414:in `block in with_transaction_returning_status'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:406:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_handling.rb:310:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:410:in `with_transaction_returning_status'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:362:in `save'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/suppressor.rb:52:in `save'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/persistence.rb:38:in `create'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:1358:in `_create'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:159:in `block in create'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:1373:in `_scoping'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:548:in `scoping'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:159:in `create'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:275:in `block (2 levels) in create_or_find_by'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:626:in `block in within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:623:in `within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:367:in `within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:359:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:234:in `block in transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:406:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_handling.rb:310:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:233:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation/delegation.rb:106:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:275:in `block in create_or_find_by'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:406:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_handling.rb:310:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation/delegation.rb:106:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:274:in `create_or_find_by'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/relation.rb:232:in `find_or_create_by'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/querying.rb:24:in `find_or_create_by'
	from /home/yahonda/src/github.com/rails/rails/activerecord/test/cases/relations_test.rb:2475:in `block in test_multiple_find_or_create_by_within_transactions'
	from /home/yahonda/src/github.com/rails/rails/activerecord/test/cases/relations_test.rb:2504:in `block (2 levels) in duel'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:626:in `block in within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb:623:in `within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:367:in `within_new_transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:359:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:234:in `block in transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:412:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/connection_handling.rb:310:in `with_connection'
	from /home/yahonda/src/github.com/rails/rails/activerecord/lib/active_record/transactions.rb:233:in `transaction'
	from /home/yahonda/src/github.com/rails/rails/activerecord/test/cases/relations_test.rb:2498:in `block in duel'
E

Error:
CreateOrFindByWithinTransactions#test_multiple_find_or_create_by_within_transactions:
ActiveRecord::StatementInvalid: Mysql2::Error: SAVEPOINT active_record_1 does not exist
    /home/yahonda/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/mysql2-0.5.6/lib/mysql2/client.rb:151:in `_query'
    /home/yahonda/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/mysql2-0.5.6/lib/mysql2/client.rb:151:in `block in query'
    /home/yahonda/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/mysql2-0.5.6/lib/mysql2/client.rb:150:in `handle_interrupt'
    /home/yahonda/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/mysql2-0.5.6/lib/mysql2/client.rb:150:in `query'
    lib/active_record/connection_adapters/mysql2/database_statements.rb:67:in `perform_query'
    lib/active_record/connection_adapters/abstract/database_statements.rb:556:in `block (2 levels) in raw_execute'
    lib/active_record/connection_adapters/abstract_adapter.rb:1011:in `block in with_raw_connection'
    /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
    lib/active_record/connection_adapters/abstract_adapter.rb:983:in `with_raw_connection'
    lib/active_record/connection_adapters/abstract/database_statements.rb:555:in `block in raw_execute'
    /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
    lib/active_record/connection_adapters/abstract_adapter.rb:1129:in `log'
    lib/active_record/connection_adapters/abstract/database_statements.rb:554:in `raw_execute'
    lib/active_record/connection_adapters/abstract/database_statements.rb:591:in `internal_execute'
    lib/active_record/connection_adapters/abstract/savepoints.rb:16:in `exec_rollback_to_savepoint'
    lib/active_record/connection_adapters/abstract/database_statements.rb:465:in `rollback_to_savepoint'
    lib/active_record/connection_adapters/abstract/query_cache.rb:27:in `rollback_to_savepoint'
    lib/active_record/connection_adapters/abstract/transaction.rb:433:in `rollback'
    lib/active_record/connection_adapters/abstract/transaction.rb:614:in `block in rollback_transaction'
    /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
    lib/active_record/connection_adapters/abstract/transaction.rb:611:in `rollback_transaction'
    lib/active_record/connection_adapters/abstract/transaction.rb:628:in `rescue in block in within_new_transaction'
    lib/active_record/connection_adapters/abstract/transaction.rb:627:in `block in within_new_transaction'
    /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
    lib/active_record/connection_adapters/abstract/transaction.rb:623:in `within_new_transaction'
    lib/active_record/connection_adapters/abstract/database_statements.rb:367:in `within_new_transaction'
    lib/active_record/connection_adapters/abstract/database_statements.rb:359:in `transaction'
    lib/active_record/transactions.rb:234:in `block in transaction'
    lib/active_record/connection_adapters/abstract/connection_pool.rb:406:in `with_connection'
    lib/active_record/connection_handling.rb:310:in `with_connection'
    lib/active_record/transactions.rb:233:in `transaction'
    lib/active_record/relation/delegation.rb:106:in `transaction'
    lib/active_record/relation.rb:275:in `block in create_or_find_by'
    lib/active_record/connection_adapters/abstract/connection_pool.rb:406:in `with_connection'
    lib/active_record/connection_handling.rb:310:in `with_connection'
    lib/active_record/relation/delegation.rb:106:in `with_connection'
    lib/active_record/relation.rb:274:in `create_or_find_by'
    lib/active_record/relation.rb:232:in `find_or_create_by'
    lib/active_record/querying.rb:24:in `find_or_create_by'
    test/cases/relations_test.rb:2475:in `block in test_multiple_find_or_create_by_within_transactions'
    test/cases/relations_test.rb:2504:in `block (2 levels) in duel'
    lib/active_record/connection_adapters/abstract/transaction.rb:626:in `block in within_new_transaction'
    /home/yahonda/src/github.com/rails/rails/activesupport/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
    lib/active_record/connection_adapters/abstract/transaction.rb:623:in `within_new_transaction'
    lib/active_record/connection_adapters/abstract/database_statements.rb:367:in `within_new_transaction'
    lib/active_record/connection_adapters/abstract/database_statements.rb:359:in `transaction'
    lib/active_record/transactions.rb:234:in `block in transaction'
    lib/active_record/connection_adapters/abstract/connection_pool.rb:412:in `with_connection'
    lib/active_record/connection_handling.rb:310:in `with_connection'
    lib/active_record/transactions.rb:233:in `transaction'
    test/cases/relations_test.rb:2498:in `block in duel'


bin/test test/cases/relations_test.rb:2474



Finished in 0.027770s, 36.0104 runs/s, 36.0104 assertions/s.
1 runs, 1 assertions, 0 failures, 1 errors, 0 skips
$

System configuration

Rails version: main branch

Ruby version: ruby 3.3.6 (2024-11-05 revision 75015d4c1f) [x86_64-linux]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions