我正在使用坚固的 gem,它使用 libgit2 在 git 存储库上运行。它工作正常,但扩展做了一些奇怪的事情并干扰了其他库的功能。在我的情况下 net/http 开始抛出异常。
就我而言,这是测试代码:
require 'net/http'
require 'uri'
require 'rugged'
@repo = Rugged::Repository.new(".")
@commits = []
@i = 0
walker = @repo.walk(@repo.head.target)
walker.each { |c|
@commits << c
break if @i > 2
@i += 1
}
while true
resource_uri = URI.parse("http://twitter.com/BigDataSG/status/182426904740102144")
response = Net::HTTP.start(resource_uri.host, resource_uri.port) do |http|
http.get(resource_uri.path, {'X-Token' => "TacoBell"}).....
end
puts response.body[0...140]
end
结果是
/Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/protocol.rb:141: [BUG] rb_gc_mark(): unknown data type 0x12(0x7fd31213aeb0) non object
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.0]
-- Control frame information -----------------------------------------------
c:0020 p:---- s:0095 b:0095 l:000094 d:000094 CFUNC :read_nonblock
c:0019 p:0025 s:0091 b:0090 l:000089 d:000089 METHOD /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/protocol.rb:141
c:0018 p:0090 s:0087 b:0087 l:000086 d:000086 METHOD /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/protocol.rb:92
c:0017 p:0067 s:0079 b:0079 l:000078 d:000078 METHOD /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:2755
c:0016 p:0102 s:0074 b:0074 l:000073 d:000073 METHOD /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:2710
c:0015 p:0043 s:0068 b:0068 l:001ee0 d:000067 BLOCK /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1029
c:0014 p:0017 s:0064 b:0064 l:000048 d:000063 BLOCK /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1322
c:0013 p:0042 s:0062 b:0062 l:000061 d:000061 METHOD /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:2671
c:0012 p:0106 s:0057 b:0057 l:000048 d:000056 BLOCK /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1321
c:0011 p:---- s:0055 b:0055 l:000054 d:000054 FINISH
c:0010 p:---- s:0053 b:0053 l:000052 d:000052 CFUNC :catch
c:0009 p:0025 s:0049 b:0049 l:000048 d:000048 METHOD /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1316
c:0008 p:0097 s:0043 b:0043 l:000042 d:000042 METHOD /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1293
c:0007 p:0094 s:0036 b:0036 l:001ee0 d:001ee0 METHOD /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1026
c:0006 p:0026 s:0028 b:0028 l:0015d8 d:000027 BLOCK test.rb:19
c:0005 p:0057 s:0025 b:0025 l:000024 d:000024 METHOD /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:745
c:0004 p:0182 s:0022 b:0022 l:000021 d:000021 METHOD /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:557
c:0003 p:0174 s:0009 b:0009 l:0015d8 d:000610 EVAL test.rb:18
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:0015d8 d:0015d8 TOP
-- Ruby level backtrace information ----------------------------------------
test.rb:18:in `<main>'
/Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:557:in `start'
/Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:745:in `start'
test.rb:19:in `block in <main>'
/Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1026:in `get'
/Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1293:in `request'
/Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1316:in `transport_request'
/Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1316:in `catch'
/Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1321:in `block in transport_request'
/Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:2671:in `reading_body'
/Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1322:in `block (2 levels) in transport_request'
/Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:1029:in `block in get'
/Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:2710:in `read_body'
/Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb:2755:in `read_body_0'
/Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/protocol.rb:92:in `read'
/Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/protocol.rb:141:in `rbuf_fill'
/Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/protocol.rb:141:in `read_nonblock'
-- C level backtrace information -------------------------------------------
See Crash Report log file under ~/Library/Logs/CrashReporter or
/Library/Logs/CrashReporter, for the more detail of.
-- Other runtime information -----------------------------------------------
* Loaded script: test.rb
* Loaded features:
0 enumerator.so
1 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.3.0/enc/encdb.bundle
2 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.3.0/enc/trans/transdb.bundle
3 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/defaults.rb
4 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.3.0/rbconfig.rb
5 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/deprecate.rb
6 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/exceptions.rb
7 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb
8 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems.rb
9 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.3.0/socket.bundle
10 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/socket.rb
11 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/timeout.rb
12 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/protocol.rb
13 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/uri/common.rb
14 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/uri/generic.rb
15 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/uri/ftp.rb
16 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/uri/http.rb
17 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/uri/https.rb
18 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/uri/ldap.rb
19 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/uri/ldaps.rb
20 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/uri/mailto.rb
21 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/uri.rb
22 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.3.0/zlib.bundle
23 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.3.0/stringio.bundle
24 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/http.rb
25 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/version.rb
26 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/requirement.rb
27 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/platform.rb
28 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb
29 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/path_support.rb
30 /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb
31 /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rugged-0.16.0/lib/rugged/rugged.bundle
32 /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rugged-0.16.0/lib/rugged/index.rb
33 /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rugged-0.16.0/lib/rugged/objects.rb
34 /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rugged-0.16.0/lib/rugged/version.rb
35 /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rugged-0.16.0/lib/rugged/repository.rb
36 /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rugged-0.16.0/lib/rugged/walker.rb
37 /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rugged-0.16.0/lib/rugged/tree.rb
38 /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rugged-0.16.0/lib/rugged.rb
[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
Abort trap: 6