Ruby fails with a bug when using nokogiri
I am in the process of getting another developer set up on my app and I'm running into a Ruby issue that seems to be very low level. The app runs perfectly fine on my machine but not on the other developers.
Nokogiri is being used by Sunspot for search indexing.
Ruby was installed by RVM (for both me and the other developer). We've tried different patches of Ruby 1.9.2 and different versions of nokogiri.
I suspect problems with the Ruby build. Could this issue be related to the environment? How do you resolve problems like this?
When running "rake sunspot:solr:start", nokogiri fails in Ruby with the following errors:
** EDIT **
We've settled on nokogiri 1.4.7 (to accommodate for some bug fixes) and receive the "cross-thread violation on rb_gc()" error below. We receive this error when simply booting up the server as well with "rails s". I'll leave the backtrace with nokogiri 1.4.4 just to aid in the investigation.
This is within Nokogiri 1.4.4:
Users/fredyates/.rvm/gems/ruby-1.9.2-p290/gems/nokogiri-1.4.4/lib/nokogiri/nokogiri.bundle: [BUG] Segmentatio开发者_运维知识库n fault
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0]
-- control frame ----------
c:0034 p:-542802226 s:0105 b:0105 l:000104 d:000104 TOP
c:0033 p:---- s:0103 b:0103 l:000102 d:000102 CFUNC :require
c:0032 p:0186 s:0099 b:0099 l:000098 d:000098 TOP /Users/fredyates/.rvm/gems/ruby-1.9.2-p290/gems/nokogiri-1.4.4/lib/nokogiri.rb:13
c:0031 p:---- s:0097 b:0097 l:000096 d:000096 FINISH
c:0030 p:---- s:0095 b:0095 l:000094 d:000094 CFUNC :require
...
-- C level backtrace information -------------------------------------------
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
Within nokogiri 1.4.7:
[BUG] cross-thread violation on rb_gc() (null)
zsh: abort rake sunspot:solr:start
To me, this looks like Ruby issues.
nokogiri -v (for me):
---
warnings: []
nokogiri: 1.4.7
ruby:
version: 1.9.2
platform: x86_64-darwin10.7.4
description: ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.4]
engine: ruby
libxml:
binding: extension
compiled: 2.7.8
loaded: 2.7.8
nokogiri -v (for the other developer)
---
warnings: []
nokogiri: 1.4.7
ruby:
version: 1.9.2
platform: x86_64-darwin10.7.0
description: ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0]
engine: ruby
libxml:
binding: extension
compiled: 2.7.8
loaded: 2.7.8
I ran into a similar (and vexing) issue a while back. You could try using an rvm gemset to see if that helps. As I recall though I needed to nuke rvm and re-install ('rvm implode' will do the nuking).
This could also be a 32-bit versus 64-bit compile issue. If this is on a Snow Leopard or Lion mac they might try adding ARCH_FLAGS="-arch x86_64" to their .bash_login file or equivalent (assuming that's not already defined).
This is probably releated to Alex's comment about 32-bit vs. 64-bit but running gem pristine nokogiri
solved this for me.
精彩评论