mysql2 драгоценный камень падает случайно - PullRequest
0 голосов
/ 11 января 2019

Я в процессе обновления нашего приложения до Rails 5. Я обновил до ruby ​​2.4.5, затем все гемы в нашем гемфайле с Rails 5.2.2. MySQL - 0.5.2. Я запускаю наши тесты и у меня случайно Mysql2 :: Ошибка

 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/connection_adapters/mysql/database_statements.rb:45:in `affected_rows'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/connection_adapters/mysql/database_statements.rb:45:in `block in exec_delete'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:196:in `execute_and_free'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/connection_adapters/mysql/database_statements.rb:45:in `exec_delete'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:168:in `delete'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/query_cache.rb:21:in `delete'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/relation.rb:409:in `delete_all'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/querying.rb:10:in `delete_all'

Другая ошибка Mysql2:

Failure/Error: _query(sql, @query_options.merge(options))

 ActiveRecord::StatementInvalid:
   Mysql2::Error::ConnectionError: MySQL server has gone away: BEGIN
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/mysql2-0.5.2/lib/mysql2/client.rb:131:in `_query'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/mysql2-0.5.2/lib/mysql2/client.rb:131:in `block in query'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/mysql2-0.5.2/lib/mysql2/client.rb:130:in `handle_interrupt'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/mysql2-0.5.2/lib/mysql2/client.rb:130:in `query'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:187:in `block (2 levels) in execute'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activesupport-5.2.2/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activesupport-5.2.2/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activesupport-5.2.2/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:186:in `block in execute'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract_adapter.rb:579:in `block (2 levels) in log'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract_adapter.rb:578:in `block in log'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activesupport-5.2.2/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract_adapter.rb:569:in `log'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:185:in `execute'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/connection_adapters/mysql/database_statements.rb:28:in `execute'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:200:in `begin_db_transaction'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:175:in `initialize'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:201:in `new'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:201:in `block in begin_transaction'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:197:in `begin_transaction'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:267:in `begin_transaction'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/fixtures.rb:975:in `block in setup_fixtures'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/fixtures.rb:974:in `each'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/fixtures.rb:974:in `setup_fixtures'
 # /usr/local/rvm/gems/ruby-2.4.5@clm/gems/activerecord-5.2.2/lib/active_record/fixtures.rb:860:in `before_setup'
 # ------------------
 # --- Caused by: ---
 # Mysql2::Error::ConnectionError:
 #   MySQL server has gone away
 #   /usr/local/rvm/gems/ruby-2.4.5@clm/gems/mysql2-0.5.2/lib/mysql2/client.rb:131:in `_query'

Затем повторно запустив те же тесты, у меня происходит сбой malloc:

ruby(73560,0x70000d9c0000) malloc: *** error for object 0x7f9bdb234000: pointer being freed was not allocated
ruby(73560,0x70000d9c0000) malloc: *** set a breakpoint in malloc_error_break to debug

Затем снова запускаю тесты, иногда у меня возникает ошибка SEG:

/usr/local/rvm/gems/ruby-2.4.5@clm/gems/mysql2-0.5.2/lib/mysql2/client.rb:131: [BUG] Segmentation fault at 0xffffffffffffffe1
ruby 2.4.5p335 (2018-10-18 revision 65137) [x86_64-darwin18]

Но мои тесты никогда не выполняются должным образом и никогда не происходят в одном и том же месте. Те же тесты отлично работают на Ruby 2.2.9, Rails 4.2.8 с mysql2 0.4.10. Уже несколько дней я пытаюсь погуглить проблему безуспешно. Версии не так уж новы, и я не вижу, в чем проблема. Я попытался удалить mysql2, а затем переустановить его. У меня установлен MySQL 5.7 на моем Mac. Я на Mac OS 10.14.2.

Пожалуйста, сообщите.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...