2010-08-05 10 views
13

Sono nuovo a Ruby on Rails.Errore: violazione cross-thread su rb_gc()

ho eseguito il seguente in un terminale quando stavo attraversando la creazione di un tutorial blog con Rails:

$ rails blog 
[BUG] cross-thread violation on rb_gc() 
(null) 

Abort trap 

Come faccio a determinare che cosa significa questo messaggio di errore e come risolvere il problema?

$ gem env 
RubyGems Environment: 
    - RUBYGEMS VERSION: 1.3.7 
    - RUBY VERSION: 1.8.7 (2010-06-23 patchlevel 299) [i686-darwin10] 
    - INSTALLATION DIRECTORY: /opt/local/lib/ruby/gems/1.8 
    - RUBY EXECUTABLE: /opt/local/bin/ruby 
    - EXECUTABLE DIRECTORY: /opt/local/bin 
    - RUBYGEMS PLATFORMS: 
    - ruby 
    - x86-darwin-10 
    - GEM PATHS: 
    - /opt/local/lib/ruby/gems/1.8 
    - /Users/sunpech/.gem/ruby/1.8 
    - GEM CONFIGURATION: 
    - :update_sources => true 
    - :verbose => true 
    - :benchmark => false 
    - :backtrace => false 
    - :bulk_threshold => 1000 
    - :sources => ["http://rubygems.org/", "http://gems.github.com"] 
    - REMOTE SOURCES: 
    - http://rubygems.org/ 
    - http://gems.github.com 

UPDATE

ho fatto qualche giocherellare e non sto ricevendo più il messaggio di errore. Ma noto che il mio ambiente ora sta seguendo un percorso diverso di Ruby.

$ gem env 
RubyGems Environment: 
    - RUBYGEMS VERSION: 1.3.5 
    - RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] 
    - INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8 
    - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby 
    - EXECUTABLE DIRECTORY: /usr/bin 
    - RUBYGEMS PLATFORMS: 
    - ruby 
    - universal-darwin-10 
    - GEM PATHS: 
    - /Library/Ruby/Gems/1.8 
    - /Users/sunpech/.gem/ruby/1.8 
    - /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8 
    - GEM CONFIGURATION: 
    - :update_sources => true 
    - :verbose => true 
    - :benchmark => false 
    - :backtrace => false 
    - :bulk_threshold => 1000 
    - :sources => ["http://rubygems.org/", "http://gems.github.com"] 
    - REMOTE SOURCES: 
    - http://rubygems.org/ 
    - http://gems.github.com 

Questo sembra implicare che ho più installazioni di Ruby sul mio Mac box. Uno in/opt/local/bin/e/usr/bin /. Penso che il primo provenga da un'installazione MacPorts, e quest'ultimo è ciò che è venuto con il mio sistema (possibilmente aggiornato).

+1

Stavo ricevendo lo stesso errore. Penso che sia stato un problema con le mie gemme installate. Ho cancellato le gemme installate e l'errore è andato via. Per coincidenza o meno, i PERCORSO GEM nelle versioni di lavoro e non funzionanti sono diversi. –

risposta

4

Il problema era che avevo più installazioni/percorsi di ruby ​​sul mio sistema. Mac OS X Snow Leopard credo sia dotato di rubino preinstallato. Ho fatto l'errore di usare MacPorts per installare una versione più recente, a fianco.

ho risolto il problema:

  1. disinstallare la versione di Ruby da MacPorts
  2. Installazione Ruby Version Manager, aka rvm, per aiutarmi a gestire rubino installazioni multiple. (facoltativo, ma consigliato)

Ho anche postato questo messaggio su Ruby on Rails Talk. Vedi Error: cross-thread violation on rb_gc()

4

Ho avuto un problema simile installando buildr gem (utilizzando rvm). This soluzione ha aiutato:

I could nail this bug down to the native extensions of the ruby-java-bridge (rjb) on Mac OSX. What you want to do to fix this is the following:

gem uninstall rjb 
gem uninstall buildr 

When asked just uninstall all versions.

gem install rjb -v 1.3.3 --platform ruby 
gem install buildr 

This will install the ruby version of rjb and not the native darwin version. This should fix the issue.

Cheers Dominic

Anche se, non è legato alla domanda, questo può aiutare coloro che cercherà lo stesso messaggio di errore.

+0

Anche questo buildr fisso per me.Grazie – mawaldne

10

Questo può accadere con tutti i tipi di gemme e sembra avere a che fare con una gemma con estensioni C compilate su un rubino diverso da quello che tenta di caricarlo.

https://rvm.io/support/troubleshooting/

Bus Error/Segfault

[BUG] cross-thread violation on rb_gc() 

In every case of this I have seen thus far it has always ended up being that a ruby gem/library with C extensions was compiled against a different ruby and/or architecture than the one that is trying to load it. Try uninstalling & reinstalling gems with C extensions that your application uses to hunt this bugger down.

La gemma JSON è un colpevole frequente, ma c'è una lunga lista di altre gemme che le persone hanno avuto problema con. Non sono sicuro di capire esattamente quale gem sia il problema, ma se stai usando rvm con gemsets, puoi sempre rvm gemset empty e reinstallare tutti i tuoi gem con Bundler.

+1

Un buon suggerimento - Avevo aggiunto il mio pacchetto di installazione e metà con un rubino e mezzo con un altro e rvm gemset vuoto era esattamente quello che serviva per raddrizzare le cose. –

Problemi correlati