Cross thread violation on rb_gc ()

The code base I'm working on has recently been upgraded from Ruby 1.9.2 to Ruby 1.9.3 and from Rails 3.1 to Rails 3.2.2. Since I use RVM, I just did rvm install 1.9.3 , which I would expect all that was needed.

When i started

 rails s 

I get an error

[BUG] lateral coupling violation on rb_gc()

I found some links related to this problem. There is https://stackoverflow.com/a/3129603/2126321 but it actually does not give an answer. The most promising answer is on the RVM website :

In each case of this, I saw that so far it has always ended that a ruby ​​pearl / library with C extensions has been compiled against a different ruby ​​and / or architecture than the one that is trying to download This. Try removing and reinstalling gems using the C-extensions that the application uses to find this bugger.

This is pretty useful, but my Ruby-fu is not strong enough to know which stones have C extensions and which ones I should try reinstalling. Some of the other links on this topic seem to suggest that json gem is to blame, so I tried to execute the proposed solution.

 gem uninstall json gem install --platform=ruby 

This has not changed anything for me - I still get the same error when trying to start the Rails environment.

How to track this problem?

If this helps, here is the conclusion from the list of gems:

 actionmailer (3.2.2) actionpack (3.2.2) activemodel (3.2.2) activerecord (3.2.2) activeresource (3.2.2) activesupport (3.2.2) addressable (2.2.7) akami (1.0.0) arel (3.0.2) bcrypt-ruby (3.0.1) bson (1.6.1) bson_ext (1.6.1) builder (3.0.0) bundler (1.1.3, 1.0.21) capybara (1.1.2) carmen (0.2.13) childprocess (0.3.1) ci_reporter (1.7.0) coderay (1.0.5) coffee-rails (3.2.2) coffee-script (2.2.0) coffee-script-source (1.2.0) commonjs (0.2.5) cucumber (1.1.9) cucumber-rails (1.3.0) database_cleaner (0.7.2) devise (2.0.4) diff-lcs (1.1.3) ejs (1.0.0) email_spec (1.2.1) engineyard (1.4.28) engineyard-serverside-adapter (1.6.3) erubis (2.7.0) escape (0.0.4) execjs (1.3.0) factory_girl (3.0.0) factory_girl_rails (3.0.0) faker (1.0.1) fakeweb (1.3.0) ffi (1.0.11) gherkin (2.9.3) gyoku (0.4.4) haml (3.1.4) haml-rails (0.3.4) hash-deep-merge (0.1.1) highline (1.6.11) hike (1.2.1) httpi (0.9.6) i18n (0.6.0) jasmine (1.1.2) jasmine-core (1.1.0) jasminerice (0.0.8) journey (1.0.3) jquery-rails (2.0.1) json (1.6.6) json_pure (1.6.6) kaminari (0.13.0) kgio (2.7.4) launchy (2.0.5) less (2.1.0) less-rails (2.2.0) libv8 (3.3.10.4 x86_64-darwin-11) log4r (1.1.10) mail (2.4.4) metaclass (0.0.1) method_source (0.7.1) mime-types (1.18) mocha (0.10.5) mongo (1.6.1) mongoid (2.4.7) mongoid-rspec (1.4.4) multi_json (1.2.0) net-ssh (2.2.2) newrelic_rpm (3.3.3) nokogiri (1.5.2) nori (1.1.0) open4 (1.3.0) orm_adapter (0.0.7) polyglot (0.3.3) pr_geohash (1.0.0) pry (0.9.8.4) pry-highlight (0.0.1) pry_debug (0.0.1) rack (1.4.1) rack-cache (1.2) rack-ssl (1.3.2) rack-test (0.6.1) rails (3.2.2) rails-footnotes (3.7.6) railties (3.2.2) raindrops (0.8.0) rake (0.9.2.2) rdoc (3.12) recursive-open-struct (0.2.1) rest-client (1.6.7) rpm_contrib (2.1.8) rsolr (1.0.7) rspec (2.9.0) rspec-core (2.9.0) rspec-expectations (2.9.0) rspec-mocks (2.9.0) rspec-rails (2.9.0) rubyzip (0.9.6.1) sass (3.1.15) sass-rails (3.2.5) savon (0.9.9) selenium-webdriver (2.20.0) settings-tree (0.2.1) simplecov (0.6.1) simplecov-html (0.5.3) simplecov-rcov (0.2.3) slop (2.4.4) spine-rails (0.1.0) spork (1.0.0rc2) sprockets (2.1.2) sunspot (1.3.1) sunspot_mongoid (0.4.1) sunspot_rails (1.3.1) sunspot_solr (1.3.1) term-ansicolor (1.0.7) therubyracer (0.10.1) thor (0.14.6) tilt (1.3.3) treetop (1.4.10) twitter-bootstrap-rails (2.0.6) tzinfo (0.3.32) uglifier (1.2.4) unicorn (4.2.1) warden (1.1.1) wasabi (2.1.0) xpath (0.1.4) 
+6
source share
5 answers

Here are some approaches you can try.

Cleaning

To clear old versions of your gems:

 gem cleanup --dryrun 

Json

To temporarily see if there is a json gem problem, switch from json (native) to json (pure ruby) and change your Gemfile:

 gem install json_pure 

native stones

There are several in your gems list that marry me as native:

  • Bcrypt
  • BSON
  • erubis
  • ffi (allows many native connections)
  • gherkins
  • kgio
  • smaller
  • nokogiri
  • rain
  • therubyracer (many unpredictable problems IMHO)
  • unicorn

Ffi

Your ffi gem is especially interesting - do you know what you are doing with it?

ffi allows Ruby code to invoke native code, for example, if some part of your Ruby application needs to connect to native libraries.

When you diagnose your problem, I will first look at this stone.

Makefiles

To find any of your gems that have Makefiles, which is a good indicator that they have their own code:

 find / | grep "/ruby/gems/" | grep Makefile 

To find all your gems, you can remove them:

 find / | grep "/ruby/gems/" 

nuke rvm

To apply RVM or its fragments, you can use rvm uninstall , rvm implode or this script, which destroys RVM and finds any lingering parts:

 https://raw.github.com/SixArm/sixarm_unix_shell_scripts/master/rvm-uninstall-danger 

try rbenv + bundler

I have switched from using rvm to using rbenv + bundler and it works fine for me.

The rbenv tool is a direct competitor of rvm for Ruby version control: https://github.com/sstephenson/rbenv

Bundler is a great way to manage gemset and gem dependencies: http://gembundler.com/

brew

If you're on a Mac and using MacPorts, go to "Homebrew":

http://mxcl.github.com/homebrew/

+6
source
  • Uninstall all versions of json gems by running: gem uninstall json

  • Then run: gem install json --platform=ruby

  • Run the bundle again: bundle install

+4
source

You should try to destroy all your gems and reinstall them for your application using the bundle command.

Quoting the RVM documentation for this error :

Try removing and reinstalling the gems using the C extensions that your application uses to find this buggar.

The command to remove gems using RVM is simple:

 rvm uninstall 
+1
source

The best option is a clean reinstall of the latest version of RVM.

rvm implode

rm -rf ~/.rvm

curl -L get.rvm.io | bash -s stable

0
source

Before you switch to the clean ruby ​​/ rvm route, you should check if you deleted ruby ​​1.8.7 (which is installed by default on most distributions). I believe that this interfered with some of my gems compiled from 1.9.2 (I think it was one of the native ones). I completely removed 1.8.7 using apt-get, then created a new rvm profile (changing the profile name in .rvmrc) and then installed the package to completely update all the gems.

0
source

Source: https://habr.com/ru/post/913330/


All Articles