Error: cross-thread violation on rb_gc()

528 views
Skip to first unread message

Spong

unread,
Aug 8, 2010, 10:23:15 PM8/8/10
to Ruby on Rails: Talk
I don't like cross-posting, but there doesn't seem to be much activity/
response to my question on StackOverflow.

Link to SO: http://stackoverflow.com/questions/3413209/error-cross-thread-violation-on-rb-gc

Question:

I'm new to Ruby on 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?

Is there something wrong with a gem installed?

$ gem list

*** LOCAL GEMS ***

actionmailer (2.3.8)
actionpack (2.3.8)
activerecord (2.3.8)
activeresource (2.3.8)
activesupport (2.3.8)
colored (1.2)
crack (0.1.8)
json (1.4.3)
pusher (0.5.3)
rack (1.2.1, 1.1.0)
rails (2.3.8)
rake (0.8.7)
ruby-hmac (0.4.0)
signature (0.1.1, 0.1.0)
sinatra (1.0)
sqlite3-ruby (1.3.1, 1.3.0)
webmat-git_remote_branch (0.3.0)

$ 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

Chris Mear

unread,
Aug 9, 2010, 3:13:35 PM8/9/10
to rubyonra...@googlegroups.com

This smells like a borked Ruby installation, or multiple Ruby
installations conflicting with each other, or something like that.

Have you installed Ruby multiple times? How did you install the Ruby
you're using in /opt/local/bin? MacPorts, I'm guessing?

Chris

Spong

unread,
Aug 9, 2010, 3:53:13 PM8/9/10
to Ruby on Rails: Talk
I think I did install multiple instances of Ruby. How can I tell?
And how can I remove the extra?

Yes, I believe I did install one via MacPorts, and another manually.
I'm also new to Macs.

On Aug 9, 2:13 pm, Chris Mear <chrism...@gmail.com> wrote:
> On 9 August 2010 03:23, Spong <sunp...@gmail.com> wrote:
>
>
>
>
>
> > I don't like cross-posting, but there doesn't seem to be much activity/
> > response to my question on StackOverflow.
>
> > Link to SO:http://stackoverflow.com/questions/3413209/error-cross-thread-violati...
> >     -http://gems.github.com

Spong

unread,
Aug 10, 2010, 3:39:03 AM8/10/10
to Ruby on Rails: Talk
I did some fiddling and this is what I'm getting:

$ 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:
So ruby seems to be installed in two place: /usr/bin/ and /opt/local/
bin. The former is the ruby that came with my Mac, and the latter
from MacPorts. Should I not use MacPorts to install/update ruby?

Marnen Laibow-Koser

unread,
Aug 10, 2010, 10:41:28 AM8/10/10
to rubyonra...@googlegroups.com
Spong wrote:
[...]

> So ruby seems to be installed in two place: /usr/bin/ and /opt/local/
> bin. The former is the ruby that came with my Mac, and the latter
> from MacPorts. Should I not use MacPorts to install/update ruby?

The Ruby that comes with Leopard is perfectly adequate (it's what I'm
using for development), unless you specifically want a newer version.
Some people like to install through Ports or Fink or build it themselves
regardless, but I think that's just a waste of time and disk space.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
--
Posted via http://www.ruby-forum.com/.

Nat Budin

unread,
Aug 10, 2010, 11:11:55 AM8/10/10
to Ruby on Rails: Talk
What Marnen said. Also, if you want to test stuff with multiple
versions of Ruby, rvm is an easy way to automatically install and
isolate different versions of Ruby on the same machine.

http://rvm.beginrescueend.com/

Nat

Frederick Cheung

unread,
Aug 10, 2010, 11:16:44 AM8/10/10
to Ruby on Rails: Talk


On 10 Aug, 15:41, Marnen Laibow-Koser <li...@ruby-forum.com> wrote:
> Spong wrote:
>
> [...]
>
> > So ruby seems to be installed in two place: /usr/bin/ and /opt/local/
> > bin.  The former is the ruby that came with my Mac, and the latter
> > from MacPorts.  Should I not use MacPorts to install/update ruby?
>
> The Ruby that comes with Leopard is perfectly adequate (it's what I'm
> using for development), unless you specifically want a newer version.
> Some people like to install through Ports or Fink or build it themselves
> regardless, but I think that's just a waste of time and disk space.

As long as the bug in bigdecimal doesn't bother you :-)

Fred

Marnen Laibow-Koser

unread,
Aug 10, 2010, 11:28:26 AM8/10/10
to rubyonra...@googlegroups.com
Frederick Cheung wrote:
> On 10 Aug, 15:41, Marnen Laibow-Koser <li...@ruby-forum.com> wrote:
>> Some people like to install through Ports or Fink or build it themselves
>> regardless, but I think that's just a waste of time and disk space.
>
> As long as the bug in bigdecimal doesn't bother you :-)

Can't say I've run into that. Info?

(For the record, the only projects on which I've been using BigDecimal
at all have been using Rubinius or JRuby, not MRI.)

>
> Fred

Nat Budin

unread,
Aug 10, 2010, 11:43:20 AM8/10/10
to Ruby on Rails: Talk
On Aug 10, 11:28 am, Marnen Laibow-Koser <li...@ruby-forum.com> wrote:
> Frederick Cheung wrote:
> > As long as the bug in bigdecimal doesn't bother you :-)
>
> Can't say I've run into that.  Info?
>
> (For the record, the only projects on which I've been using BigDecimal
> at all have been using Rubinius or JRuby, not MRI.)

I hadn't either, but this article gives the details:
http://www.abletech.co.nz/2010/03/osx-10-6-3-installs-new-ruby-with-faulty-bigdecimal/

From the article:

BigDecimal.new("3.0009").to_f
=> 3.9

Nat

Marnen Laibow-Koser

unread,
Aug 10, 2010, 12:19:18 PM8/10/10
to rubyonra...@googlegroups.com

Ouch! I think I'm using patchlevel 287, which would imply that a later
upgrade to Snow Leopard fixed the patch, but I'm not at that computer
right now to check. If I *am* using the faulty version, that implies
that I finally have a use for RVM.

> Nat

Chris Mear

unread,
Aug 10, 2010, 5:02:02 PM8/10/10
to rubyonra...@googlegroups.com
On 10 August 2010 08:39, Spong <sun...@gmail.com> wrote:
> So ruby seems to be installed in two place: /usr/bin/ and /opt/local/
> bin.  The former is the ruby that came with my Mac, and the latter
> from MacPorts.  Should I not use MacPorts to install/update ruby?

Well, there's nothing fundamentally wrong with having multiple Rubies
on one system. Before RVM [1] came along, I always used to compile my
own Ruby into /usr/local, and it seemed to live perfectly happy
alongside OS X's built-in Ruby.

So, the fact that MacPorts' Ruby is misbehaving in this way on your
system is strange. But unless you're particularly interested in
fathoming that problem out, the quickest fix (as Marnen and Nat have
suggested) would be to uninstall MacPorts' Ruby and use OS X's
instead, or use RVM to install your Rubies.

Chris

Reply all
Reply to author
Forward
0 new messages