错误:rb_gc()上的跨线程冲突 [英] Error: cross-thread violation on rb_gc()
问题描述
我是Ruby on Rails的新手.
I'm new to Ruby on Rails.
当我使用Rails创建博客教程时,我在终端中运行了以下内容:
I ran the following in a terminal when I was going through creating a blog tutorial with Rails:
$ rails blog
[BUG] cross-thread violation on rb_gc()
(null)
Abort trap
如何确定此错误消息的含义以及如何解决?
How do I determine what this error message means and how to fix it?
$ 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
更新
我做了些摆弄,但我再也没有收到错误消息.但是我确实注意到我的环境现在正在运行Ruby的另一条路径.
I did some fiddling and I'm not getting the error message anymore. But I do notice that my environment is running a different path of Ruby now.
$ 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
这似乎意味着我在Mac盒子上安装了多个Ruby.在/opt/local/bin/和/usr/bin/中.我认为前者来自MacPorts安装,后者是我的系统附带的(可能已升级).
This seems to imply that I have multiple installs of Ruby on my Mac box. One in /opt/local/bin/ and /usr/bin/. I think the former came from a MacPorts install, and the latter is what came with my system (possibly upgraded).
推荐答案
问题是我的系统上有多个ruby安装/路径.我相信Mac OS X Snow Leopard预先安装了红宝石.我误以为使用MacPorts来安装更新的版本.
The problem was that I had multiple installs/paths of ruby on my system. Mac OS X Snow Leopard comes with ruby pre-installed I believe. I made the mistake of using MacPorts to install a newer version, right alongside.
我通过以下方式解决了该问题:
I fixed the problem by:
- 从Macports卸载ruby版本
- 安装 Ruby Version Manager (又称rvm),以帮助我管理多个ruby安装. (可选,但推荐)
- Uninstalling the version of ruby from Macports
- Installing Ruby Version Manager, aka rvm, to help me manage multiple ruby installs. (optional, but recommended)
我还将其发布在Ruby on Rails Talk上.参见错误: rb_gc()上的跨线程冲突
I also posted this on Ruby on Rails Talk. See Error: cross-thread violation on rb_gc()
这篇关于错误:rb_gc()上的跨线程冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!