You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Andrew Kuhnhausen (JIRA)" <ji...@apache.org> on 2009/10/21 03:25:59 UTC

[jira] Created: (THRIFT-610) binary_protocol segfaults binary_protocol.rb line 86

binary_protocol segfaults binary_protocol.rb line 86
----------------------------------------------------

                 Key: THRIFT-610
                 URL: https://issues.apache.org/jira/browse/THRIFT-610
             Project: Thrift
          Issue Type: Bug
          Components: Library (Ruby)
    Affects Versions: 0.1, 0.2
         Environment: ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] - svn checkout
ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0] - git HEAD
            Reporter: Andrew Kuhnhausen
             Fix For: 0.1, 0.2


output from irb 1.8
/usr/local/lib/site_ruby/1.8/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]

output from irb 1.9
/usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0]

-- control frame ----------
c:0028 p:---- s:0114 b:0114 l:000113 d:000113 CFUNC  :write
c:0027 p:0029 s:0110 b:0110 l:000109 d:000109 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86
c:0026 p:0037 s:0106 b:0106 l:000105 d:000105 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38
c:0025 p:0029 s:0100 b:0100 l:000099 d:000099 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29
c:0024 p:0050 s:0092 b:0092 l:000091 d:000091 METHOD /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21
c:0023 p:0045 s:0082 b:0082 l:000e28 d:001858 EVAL   (irb):11
c:0022 p:---- s:0080 b:0080 l:000079 d:000079 FINISH
c:0021 p:---- s:0078 b:0078 l:000077 d:000077 CFUNC  :eval
c:0020 p:0027 s:0071 b:0071 l:000070 d:000070 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80
c:0019 p:0031 s:0064 b:0063 l:000062 d:000062 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218
c:0018 p:0030 s:0058 b:0058 l:001018 d:000057 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149
c:0017 p:0037 s:0050 b:0050 l:000049 d:000049 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263
c:0016 p:0011 s:0045 b:0045 l:001018 d:000044 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146
c:0015 p:0132 s:0041 b:0041 l:000024 d:000040 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244
c:0014 p:---- s:0038 b:0038 l:000037 d:000037 FINISH
c:0013 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC  :loop
c:0012 p:0009 s:0033 b:0033 l:000024 d:000032 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230
c:0011 p:---- s:0031 b:0031 l:000030 d:000030 FINISH
c:0010 p:---- s:0029 b:0029 l:000028 d:000028 CFUNC  :catch
c:0009 p:0023 s:0025 b:0025 l:000024 d:000024 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229
c:0008 p:0042 s:0022 b:0022 l:001018 d:001018 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145
c:0007 p:0011 s:0019 b:0019 l:000f68 d:000018 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69
c:0006 p:---- s:0017 b:0017 l:000016 d:000016 FINISH
c:0005 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC  :catch
c:0004 p:0172 s:0011 b:0011 l:000f68 d:000f68 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68
c:0003 p:0039 s:0006 b:0006 l:001988 d:001a28 EVAL   /usr/local/ruby1.9/bin/irb:12
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001988 d:001988 TOP   
---------------------------
-- Ruby level backtrace information-----------------------------------------
/usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write'
/usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write_i16'
/usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38:in `write_message_begin'
/usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29:in `send_message'
/Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21:in `send_create'
(irb):11:in `irb_binding'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218:in `evaluate'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149:in `block (2 levels) in eval_input'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263:in `signal_status'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146:in `block in eval_input'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244:in `block (2 levels) in each_top_level_statement'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `loop'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `block in each_top_level_statement'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `catch'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `each_top_level_statement'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145:in `eval_input'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69:in `block in start'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `catch'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `start'
/usr/local/ruby1.9/bin/irb:12:in `<main>'

-- C level backtrace information -------------------------------------------

Line 21 of 'container.rb' (generated by thrift) is the method, send_create
    def send_create(customerId, id, uuid, address, name, os, stack)
      send_message('create', Create_args, :customerId => customerId, :id => id, :uuid => uuid, :address => address, :name => name, :os => os, :stack => stack)
    end

This is how the method 'send_create' is being called with irb1.9 output:
buffer = Thrift::MemoryBufferTransport.new(1024)
     ### => #<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>
protocol = Thrift::BinaryProtocol.new(buffer)
    ###<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>
irb(main):009:0> client = Container::Client.new(protocol)
    ###<Container::Client:0x000001011e8608 @iprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @oprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @seqid=0>

### send_create(customerId, id, uuid, address, name, os, stack)
client.send_create(
  '0000',
  '0',
  '00xxx0x0-x0x0-00xx-xx00-x000x0x0xx00',
  'www.whateveraddy.com',
  'thrift_container',
  '0',
  '1'
)

then the output from the top comes out with the segfault.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (THRIFT-610) binary_protocol.rb segfaults [line 86]

Posted by "Andrew Kuhnhausen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-610?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Kuhnhausen updated THRIFT-610:
-------------------------------------

    Description: 
output from irb 1.8
/usr/local/lib/site_ruby/1.8/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]

output from irb 1.9
/usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0]

-- control frame ----------
c:0028 p:---- s:0114 b:0114 l:000113 d:000113 CFUNC  :write
c:0027 p:0029 s:0110 b:0110 l:000109 d:000109 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86
c:0026 p:0037 s:0106 b:0106 l:000105 d:000105 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38
c:0025 p:0029 s:0100 b:0100 l:000099 d:000099 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29
c:0024 p:0050 s:0092 b:0092 l:000091 d:000091 METHOD /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21
c:0023 p:0045 s:0082 b:0082 l:000e28 d:001858 EVAL   (irb):11
c:0022 p:---- s:0080 b:0080 l:000079 d:000079 FINISH
c:0021 p:---- s:0078 b:0078 l:000077 d:000077 CFUNC  :eval
c:0020 p:0027 s:0071 b:0071 l:000070 d:000070 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80
c:0019 p:0031 s:0064 b:0063 l:000062 d:000062 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218
c:0018 p:0030 s:0058 b:0058 l:001018 d:000057 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149
c:0017 p:0037 s:0050 b:0050 l:000049 d:000049 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263
c:0016 p:0011 s:0045 b:0045 l:001018 d:000044 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146
c:0015 p:0132 s:0041 b:0041 l:000024 d:000040 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244
c:0014 p:---- s:0038 b:0038 l:000037 d:000037 FINISH
c:0013 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC  :loop
c:0012 p:0009 s:0033 b:0033 l:000024 d:000032 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230
c:0011 p:---- s:0031 b:0031 l:000030 d:000030 FINISH
c:0010 p:---- s:0029 b:0029 l:000028 d:000028 CFUNC  :catch
c:0009 p:0023 s:0025 b:0025 l:000024 d:000024 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229
c:0008 p:0042 s:0022 b:0022 l:001018 d:001018 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145
c:0007 p:0011 s:0019 b:0019 l:000f68 d:000018 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69
c:0006 p:---- s:0017 b:0017 l:000016 d:000016 FINISH
c:0005 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC  :catch
c:0004 p:0172 s:0011 b:0011 l:000f68 d:000f68 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68
c:0003 p:0039 s:0006 b:0006 l:001988 d:001a28 EVAL   /usr/local/ruby1.9/bin/irb:12
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001988 d:001988 TOP   
---------------------------
-- Ruby level backtrace information-----------------------------------------
/usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write'
/usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write_i16'
/usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38:in `write_message_begin'
/usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29:in `send_message'
/Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21:in `send_create'
(irb):11:in `irb_binding'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218:in `evaluate'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149:in `block (2 levels) in eval_input'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263:in `signal_status'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146:in `block in eval_input'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244:in `block (2 levels) in each_top_level_statement'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `loop'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `block in each_top_level_statement'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `catch'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `each_top_level_statement'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145:in `eval_input'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69:in `block in start'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `catch'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `start'
/usr/local/ruby1.9/bin/irb:12:in `<main>'

-- C level backtrace information -------------------------------------------

Line 21 of 'container.rb' (generated by thrift) is the method, send_create

    def send_create(customerId, id, uuid, address, name, os, stack)
      send_message('create', Create_args, :customerId => customerId, :id => id, :uuid => uuid, :address => address, :name => name, :os => os, :stack => stack)
    end

This is how the method 'send_create' is being called with irb1.9 output (basically the same as irb1.8 output just with great back tracing):
buffer = Thrift::MemoryBufferTransport.new(1024)
     ### => #<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>
protocol = Thrift::BinaryProtocol.new(buffer)
    ###<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>
irb(main):009:0> client = Container::Client.new(protocol)
    ###<Container::Client:0x000001011e8608 @iprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @oprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @seqid=0>

### send_create(customerId, id, uuid, address, name, os, stack)
client.send_create(
  '0000',
  '0',
  '00xxx0x0-x0x0-00xx-xx00-x000x0x0xx00',
  'www.whateveraddy.com',
  'thrift_container',
  '0',
  '1'
)

then the output from the top comes out with the segfault.

the error line refers to this in binary_protocol.rb
    def write_i16(i16)
      trans.write([i16].pack('n'))
    end
if that is removed, it fails on:
    def write_i32(i32)
      raise RangeError if i32 < -2**31 || i32 >= 2**31
      trans.write([i32].pack('N'))
    end

  was:
output from irb 1.8
/usr/local/lib/site_ruby/1.8/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]

output from irb 1.9
/usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0]

-- control frame ----------
c:0028 p:---- s:0114 b:0114 l:000113 d:000113 CFUNC  :write
c:0027 p:0029 s:0110 b:0110 l:000109 d:000109 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86
c:0026 p:0037 s:0106 b:0106 l:000105 d:000105 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38
c:0025 p:0029 s:0100 b:0100 l:000099 d:000099 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29
c:0024 p:0050 s:0092 b:0092 l:000091 d:000091 METHOD /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21
c:0023 p:0045 s:0082 b:0082 l:000e28 d:001858 EVAL   (irb):11
c:0022 p:---- s:0080 b:0080 l:000079 d:000079 FINISH
c:0021 p:---- s:0078 b:0078 l:000077 d:000077 CFUNC  :eval
c:0020 p:0027 s:0071 b:0071 l:000070 d:000070 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80
c:0019 p:0031 s:0064 b:0063 l:000062 d:000062 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218
c:0018 p:0030 s:0058 b:0058 l:001018 d:000057 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149
c:0017 p:0037 s:0050 b:0050 l:000049 d:000049 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263
c:0016 p:0011 s:0045 b:0045 l:001018 d:000044 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146
c:0015 p:0132 s:0041 b:0041 l:000024 d:000040 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244
c:0014 p:---- s:0038 b:0038 l:000037 d:000037 FINISH
c:0013 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC  :loop
c:0012 p:0009 s:0033 b:0033 l:000024 d:000032 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230
c:0011 p:---- s:0031 b:0031 l:000030 d:000030 FINISH
c:0010 p:---- s:0029 b:0029 l:000028 d:000028 CFUNC  :catch
c:0009 p:0023 s:0025 b:0025 l:000024 d:000024 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229
c:0008 p:0042 s:0022 b:0022 l:001018 d:001018 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145
c:0007 p:0011 s:0019 b:0019 l:000f68 d:000018 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69
c:0006 p:---- s:0017 b:0017 l:000016 d:000016 FINISH
c:0005 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC  :catch
c:0004 p:0172 s:0011 b:0011 l:000f68 d:000f68 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68
c:0003 p:0039 s:0006 b:0006 l:001988 d:001a28 EVAL   /usr/local/ruby1.9/bin/irb:12
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001988 d:001988 TOP   
---------------------------
-- Ruby level backtrace information-----------------------------------------
/usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write'
/usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write_i16'
/usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38:in `write_message_begin'
/usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29:in `send_message'
/Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21:in `send_create'
(irb):11:in `irb_binding'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218:in `evaluate'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149:in `block (2 levels) in eval_input'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263:in `signal_status'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146:in `block in eval_input'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244:in `block (2 levels) in each_top_level_statement'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `loop'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `block in each_top_level_statement'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `catch'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `each_top_level_statement'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145:in `eval_input'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69:in `block in start'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `catch'
/usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `start'
/usr/local/ruby1.9/bin/irb:12:in `<main>'

-- C level backtrace information -------------------------------------------

Line 21 of 'container.rb' (generated by thrift) is the method, send_create
    def send_create(customerId, id, uuid, address, name, os, stack)
      send_message('create', Create_args, :customerId => customerId, :id => id, :uuid => uuid, :address => address, :name => name, :os => os, :stack => stack)
    end

This is how the method 'send_create' is being called with irb1.9 output:
buffer = Thrift::MemoryBufferTransport.new(1024)
     ### => #<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>
protocol = Thrift::BinaryProtocol.new(buffer)
    ###<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>
irb(main):009:0> client = Container::Client.new(protocol)
    ###<Container::Client:0x000001011e8608 @iprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @oprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @seqid=0>

### send_create(customerId, id, uuid, address, name, os, stack)
client.send_create(
  '0000',
  '0',
  '00xxx0x0-x0x0-00xx-xx00-x000x0x0xx00',
  'www.whateveraddy.com',
  'thrift_container',
  '0',
  '1'
)

then the output from the top comes out with the segfault.

        Summary: binary_protocol.rb segfaults [line 86]  (was: binary_protocol segfaults binary_protocol.rb line 86)

> binary_protocol.rb segfaults [line 86]
> --------------------------------------
>
>                 Key: THRIFT-610
>                 URL: https://issues.apache.org/jira/browse/THRIFT-610
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>    Affects Versions: 0.1, 0.2
>         Environment: ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] - svn checkout
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0] - git HEAD
>            Reporter: Andrew Kuhnhausen
>             Fix For: 0.1, 0.2
>
>
> output from irb 1.8
> /usr/local/lib/site_ruby/1.8/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
> output from irb 1.9
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0]
> -- control frame ----------
> c:0028 p:---- s:0114 b:0114 l:000113 d:000113 CFUNC  :write
> c:0027 p:0029 s:0110 b:0110 l:000109 d:000109 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86
> c:0026 p:0037 s:0106 b:0106 l:000105 d:000105 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38
> c:0025 p:0029 s:0100 b:0100 l:000099 d:000099 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29
> c:0024 p:0050 s:0092 b:0092 l:000091 d:000091 METHOD /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21
> c:0023 p:0045 s:0082 b:0082 l:000e28 d:001858 EVAL   (irb):11
> c:0022 p:---- s:0080 b:0080 l:000079 d:000079 FINISH
> c:0021 p:---- s:0078 b:0078 l:000077 d:000077 CFUNC  :eval
> c:0020 p:0027 s:0071 b:0071 l:000070 d:000070 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80
> c:0019 p:0031 s:0064 b:0063 l:000062 d:000062 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218
> c:0018 p:0030 s:0058 b:0058 l:001018 d:000057 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149
> c:0017 p:0037 s:0050 b:0050 l:000049 d:000049 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263
> c:0016 p:0011 s:0045 b:0045 l:001018 d:000044 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146
> c:0015 p:0132 s:0041 b:0041 l:000024 d:000040 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244
> c:0014 p:---- s:0038 b:0038 l:000037 d:000037 FINISH
> c:0013 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC  :loop
> c:0012 p:0009 s:0033 b:0033 l:000024 d:000032 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230
> c:0011 p:---- s:0031 b:0031 l:000030 d:000030 FINISH
> c:0010 p:---- s:0029 b:0029 l:000028 d:000028 CFUNC  :catch
> c:0009 p:0023 s:0025 b:0025 l:000024 d:000024 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229
> c:0008 p:0042 s:0022 b:0022 l:001018 d:001018 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145
> c:0007 p:0011 s:0019 b:0019 l:000f68 d:000018 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69
> c:0006 p:---- s:0017 b:0017 l:000016 d:000016 FINISH
> c:0005 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC  :catch
> c:0004 p:0172 s:0011 b:0011 l:000f68 d:000f68 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68
> c:0003 p:0039 s:0006 b:0006 l:001988 d:001a28 EVAL   /usr/local/ruby1.9/bin/irb:12
> c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
> c:0001 p:0000 s:0002 b:0002 l:001988 d:001988 TOP   
> ---------------------------
> -- Ruby level backtrace information-----------------------------------------
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write_i16'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38:in `write_message_begin'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29:in `send_message'
> /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21:in `send_create'
> (irb):11:in `irb_binding'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149:in `block (2 levels) in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263:in `signal_status'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146:in `block in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244:in `block (2 levels) in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `loop'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `block in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145:in `eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69:in `block in start'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `start'
> /usr/local/ruby1.9/bin/irb:12:in `<main>'
> -- C level backtrace information -------------------------------------------
> Line 21 of 'container.rb' (generated by thrift) is the method, send_create
>     def send_create(customerId, id, uuid, address, name, os, stack)
>       send_message('create', Create_args, :customerId => customerId, :id => id, :uuid => uuid, :address => address, :name => name, :os => os, :stack => stack)
>     end
> This is how the method 'send_create' is being called with irb1.9 output (basically the same as irb1.8 output just with great back tracing):
> buffer = Thrift::MemoryBufferTransport.new(1024)
>      ### => #<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>
> protocol = Thrift::BinaryProtocol.new(buffer)
>     ###<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>
> irb(main):009:0> client = Container::Client.new(protocol)
>     ###<Container::Client:0x000001011e8608 @iprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @oprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @seqid=0>
> ### send_create(customerId, id, uuid, address, name, os, stack)
> client.send_create(
>   '0000',
>   '0',
>   '00xxx0x0-x0x0-00xx-xx00-x000x0x0xx00',
>   'www.whateveraddy.com',
>   'thrift_container',
>   '0',
>   '1'
> )
> then the output from the top comes out with the segfault.
> the error line refers to this in binary_protocol.rb
>     def write_i16(i16)
>       trans.write([i16].pack('n'))
>     end
> if that is removed, it fails on:
>     def write_i32(i32)
>       raise RangeError if i32 < -2**31 || i32 >= 2**31
>       trans.write([i32].pack('N'))
>     end

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (THRIFT-610) binary_protocol.rb segfaults [line 86]

Posted by "Rajesh Malepati (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-610?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rajesh Malepati updated THRIFT-610:
-----------------------------------

    Attachment: membuf-ruby19-fix.patch

This patch should solve the problem. Fixnum#ord is available in Ruby 1.8.6 and lib/thrift/core_ext/fixnum.rb does provide the required implementation.

Also, Thrift::MemoryBufferTransport.new(1024) is incorrect usage. Ruby doesn't have a StringBuffer class and MemoryBufferTransport expects a string like object.

> binary_protocol.rb segfaults [line 86]
> --------------------------------------
>
>                 Key: THRIFT-610
>                 URL: https://issues.apache.org/jira/browse/THRIFT-610
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>    Affects Versions: 0.2
>         Environment: ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] - svn checkout
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0] - git HEAD
>            Reporter: Andrew Kuhnhausen
>             Fix For: 0.5
>
>         Attachments: doot.pl, membuf-ruby19-fix.patch, thrift-segfaul.rb
>
>
> output from irb 1.8
> /usr/local/lib/site_ruby/1.8/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
> output from irb 1.9
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0]
> -- control frame ----------
> c:0028 p:---- s:0114 b:0114 l:000113 d:000113 CFUNC  :write
> c:0027 p:0029 s:0110 b:0110 l:000109 d:000109 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86
> c:0026 p:0037 s:0106 b:0106 l:000105 d:000105 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38
> c:0025 p:0029 s:0100 b:0100 l:000099 d:000099 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29
> c:0024 p:0050 s:0092 b:0092 l:000091 d:000091 METHOD /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21
> c:0023 p:0045 s:0082 b:0082 l:000e28 d:001858 EVAL   (irb):11
> c:0022 p:---- s:0080 b:0080 l:000079 d:000079 FINISH
> c:0021 p:---- s:0078 b:0078 l:000077 d:000077 CFUNC  :eval
> c:0020 p:0027 s:0071 b:0071 l:000070 d:000070 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80
> c:0019 p:0031 s:0064 b:0063 l:000062 d:000062 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218
> c:0018 p:0030 s:0058 b:0058 l:001018 d:000057 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149
> c:0017 p:0037 s:0050 b:0050 l:000049 d:000049 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263
> c:0016 p:0011 s:0045 b:0045 l:001018 d:000044 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146
> c:0015 p:0132 s:0041 b:0041 l:000024 d:000040 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244
> c:0014 p:---- s:0038 b:0038 l:000037 d:000037 FINISH
> c:0013 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC  :loop
> c:0012 p:0009 s:0033 b:0033 l:000024 d:000032 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230
> c:0011 p:---- s:0031 b:0031 l:000030 d:000030 FINISH
> c:0010 p:---- s:0029 b:0029 l:000028 d:000028 CFUNC  :catch
> c:0009 p:0023 s:0025 b:0025 l:000024 d:000024 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229
> c:0008 p:0042 s:0022 b:0022 l:001018 d:001018 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145
> c:0007 p:0011 s:0019 b:0019 l:000f68 d:000018 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69
> c:0006 p:---- s:0017 b:0017 l:000016 d:000016 FINISH
> c:0005 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC  :catch
> c:0004 p:0172 s:0011 b:0011 l:000f68 d:000f68 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68
> c:0003 p:0039 s:0006 b:0006 l:001988 d:001a28 EVAL   /usr/local/ruby1.9/bin/irb:12
> c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
> c:0001 p:0000 s:0002 b:0002 l:001988 d:001988 TOP   
> ---------------------------
> -- Ruby level backtrace information-----------------------------------------
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write_i16'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38:in `write_message_begin'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29:in `send_message'
> /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21:in `send_create'
> (irb):11:in `irb_binding'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149:in `block (2 levels) in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263:in `signal_status'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146:in `block in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244:in `block (2 levels) in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `loop'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `block in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145:in `eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69:in `block in start'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `start'
> /usr/local/ruby1.9/bin/irb:12:in `<main>'
> -- C level backtrace information -------------------------------------------
> Line 21 of 'container.rb' (generated by thrift) is the method, send_create
>     def send_create(customerId, id, uuid, address, name, os, stack)
>       send_message('create', Create_args, :customerId => customerId, :id => id, :uuid => uuid, :address => address, :name => name, :os => os, :stack => stack)
>     end
> This is how the method 'send_create' is being called with irb1.9 output (basically the same as irb1.8 output just with great back tracing):
> buffer = Thrift::MemoryBufferTransport.new(1024)
>      ### => #<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>
> protocol = Thrift::BinaryProtocol.new(buffer)
>     ###<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>
> irb(main):009:0> client = Container::Client.new(protocol)
>     ###<Container::Client:0x000001011e8608 @iprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @oprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @seqid=0>
> ### send_create(customerId, id, uuid, address, name, os, stack)
> client.send_create(
>   '0000',
>   '0',
>   '00xxx0x0-x0x0-00xx-xx00-x000x0x0xx00',
>   'www.whateveraddy.com',
>   'thrift_container',
>   '0',
>   '1'
> )
> then the output from the top comes out with the segfault.
> the error line refers to this in binary_protocol.rb
>     def write_i16(i16)
>       trans.write([i16].pack('n'))
>     end
> if that is removed, it fails on:
>     def write_i32(i32)
>       raise RangeError if i32 < -2**31 || i32 >= 2**31
>       trans.write([i32].pack('N'))
>     end

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (THRIFT-610) binary_protocol.rb segfaults [line 86]

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-610?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury closed THRIFT-610.
--------------------------------

    Resolution: Invalid

> binary_protocol.rb segfaults [line 86]
> --------------------------------------
>
>                 Key: THRIFT-610
>                 URL: https://issues.apache.org/jira/browse/THRIFT-610
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>    Affects Versions: 0.2
>         Environment: ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] - svn checkout
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0] - git HEAD
>            Reporter: Andrew Kuhnhausen
>             Fix For: 0.5
>
>         Attachments: doot.pl, membuf-ruby19-fix.patch, thrift-segfaul.rb
>
>
> output from irb 1.8
> /usr/local/lib/site_ruby/1.8/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
> output from irb 1.9
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0]
> -- control frame ----------
> c:0028 p:---- s:0114 b:0114 l:000113 d:000113 CFUNC  :write
> c:0027 p:0029 s:0110 b:0110 l:000109 d:000109 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86
> c:0026 p:0037 s:0106 b:0106 l:000105 d:000105 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38
> c:0025 p:0029 s:0100 b:0100 l:000099 d:000099 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29
> c:0024 p:0050 s:0092 b:0092 l:000091 d:000091 METHOD /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21
> c:0023 p:0045 s:0082 b:0082 l:000e28 d:001858 EVAL   (irb):11
> c:0022 p:---- s:0080 b:0080 l:000079 d:000079 FINISH
> c:0021 p:---- s:0078 b:0078 l:000077 d:000077 CFUNC  :eval
> c:0020 p:0027 s:0071 b:0071 l:000070 d:000070 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80
> c:0019 p:0031 s:0064 b:0063 l:000062 d:000062 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218
> c:0018 p:0030 s:0058 b:0058 l:001018 d:000057 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149
> c:0017 p:0037 s:0050 b:0050 l:000049 d:000049 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263
> c:0016 p:0011 s:0045 b:0045 l:001018 d:000044 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146
> c:0015 p:0132 s:0041 b:0041 l:000024 d:000040 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244
> c:0014 p:---- s:0038 b:0038 l:000037 d:000037 FINISH
> c:0013 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC  :loop
> c:0012 p:0009 s:0033 b:0033 l:000024 d:000032 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230
> c:0011 p:---- s:0031 b:0031 l:000030 d:000030 FINISH
> c:0010 p:---- s:0029 b:0029 l:000028 d:000028 CFUNC  :catch
> c:0009 p:0023 s:0025 b:0025 l:000024 d:000024 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229
> c:0008 p:0042 s:0022 b:0022 l:001018 d:001018 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145
> c:0007 p:0011 s:0019 b:0019 l:000f68 d:000018 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69
> c:0006 p:---- s:0017 b:0017 l:000016 d:000016 FINISH
> c:0005 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC  :catch
> c:0004 p:0172 s:0011 b:0011 l:000f68 d:000f68 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68
> c:0003 p:0039 s:0006 b:0006 l:001988 d:001a28 EVAL   /usr/local/ruby1.9/bin/irb:12
> c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
> c:0001 p:0000 s:0002 b:0002 l:001988 d:001988 TOP   
> ---------------------------
> -- Ruby level backtrace information-----------------------------------------
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write_i16'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38:in `write_message_begin'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29:in `send_message'
> /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21:in `send_create'
> (irb):11:in `irb_binding'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149:in `block (2 levels) in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263:in `signal_status'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146:in `block in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244:in `block (2 levels) in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `loop'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `block in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145:in `eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69:in `block in start'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `start'
> /usr/local/ruby1.9/bin/irb:12:in `<main>'
> -- C level backtrace information -------------------------------------------
> Line 21 of 'container.rb' (generated by thrift) is the method, send_create
>     def send_create(customerId, id, uuid, address, name, os, stack)
>       send_message('create', Create_args, :customerId => customerId, :id => id, :uuid => uuid, :address => address, :name => name, :os => os, :stack => stack)
>     end
> This is how the method 'send_create' is being called with irb1.9 output (basically the same as irb1.8 output just with great back tracing):
> buffer = Thrift::MemoryBufferTransport.new(1024)
>      ### => #<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>
> protocol = Thrift::BinaryProtocol.new(buffer)
>     ###<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>
> irb(main):009:0> client = Container::Client.new(protocol)
>     ###<Container::Client:0x000001011e8608 @iprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @oprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @seqid=0>
> ### send_create(customerId, id, uuid, address, name, os, stack)
> client.send_create(
>   '0000',
>   '0',
>   '00xxx0x0-x0x0-00xx-xx00-x000x0x0xx00',
>   'www.whateveraddy.com',
>   'thrift_container',
>   '0',
>   '1'
> )
> then the output from the top comes out with the segfault.
> the error line refers to this in binary_protocol.rb
>     def write_i16(i16)
>       trans.write([i16].pack('n'))
>     end
> if that is removed, it fails on:
>     def write_i32(i32)
>       raise RangeError if i32 < -2**31 || i32 >= 2**31
>       trans.write([i32].pack('N'))
>     end

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (THRIFT-610) binary_protocol.rb segfaults [line 86]

Posted by "Andrew Kuhnhausen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-610?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Kuhnhausen updated THRIFT-610:
-------------------------------------

    Attachment: doot.pl
                thrift-segfaul.rb

I have included the exact same script in Perl (translated, obviously) that works perfectly.

> binary_protocol.rb segfaults [line 86]
> --------------------------------------
>
>                 Key: THRIFT-610
>                 URL: https://issues.apache.org/jira/browse/THRIFT-610
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>    Affects Versions: 0.1, 0.2
>         Environment: ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] - svn checkout
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0] - git HEAD
>            Reporter: Andrew Kuhnhausen
>             Fix For: 0.1, 0.2
>
>         Attachments: doot.pl, thrift-segfaul.rb
>
>
> output from irb 1.8
> /usr/local/lib/site_ruby/1.8/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
> output from irb 1.9
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0]
> -- control frame ----------
> c:0028 p:---- s:0114 b:0114 l:000113 d:000113 CFUNC  :write
> c:0027 p:0029 s:0110 b:0110 l:000109 d:000109 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86
> c:0026 p:0037 s:0106 b:0106 l:000105 d:000105 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38
> c:0025 p:0029 s:0100 b:0100 l:000099 d:000099 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29
> c:0024 p:0050 s:0092 b:0092 l:000091 d:000091 METHOD /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21
> c:0023 p:0045 s:0082 b:0082 l:000e28 d:001858 EVAL   (irb):11
> c:0022 p:---- s:0080 b:0080 l:000079 d:000079 FINISH
> c:0021 p:---- s:0078 b:0078 l:000077 d:000077 CFUNC  :eval
> c:0020 p:0027 s:0071 b:0071 l:000070 d:000070 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80
> c:0019 p:0031 s:0064 b:0063 l:000062 d:000062 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218
> c:0018 p:0030 s:0058 b:0058 l:001018 d:000057 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149
> c:0017 p:0037 s:0050 b:0050 l:000049 d:000049 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263
> c:0016 p:0011 s:0045 b:0045 l:001018 d:000044 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146
> c:0015 p:0132 s:0041 b:0041 l:000024 d:000040 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244
> c:0014 p:---- s:0038 b:0038 l:000037 d:000037 FINISH
> c:0013 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC  :loop
> c:0012 p:0009 s:0033 b:0033 l:000024 d:000032 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230
> c:0011 p:---- s:0031 b:0031 l:000030 d:000030 FINISH
> c:0010 p:---- s:0029 b:0029 l:000028 d:000028 CFUNC  :catch
> c:0009 p:0023 s:0025 b:0025 l:000024 d:000024 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229
> c:0008 p:0042 s:0022 b:0022 l:001018 d:001018 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145
> c:0007 p:0011 s:0019 b:0019 l:000f68 d:000018 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69
> c:0006 p:---- s:0017 b:0017 l:000016 d:000016 FINISH
> c:0005 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC  :catch
> c:0004 p:0172 s:0011 b:0011 l:000f68 d:000f68 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68
> c:0003 p:0039 s:0006 b:0006 l:001988 d:001a28 EVAL   /usr/local/ruby1.9/bin/irb:12
> c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
> c:0001 p:0000 s:0002 b:0002 l:001988 d:001988 TOP   
> ---------------------------
> -- Ruby level backtrace information-----------------------------------------
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write_i16'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38:in `write_message_begin'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29:in `send_message'
> /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21:in `send_create'
> (irb):11:in `irb_binding'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149:in `block (2 levels) in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263:in `signal_status'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146:in `block in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244:in `block (2 levels) in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `loop'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `block in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145:in `eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69:in `block in start'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `start'
> /usr/local/ruby1.9/bin/irb:12:in `<main>'
> -- C level backtrace information -------------------------------------------
> Line 21 of 'container.rb' (generated by thrift) is the method, send_create
>     def send_create(customerId, id, uuid, address, name, os, stack)
>       send_message('create', Create_args, :customerId => customerId, :id => id, :uuid => uuid, :address => address, :name => name, :os => os, :stack => stack)
>     end
> This is how the method 'send_create' is being called with irb1.9 output (basically the same as irb1.8 output just with great back tracing):
> buffer = Thrift::MemoryBufferTransport.new(1024)
>      ### => #<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>
> protocol = Thrift::BinaryProtocol.new(buffer)
>     ###<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>
> irb(main):009:0> client = Container::Client.new(protocol)
>     ###<Container::Client:0x000001011e8608 @iprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @oprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @seqid=0>
> ### send_create(customerId, id, uuid, address, name, os, stack)
> client.send_create(
>   '0000',
>   '0',
>   '00xxx0x0-x0x0-00xx-xx00-x000x0x0xx00',
>   'www.whateveraddy.com',
>   'thrift_container',
>   '0',
>   '1'
> )
> then the output from the top comes out with the segfault.
> the error line refers to this in binary_protocol.rb
>     def write_i16(i16)
>       trans.write([i16].pack('n'))
>     end
> if that is removed, it fails on:
>     def write_i32(i32)
>       raise RangeError if i32 < -2**31 || i32 >= 2**31
>       trans.write([i32].pack('N'))
>     end

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-610) binary_protocol.rb segfaults [line 86]

Posted by "Rajesh Malepati (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12896609#action_12896609 ] 

Rajesh Malepati commented on THRIFT-610:
----------------------------------------

Actually, MemoryBufferTransport#write crashed (from ext/memory_buffer.c) not Array#pack
Crashes are usually unacceptable even on user error. Reopen? What do others think?

> binary_protocol.rb segfaults [line 86]
> --------------------------------------
>
>                 Key: THRIFT-610
>                 URL: https://issues.apache.org/jira/browse/THRIFT-610
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>    Affects Versions: 0.2
>         Environment: ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] - svn checkout
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0] - git HEAD
>            Reporter: Andrew Kuhnhausen
>             Fix For: 0.5
>
>         Attachments: doot.pl, membuf-ruby19-fix.patch, thrift-segfaul.rb
>
>
> output from irb 1.8
> /usr/local/lib/site_ruby/1.8/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
> output from irb 1.9
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0]
> -- control frame ----------
> c:0028 p:---- s:0114 b:0114 l:000113 d:000113 CFUNC  :write
> c:0027 p:0029 s:0110 b:0110 l:000109 d:000109 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86
> c:0026 p:0037 s:0106 b:0106 l:000105 d:000105 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38
> c:0025 p:0029 s:0100 b:0100 l:000099 d:000099 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29
> c:0024 p:0050 s:0092 b:0092 l:000091 d:000091 METHOD /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21
> c:0023 p:0045 s:0082 b:0082 l:000e28 d:001858 EVAL   (irb):11
> c:0022 p:---- s:0080 b:0080 l:000079 d:000079 FINISH
> c:0021 p:---- s:0078 b:0078 l:000077 d:000077 CFUNC  :eval
> c:0020 p:0027 s:0071 b:0071 l:000070 d:000070 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80
> c:0019 p:0031 s:0064 b:0063 l:000062 d:000062 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218
> c:0018 p:0030 s:0058 b:0058 l:001018 d:000057 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149
> c:0017 p:0037 s:0050 b:0050 l:000049 d:000049 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263
> c:0016 p:0011 s:0045 b:0045 l:001018 d:000044 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146
> c:0015 p:0132 s:0041 b:0041 l:000024 d:000040 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244
> c:0014 p:---- s:0038 b:0038 l:000037 d:000037 FINISH
> c:0013 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC  :loop
> c:0012 p:0009 s:0033 b:0033 l:000024 d:000032 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230
> c:0011 p:---- s:0031 b:0031 l:000030 d:000030 FINISH
> c:0010 p:---- s:0029 b:0029 l:000028 d:000028 CFUNC  :catch
> c:0009 p:0023 s:0025 b:0025 l:000024 d:000024 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229
> c:0008 p:0042 s:0022 b:0022 l:001018 d:001018 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145
> c:0007 p:0011 s:0019 b:0019 l:000f68 d:000018 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69
> c:0006 p:---- s:0017 b:0017 l:000016 d:000016 FINISH
> c:0005 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC  :catch
> c:0004 p:0172 s:0011 b:0011 l:000f68 d:000f68 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68
> c:0003 p:0039 s:0006 b:0006 l:001988 d:001a28 EVAL   /usr/local/ruby1.9/bin/irb:12
> c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
> c:0001 p:0000 s:0002 b:0002 l:001988 d:001988 TOP   
> ---------------------------
> -- Ruby level backtrace information-----------------------------------------
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write_i16'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38:in `write_message_begin'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29:in `send_message'
> /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21:in `send_create'
> (irb):11:in `irb_binding'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149:in `block (2 levels) in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263:in `signal_status'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146:in `block in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244:in `block (2 levels) in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `loop'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `block in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145:in `eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69:in `block in start'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `start'
> /usr/local/ruby1.9/bin/irb:12:in `<main>'
> -- C level backtrace information -------------------------------------------
> Line 21 of 'container.rb' (generated by thrift) is the method, send_create
>     def send_create(customerId, id, uuid, address, name, os, stack)
>       send_message('create', Create_args, :customerId => customerId, :id => id, :uuid => uuid, :address => address, :name => name, :os => os, :stack => stack)
>     end
> This is how the method 'send_create' is being called with irb1.9 output (basically the same as irb1.8 output just with great back tracing):
> buffer = Thrift::MemoryBufferTransport.new(1024)
>      ### => #<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>
> protocol = Thrift::BinaryProtocol.new(buffer)
>     ###<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>
> irb(main):009:0> client = Container::Client.new(protocol)
>     ###<Container::Client:0x000001011e8608 @iprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @oprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @seqid=0>
> ### send_create(customerId, id, uuid, address, name, os, stack)
> client.send_create(
>   '0000',
>   '0',
>   '00xxx0x0-x0x0-00xx-xx00-x000x0x0xx00',
>   'www.whateveraddy.com',
>   'thrift_container',
>   '0',
>   '1'
> )
> then the output from the top comes out with the segfault.
> the error line refers to this in binary_protocol.rb
>     def write_i16(i16)
>       trans.write([i16].pack('n'))
>     end
> if that is removed, it fails on:
>     def write_i32(i32)
>       raise RangeError if i32 < -2**31 || i32 >= 2**31
>       trans.write([i32].pack('N'))
>     end

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-610) binary_protocol.rb segfaults [line 86]

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12896589#action_12896589 ] 

Bryan Duxbury commented on THRIFT-610:
--------------------------------------

Ah, yes, it looks like you were passing a "size" to the constructor of the transport, when what it actually takes is an initial buffer value. This would certainly cause the native code extensions to segfault when it tried to call pack. Incidentally, calling length on the result of inspect_buffer will overestimate the size of the actual payload by something like 3x.

Rajesh, I'll commit your patch for fixing the inspect_buffer method.

> binary_protocol.rb segfaults [line 86]
> --------------------------------------
>
>                 Key: THRIFT-610
>                 URL: https://issues.apache.org/jira/browse/THRIFT-610
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>    Affects Versions: 0.2
>         Environment: ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] - svn checkout
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0] - git HEAD
>            Reporter: Andrew Kuhnhausen
>             Fix For: 0.5
>
>         Attachments: doot.pl, membuf-ruby19-fix.patch, thrift-segfaul.rb
>
>
> output from irb 1.8
> /usr/local/lib/site_ruby/1.8/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
> output from irb 1.9
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0]
> -- control frame ----------
> c:0028 p:---- s:0114 b:0114 l:000113 d:000113 CFUNC  :write
> c:0027 p:0029 s:0110 b:0110 l:000109 d:000109 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86
> c:0026 p:0037 s:0106 b:0106 l:000105 d:000105 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38
> c:0025 p:0029 s:0100 b:0100 l:000099 d:000099 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29
> c:0024 p:0050 s:0092 b:0092 l:000091 d:000091 METHOD /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21
> c:0023 p:0045 s:0082 b:0082 l:000e28 d:001858 EVAL   (irb):11
> c:0022 p:---- s:0080 b:0080 l:000079 d:000079 FINISH
> c:0021 p:---- s:0078 b:0078 l:000077 d:000077 CFUNC  :eval
> c:0020 p:0027 s:0071 b:0071 l:000070 d:000070 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80
> c:0019 p:0031 s:0064 b:0063 l:000062 d:000062 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218
> c:0018 p:0030 s:0058 b:0058 l:001018 d:000057 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149
> c:0017 p:0037 s:0050 b:0050 l:000049 d:000049 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263
> c:0016 p:0011 s:0045 b:0045 l:001018 d:000044 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146
> c:0015 p:0132 s:0041 b:0041 l:000024 d:000040 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244
> c:0014 p:---- s:0038 b:0038 l:000037 d:000037 FINISH
> c:0013 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC  :loop
> c:0012 p:0009 s:0033 b:0033 l:000024 d:000032 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230
> c:0011 p:---- s:0031 b:0031 l:000030 d:000030 FINISH
> c:0010 p:---- s:0029 b:0029 l:000028 d:000028 CFUNC  :catch
> c:0009 p:0023 s:0025 b:0025 l:000024 d:000024 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229
> c:0008 p:0042 s:0022 b:0022 l:001018 d:001018 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145
> c:0007 p:0011 s:0019 b:0019 l:000f68 d:000018 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69
> c:0006 p:---- s:0017 b:0017 l:000016 d:000016 FINISH
> c:0005 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC  :catch
> c:0004 p:0172 s:0011 b:0011 l:000f68 d:000f68 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68
> c:0003 p:0039 s:0006 b:0006 l:001988 d:001a28 EVAL   /usr/local/ruby1.9/bin/irb:12
> c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
> c:0001 p:0000 s:0002 b:0002 l:001988 d:001988 TOP   
> ---------------------------
> -- Ruby level backtrace information-----------------------------------------
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write_i16'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38:in `write_message_begin'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29:in `send_message'
> /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21:in `send_create'
> (irb):11:in `irb_binding'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149:in `block (2 levels) in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263:in `signal_status'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146:in `block in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244:in `block (2 levels) in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `loop'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `block in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145:in `eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69:in `block in start'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `start'
> /usr/local/ruby1.9/bin/irb:12:in `<main>'
> -- C level backtrace information -------------------------------------------
> Line 21 of 'container.rb' (generated by thrift) is the method, send_create
>     def send_create(customerId, id, uuid, address, name, os, stack)
>       send_message('create', Create_args, :customerId => customerId, :id => id, :uuid => uuid, :address => address, :name => name, :os => os, :stack => stack)
>     end
> This is how the method 'send_create' is being called with irb1.9 output (basically the same as irb1.8 output just with great back tracing):
> buffer = Thrift::MemoryBufferTransport.new(1024)
>      ### => #<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>
> protocol = Thrift::BinaryProtocol.new(buffer)
>     ###<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>
> irb(main):009:0> client = Container::Client.new(protocol)
>     ###<Container::Client:0x000001011e8608 @iprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @oprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @seqid=0>
> ### send_create(customerId, id, uuid, address, name, os, stack)
> client.send_create(
>   '0000',
>   '0',
>   '00xxx0x0-x0x0-00xx-xx00-x000x0x0xx00',
>   'www.whateveraddy.com',
>   'thrift_container',
>   '0',
>   '1'
> )
> then the output from the top comes out with the segfault.
> the error line refers to this in binary_protocol.rb
>     def write_i16(i16)
>       trans.write([i16].pack('n'))
>     end
> if that is removed, it fails on:
>     def write_i32(i32)
>       raise RangeError if i32 < -2**31 || i32 >= 2**31
>       trans.write([i32].pack('N'))
>     end

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-610) binary_protocol.rb segfaults [line 86]

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12896611#action_12896611 ] 

Bryan Duxbury commented on THRIFT-610:
--------------------------------------

Maybe I got the specifics wrong, but it's the same underlying problem: all the code assumes that the @buf is a string, so calling string methods on it will lead to problems. We could add in type checking, but I think that would be a somewhat expensive path to take.

> binary_protocol.rb segfaults [line 86]
> --------------------------------------
>
>                 Key: THRIFT-610
>                 URL: https://issues.apache.org/jira/browse/THRIFT-610
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>    Affects Versions: 0.2
>         Environment: ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] - svn checkout
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0] - git HEAD
>            Reporter: Andrew Kuhnhausen
>             Fix For: 0.5
>
>         Attachments: doot.pl, membuf-ruby19-fix.patch, thrift-segfaul.rb
>
>
> output from irb 1.8
> /usr/local/lib/site_ruby/1.8/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
> output from irb 1.9
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0]
> -- control frame ----------
> c:0028 p:---- s:0114 b:0114 l:000113 d:000113 CFUNC  :write
> c:0027 p:0029 s:0110 b:0110 l:000109 d:000109 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86
> c:0026 p:0037 s:0106 b:0106 l:000105 d:000105 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38
> c:0025 p:0029 s:0100 b:0100 l:000099 d:000099 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29
> c:0024 p:0050 s:0092 b:0092 l:000091 d:000091 METHOD /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21
> c:0023 p:0045 s:0082 b:0082 l:000e28 d:001858 EVAL   (irb):11
> c:0022 p:---- s:0080 b:0080 l:000079 d:000079 FINISH
> c:0021 p:---- s:0078 b:0078 l:000077 d:000077 CFUNC  :eval
> c:0020 p:0027 s:0071 b:0071 l:000070 d:000070 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80
> c:0019 p:0031 s:0064 b:0063 l:000062 d:000062 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218
> c:0018 p:0030 s:0058 b:0058 l:001018 d:000057 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149
> c:0017 p:0037 s:0050 b:0050 l:000049 d:000049 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263
> c:0016 p:0011 s:0045 b:0045 l:001018 d:000044 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146
> c:0015 p:0132 s:0041 b:0041 l:000024 d:000040 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244
> c:0014 p:---- s:0038 b:0038 l:000037 d:000037 FINISH
> c:0013 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC  :loop
> c:0012 p:0009 s:0033 b:0033 l:000024 d:000032 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230
> c:0011 p:---- s:0031 b:0031 l:000030 d:000030 FINISH
> c:0010 p:---- s:0029 b:0029 l:000028 d:000028 CFUNC  :catch
> c:0009 p:0023 s:0025 b:0025 l:000024 d:000024 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229
> c:0008 p:0042 s:0022 b:0022 l:001018 d:001018 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145
> c:0007 p:0011 s:0019 b:0019 l:000f68 d:000018 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69
> c:0006 p:---- s:0017 b:0017 l:000016 d:000016 FINISH
> c:0005 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC  :catch
> c:0004 p:0172 s:0011 b:0011 l:000f68 d:000f68 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68
> c:0003 p:0039 s:0006 b:0006 l:001988 d:001a28 EVAL   /usr/local/ruby1.9/bin/irb:12
> c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
> c:0001 p:0000 s:0002 b:0002 l:001988 d:001988 TOP   
> ---------------------------
> -- Ruby level backtrace information-----------------------------------------
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write_i16'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38:in `write_message_begin'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29:in `send_message'
> /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21:in `send_create'
> (irb):11:in `irb_binding'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149:in `block (2 levels) in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263:in `signal_status'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146:in `block in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244:in `block (2 levels) in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `loop'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `block in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145:in `eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69:in `block in start'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `start'
> /usr/local/ruby1.9/bin/irb:12:in `<main>'
> -- C level backtrace information -------------------------------------------
> Line 21 of 'container.rb' (generated by thrift) is the method, send_create
>     def send_create(customerId, id, uuid, address, name, os, stack)
>       send_message('create', Create_args, :customerId => customerId, :id => id, :uuid => uuid, :address => address, :name => name, :os => os, :stack => stack)
>     end
> This is how the method 'send_create' is being called with irb1.9 output (basically the same as irb1.8 output just with great back tracing):
> buffer = Thrift::MemoryBufferTransport.new(1024)
>      ### => #<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>
> protocol = Thrift::BinaryProtocol.new(buffer)
>     ###<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>
> irb(main):009:0> client = Container::Client.new(protocol)
>     ###<Container::Client:0x000001011e8608 @iprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @oprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @seqid=0>
> ### send_create(customerId, id, uuid, address, name, os, stack)
> client.send_create(
>   '0000',
>   '0',
>   '00xxx0x0-x0x0-00xx-xx00-x000x0x0xx00',
>   'www.whateveraddy.com',
>   'thrift_container',
>   '0',
>   '1'
> )
> then the output from the top comes out with the segfault.
> the error line refers to this in binary_protocol.rb
>     def write_i16(i16)
>       trans.write([i16].pack('n'))
>     end
> if that is removed, it fails on:
>     def write_i32(i32)
>       raise RangeError if i32 < -2**31 || i32 >= 2**31
>       trans.write([i32].pack('N'))
>     end

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (THRIFT-610) binary_protocol.rb segfaults [line 86]

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-610?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury updated THRIFT-610:
---------------------------------

    Fix Version/s: 0.4
                       (was: 0.3)

> binary_protocol.rb segfaults [line 86]
> --------------------------------------
>
>                 Key: THRIFT-610
>                 URL: https://issues.apache.org/jira/browse/THRIFT-610
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>    Affects Versions: 0.2
>         Environment: ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] - svn checkout
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0] - git HEAD
>            Reporter: Andrew Kuhnhausen
>             Fix For: 0.4
>
>         Attachments: doot.pl, thrift-segfaul.rb
>
>
> output from irb 1.8
> /usr/local/lib/site_ruby/1.8/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
> output from irb 1.9
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0]
> -- control frame ----------
> c:0028 p:---- s:0114 b:0114 l:000113 d:000113 CFUNC  :write
> c:0027 p:0029 s:0110 b:0110 l:000109 d:000109 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86
> c:0026 p:0037 s:0106 b:0106 l:000105 d:000105 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38
> c:0025 p:0029 s:0100 b:0100 l:000099 d:000099 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29
> c:0024 p:0050 s:0092 b:0092 l:000091 d:000091 METHOD /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21
> c:0023 p:0045 s:0082 b:0082 l:000e28 d:001858 EVAL   (irb):11
> c:0022 p:---- s:0080 b:0080 l:000079 d:000079 FINISH
> c:0021 p:---- s:0078 b:0078 l:000077 d:000077 CFUNC  :eval
> c:0020 p:0027 s:0071 b:0071 l:000070 d:000070 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80
> c:0019 p:0031 s:0064 b:0063 l:000062 d:000062 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218
> c:0018 p:0030 s:0058 b:0058 l:001018 d:000057 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149
> c:0017 p:0037 s:0050 b:0050 l:000049 d:000049 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263
> c:0016 p:0011 s:0045 b:0045 l:001018 d:000044 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146
> c:0015 p:0132 s:0041 b:0041 l:000024 d:000040 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244
> c:0014 p:---- s:0038 b:0038 l:000037 d:000037 FINISH
> c:0013 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC  :loop
> c:0012 p:0009 s:0033 b:0033 l:000024 d:000032 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230
> c:0011 p:---- s:0031 b:0031 l:000030 d:000030 FINISH
> c:0010 p:---- s:0029 b:0029 l:000028 d:000028 CFUNC  :catch
> c:0009 p:0023 s:0025 b:0025 l:000024 d:000024 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229
> c:0008 p:0042 s:0022 b:0022 l:001018 d:001018 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145
> c:0007 p:0011 s:0019 b:0019 l:000f68 d:000018 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69
> c:0006 p:---- s:0017 b:0017 l:000016 d:000016 FINISH
> c:0005 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC  :catch
> c:0004 p:0172 s:0011 b:0011 l:000f68 d:000f68 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68
> c:0003 p:0039 s:0006 b:0006 l:001988 d:001a28 EVAL   /usr/local/ruby1.9/bin/irb:12
> c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
> c:0001 p:0000 s:0002 b:0002 l:001988 d:001988 TOP   
> ---------------------------
> -- Ruby level backtrace information-----------------------------------------
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write_i16'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38:in `write_message_begin'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29:in `send_message'
> /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21:in `send_create'
> (irb):11:in `irb_binding'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149:in `block (2 levels) in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263:in `signal_status'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146:in `block in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244:in `block (2 levels) in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `loop'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `block in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145:in `eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69:in `block in start'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `start'
> /usr/local/ruby1.9/bin/irb:12:in `<main>'
> -- C level backtrace information -------------------------------------------
> Line 21 of 'container.rb' (generated by thrift) is the method, send_create
>     def send_create(customerId, id, uuid, address, name, os, stack)
>       send_message('create', Create_args, :customerId => customerId, :id => id, :uuid => uuid, :address => address, :name => name, :os => os, :stack => stack)
>     end
> This is how the method 'send_create' is being called with irb1.9 output (basically the same as irb1.8 output just with great back tracing):
> buffer = Thrift::MemoryBufferTransport.new(1024)
>      ### => #<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>
> protocol = Thrift::BinaryProtocol.new(buffer)
>     ###<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>
> irb(main):009:0> client = Container::Client.new(protocol)
>     ###<Container::Client:0x000001011e8608 @iprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @oprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @seqid=0>
> ### send_create(customerId, id, uuid, address, name, os, stack)
> client.send_create(
>   '0000',
>   '0',
>   '00xxx0x0-x0x0-00xx-xx00-x000x0x0xx00',
>   'www.whateveraddy.com',
>   'thrift_container',
>   '0',
>   '1'
> )
> then the output from the top comes out with the segfault.
> the error line refers to this in binary_protocol.rb
>     def write_i16(i16)
>       trans.write([i16].pack('n'))
>     end
> if that is removed, it fails on:
>     def write_i32(i32)
>       raise RangeError if i32 < -2**31 || i32 >= 2**31
>       trans.write([i32].pack('N'))
>     end

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-610) binary_protocol.rb segfaults [line 86]

Posted by "Andrew Kuhnhausen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12768461#action_12768461 ] 

Andrew Kuhnhausen commented on THRIFT-610:
------------------------------------------

looks like removing the buffer value argument fixes the issue in ruby 1.8.7 (still fails, but doesn't segfault in 1.9.1)... but why it segfaults in ruby when there is one specified, i'm not sure.

code for Ruby 1.8.7 and 1.9.1 (same, with results below for both)
$:.push('../gen-rb')
require 'thrift'
require 'stackable_constants'
require 'common'
require 'container'

# set vars to generate thrift payload to send over AMQP
buffer = Thrift::MemoryBufferTransport.new()
protocol = Thrift::BinaryProtocol.new(buffer)
client = Container::Client.new(protocol)

client.send_create(
  0000,
  0,
  '00baa0a0-b0d0-00de-bf00-d000e0d0ff00',
  'doot.domain.com',
  'thrift_container1',
  ::ContainerOS::CentOS_5_x86_64,
  ::ContainerStack::LAMP
)

puts "Thrift binary payload is #{buffer.inspect_buffer.length} in size"

##RUBY 1.8.7##
=>Thrift binary payload is 370 in size

##RUBY 1.9.1##
/usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/transport/memory_buffer_transport.rb:91:in `to_s': wrong number of arguments(1 for 0) (ArgumentError)
        from /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/transport/memory_buffer_transport.rb:91:in `block in inspect_buffer'
        from /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/transport/memory_buffer_transport.rb:82:in `each'
        from /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/transport/memory_buffer_transport.rb:82:in `inspect_buffer'
        from stack.rb:37:in `<main>'


> binary_protocol.rb segfaults [line 86]
> --------------------------------------
>
>                 Key: THRIFT-610
>                 URL: https://issues.apache.org/jira/browse/THRIFT-610
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>    Affects Versions: 0.1, 0.2
>         Environment: ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] - svn checkout
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0] - git HEAD
>            Reporter: Andrew Kuhnhausen
>             Fix For: 0.1, 0.2
>
>         Attachments: doot.pl, thrift-segfaul.rb
>
>
> output from irb 1.8
> /usr/local/lib/site_ruby/1.8/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
> output from irb 1.9
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0]
> -- control frame ----------
> c:0028 p:---- s:0114 b:0114 l:000113 d:000113 CFUNC  :write
> c:0027 p:0029 s:0110 b:0110 l:000109 d:000109 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86
> c:0026 p:0037 s:0106 b:0106 l:000105 d:000105 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38
> c:0025 p:0029 s:0100 b:0100 l:000099 d:000099 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29
> c:0024 p:0050 s:0092 b:0092 l:000091 d:000091 METHOD /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21
> c:0023 p:0045 s:0082 b:0082 l:000e28 d:001858 EVAL   (irb):11
> c:0022 p:---- s:0080 b:0080 l:000079 d:000079 FINISH
> c:0021 p:---- s:0078 b:0078 l:000077 d:000077 CFUNC  :eval
> c:0020 p:0027 s:0071 b:0071 l:000070 d:000070 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80
> c:0019 p:0031 s:0064 b:0063 l:000062 d:000062 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218
> c:0018 p:0030 s:0058 b:0058 l:001018 d:000057 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149
> c:0017 p:0037 s:0050 b:0050 l:000049 d:000049 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263
> c:0016 p:0011 s:0045 b:0045 l:001018 d:000044 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146
> c:0015 p:0132 s:0041 b:0041 l:000024 d:000040 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244
> c:0014 p:---- s:0038 b:0038 l:000037 d:000037 FINISH
> c:0013 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC  :loop
> c:0012 p:0009 s:0033 b:0033 l:000024 d:000032 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230
> c:0011 p:---- s:0031 b:0031 l:000030 d:000030 FINISH
> c:0010 p:---- s:0029 b:0029 l:000028 d:000028 CFUNC  :catch
> c:0009 p:0023 s:0025 b:0025 l:000024 d:000024 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229
> c:0008 p:0042 s:0022 b:0022 l:001018 d:001018 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145
> c:0007 p:0011 s:0019 b:0019 l:000f68 d:000018 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69
> c:0006 p:---- s:0017 b:0017 l:000016 d:000016 FINISH
> c:0005 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC  :catch
> c:0004 p:0172 s:0011 b:0011 l:000f68 d:000f68 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68
> c:0003 p:0039 s:0006 b:0006 l:001988 d:001a28 EVAL   /usr/local/ruby1.9/bin/irb:12
> c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
> c:0001 p:0000 s:0002 b:0002 l:001988 d:001988 TOP   
> ---------------------------
> -- Ruby level backtrace information-----------------------------------------
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write_i16'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38:in `write_message_begin'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29:in `send_message'
> /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21:in `send_create'
> (irb):11:in `irb_binding'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149:in `block (2 levels) in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263:in `signal_status'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146:in `block in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244:in `block (2 levels) in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `loop'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `block in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145:in `eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69:in `block in start'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `start'
> /usr/local/ruby1.9/bin/irb:12:in `<main>'
> -- C level backtrace information -------------------------------------------
> Line 21 of 'container.rb' (generated by thrift) is the method, send_create
>     def send_create(customerId, id, uuid, address, name, os, stack)
>       send_message('create', Create_args, :customerId => customerId, :id => id, :uuid => uuid, :address => address, :name => name, :os => os, :stack => stack)
>     end
> This is how the method 'send_create' is being called with irb1.9 output (basically the same as irb1.8 output just with great back tracing):
> buffer = Thrift::MemoryBufferTransport.new(1024)
>      ### => #<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>
> protocol = Thrift::BinaryProtocol.new(buffer)
>     ###<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>
> irb(main):009:0> client = Container::Client.new(protocol)
>     ###<Container::Client:0x000001011e8608 @iprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @oprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @seqid=0>
> ### send_create(customerId, id, uuid, address, name, os, stack)
> client.send_create(
>   '0000',
>   '0',
>   '00xxx0x0-x0x0-00xx-xx00-x000x0x0xx00',
>   'www.whateveraddy.com',
>   'thrift_container',
>   '0',
>   '1'
> )
> then the output from the top comes out with the segfault.
> the error line refers to this in binary_protocol.rb
>     def write_i16(i16)
>       trans.write([i16].pack('n'))
>     end
> if that is removed, it fails on:
>     def write_i32(i32)
>       raise RangeError if i32 < -2**31 || i32 >= 2**31
>       trans.write([i32].pack('N'))
>     end

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-610) binary_protocol.rb segfaults [line 86]

Posted by "Rajesh Malepati (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12896419#action_12896419 ] 

Rajesh Malepati commented on THRIFT-610:
----------------------------------------

I meant to say 'Fixnum#ord is NOT available in Ruby 1.8.6'

> binary_protocol.rb segfaults [line 86]
> --------------------------------------
>
>                 Key: THRIFT-610
>                 URL: https://issues.apache.org/jira/browse/THRIFT-610
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>    Affects Versions: 0.2
>         Environment: ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] - svn checkout
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0] - git HEAD
>            Reporter: Andrew Kuhnhausen
>             Fix For: 0.5
>
>         Attachments: doot.pl, membuf-ruby19-fix.patch, thrift-segfaul.rb
>
>
> output from irb 1.8
> /usr/local/lib/site_ruby/1.8/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
> output from irb 1.9
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0]
> -- control frame ----------
> c:0028 p:---- s:0114 b:0114 l:000113 d:000113 CFUNC  :write
> c:0027 p:0029 s:0110 b:0110 l:000109 d:000109 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86
> c:0026 p:0037 s:0106 b:0106 l:000105 d:000105 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38
> c:0025 p:0029 s:0100 b:0100 l:000099 d:000099 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29
> c:0024 p:0050 s:0092 b:0092 l:000091 d:000091 METHOD /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21
> c:0023 p:0045 s:0082 b:0082 l:000e28 d:001858 EVAL   (irb):11
> c:0022 p:---- s:0080 b:0080 l:000079 d:000079 FINISH
> c:0021 p:---- s:0078 b:0078 l:000077 d:000077 CFUNC  :eval
> c:0020 p:0027 s:0071 b:0071 l:000070 d:000070 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80
> c:0019 p:0031 s:0064 b:0063 l:000062 d:000062 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218
> c:0018 p:0030 s:0058 b:0058 l:001018 d:000057 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149
> c:0017 p:0037 s:0050 b:0050 l:000049 d:000049 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263
> c:0016 p:0011 s:0045 b:0045 l:001018 d:000044 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146
> c:0015 p:0132 s:0041 b:0041 l:000024 d:000040 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244
> c:0014 p:---- s:0038 b:0038 l:000037 d:000037 FINISH
> c:0013 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC  :loop
> c:0012 p:0009 s:0033 b:0033 l:000024 d:000032 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230
> c:0011 p:---- s:0031 b:0031 l:000030 d:000030 FINISH
> c:0010 p:---- s:0029 b:0029 l:000028 d:000028 CFUNC  :catch
> c:0009 p:0023 s:0025 b:0025 l:000024 d:000024 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229
> c:0008 p:0042 s:0022 b:0022 l:001018 d:001018 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145
> c:0007 p:0011 s:0019 b:0019 l:000f68 d:000018 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69
> c:0006 p:---- s:0017 b:0017 l:000016 d:000016 FINISH
> c:0005 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC  :catch
> c:0004 p:0172 s:0011 b:0011 l:000f68 d:000f68 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68
> c:0003 p:0039 s:0006 b:0006 l:001988 d:001a28 EVAL   /usr/local/ruby1.9/bin/irb:12
> c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
> c:0001 p:0000 s:0002 b:0002 l:001988 d:001988 TOP   
> ---------------------------
> -- Ruby level backtrace information-----------------------------------------
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write_i16'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38:in `write_message_begin'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29:in `send_message'
> /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21:in `send_create'
> (irb):11:in `irb_binding'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149:in `block (2 levels) in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263:in `signal_status'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146:in `block in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244:in `block (2 levels) in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `loop'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `block in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145:in `eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69:in `block in start'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `start'
> /usr/local/ruby1.9/bin/irb:12:in `<main>'
> -- C level backtrace information -------------------------------------------
> Line 21 of 'container.rb' (generated by thrift) is the method, send_create
>     def send_create(customerId, id, uuid, address, name, os, stack)
>       send_message('create', Create_args, :customerId => customerId, :id => id, :uuid => uuid, :address => address, :name => name, :os => os, :stack => stack)
>     end
> This is how the method 'send_create' is being called with irb1.9 output (basically the same as irb1.8 output just with great back tracing):
> buffer = Thrift::MemoryBufferTransport.new(1024)
>      ### => #<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>
> protocol = Thrift::BinaryProtocol.new(buffer)
>     ###<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>
> irb(main):009:0> client = Container::Client.new(protocol)
>     ###<Container::Client:0x000001011e8608 @iprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @oprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @seqid=0>
> ### send_create(customerId, id, uuid, address, name, os, stack)
> client.send_create(
>   '0000',
>   '0',
>   '00xxx0x0-x0x0-00xx-xx00-x000x0x0xx00',
>   'www.whateveraddy.com',
>   'thrift_container',
>   '0',
>   '1'
> )
> then the output from the top comes out with the segfault.
> the error line refers to this in binary_protocol.rb
>     def write_i16(i16)
>       trans.write([i16].pack('n'))
>     end
> if that is removed, it fails on:
>     def write_i32(i32)
>       raise RangeError if i32 < -2**31 || i32 >= 2**31
>       trans.write([i32].pack('N'))
>     end

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-610) binary_protocol.rb segfaults [line 86]

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12768103#action_12768103 ] 

Bryan Duxbury commented on THRIFT-610:
--------------------------------------

Sorry if this is clear from your report, but are you calling send_create directly? That's not a common pattern. Can you attach the actual code you're executing?

> binary_protocol.rb segfaults [line 86]
> --------------------------------------
>
>                 Key: THRIFT-610
>                 URL: https://issues.apache.org/jira/browse/THRIFT-610
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>    Affects Versions: 0.1, 0.2
>         Environment: ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] - svn checkout
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0] - git HEAD
>            Reporter: Andrew Kuhnhausen
>             Fix For: 0.1, 0.2
>
>
> output from irb 1.8
> /usr/local/lib/site_ruby/1.8/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
> output from irb 1.9
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0]
> -- control frame ----------
> c:0028 p:---- s:0114 b:0114 l:000113 d:000113 CFUNC  :write
> c:0027 p:0029 s:0110 b:0110 l:000109 d:000109 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86
> c:0026 p:0037 s:0106 b:0106 l:000105 d:000105 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38
> c:0025 p:0029 s:0100 b:0100 l:000099 d:000099 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29
> c:0024 p:0050 s:0092 b:0092 l:000091 d:000091 METHOD /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21
> c:0023 p:0045 s:0082 b:0082 l:000e28 d:001858 EVAL   (irb):11
> c:0022 p:---- s:0080 b:0080 l:000079 d:000079 FINISH
> c:0021 p:---- s:0078 b:0078 l:000077 d:000077 CFUNC  :eval
> c:0020 p:0027 s:0071 b:0071 l:000070 d:000070 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80
> c:0019 p:0031 s:0064 b:0063 l:000062 d:000062 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218
> c:0018 p:0030 s:0058 b:0058 l:001018 d:000057 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149
> c:0017 p:0037 s:0050 b:0050 l:000049 d:000049 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263
> c:0016 p:0011 s:0045 b:0045 l:001018 d:000044 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146
> c:0015 p:0132 s:0041 b:0041 l:000024 d:000040 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244
> c:0014 p:---- s:0038 b:0038 l:000037 d:000037 FINISH
> c:0013 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC  :loop
> c:0012 p:0009 s:0033 b:0033 l:000024 d:000032 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230
> c:0011 p:---- s:0031 b:0031 l:000030 d:000030 FINISH
> c:0010 p:---- s:0029 b:0029 l:000028 d:000028 CFUNC  :catch
> c:0009 p:0023 s:0025 b:0025 l:000024 d:000024 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229
> c:0008 p:0042 s:0022 b:0022 l:001018 d:001018 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145
> c:0007 p:0011 s:0019 b:0019 l:000f68 d:000018 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69
> c:0006 p:---- s:0017 b:0017 l:000016 d:000016 FINISH
> c:0005 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC  :catch
> c:0004 p:0172 s:0011 b:0011 l:000f68 d:000f68 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68
> c:0003 p:0039 s:0006 b:0006 l:001988 d:001a28 EVAL   /usr/local/ruby1.9/bin/irb:12
> c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
> c:0001 p:0000 s:0002 b:0002 l:001988 d:001988 TOP   
> ---------------------------
> -- Ruby level backtrace information-----------------------------------------
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write_i16'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38:in `write_message_begin'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29:in `send_message'
> /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21:in `send_create'
> (irb):11:in `irb_binding'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149:in `block (2 levels) in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263:in `signal_status'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146:in `block in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244:in `block (2 levels) in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `loop'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `block in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145:in `eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69:in `block in start'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `start'
> /usr/local/ruby1.9/bin/irb:12:in `<main>'
> -- C level backtrace information -------------------------------------------
> Line 21 of 'container.rb' (generated by thrift) is the method, send_create
>     def send_create(customerId, id, uuid, address, name, os, stack)
>       send_message('create', Create_args, :customerId => customerId, :id => id, :uuid => uuid, :address => address, :name => name, :os => os, :stack => stack)
>     end
> This is how the method 'send_create' is being called with irb1.9 output (basically the same as irb1.8 output just with great back tracing):
> buffer = Thrift::MemoryBufferTransport.new(1024)
>      ### => #<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>
> protocol = Thrift::BinaryProtocol.new(buffer)
>     ###<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>
> irb(main):009:0> client = Container::Client.new(protocol)
>     ###<Container::Client:0x000001011e8608 @iprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @oprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @seqid=0>
> ### send_create(customerId, id, uuid, address, name, os, stack)
> client.send_create(
>   '0000',
>   '0',
>   '00xxx0x0-x0x0-00xx-xx00-x000x0x0xx00',
>   'www.whateveraddy.com',
>   'thrift_container',
>   '0',
>   '1'
> )
> then the output from the top comes out with the segfault.
> the error line refers to this in binary_protocol.rb
>     def write_i16(i16)
>       trans.write([i16].pack('n'))
>     end
> if that is removed, it fails on:
>     def write_i32(i32)
>       raise RangeError if i32 < -2**31 || i32 >= 2**31
>       trans.write([i32].pack('N'))
>     end

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (THRIFT-610) binary_protocol.rb segfaults [line 86]

Posted by "Andrew Kuhnhausen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12768264#action_12768264 ] 

Andrew Kuhnhausen edited comment on THRIFT-610 at 10/21/09 3:02 PM:
--------------------------------------------------------------------

i'm not using the standard pattern (because we are using the thrift libs to generate an opaque binary block of data that we will transmit and handle separately)

I have included the exact same script in Perl (translated, obviously) that works perfectly.

      was (Author: trane):
    I have included the exact same script in Perl (translated, obviously) that works perfectly.
  
> binary_protocol.rb segfaults [line 86]
> --------------------------------------
>
>                 Key: THRIFT-610
>                 URL: https://issues.apache.org/jira/browse/THRIFT-610
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>    Affects Versions: 0.1, 0.2
>         Environment: ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] - svn checkout
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0] - git HEAD
>            Reporter: Andrew Kuhnhausen
>             Fix For: 0.1, 0.2
>
>         Attachments: doot.pl, thrift-segfaul.rb
>
>
> output from irb 1.8
> /usr/local/lib/site_ruby/1.8/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
> output from irb 1.9
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0]
> -- control frame ----------
> c:0028 p:---- s:0114 b:0114 l:000113 d:000113 CFUNC  :write
> c:0027 p:0029 s:0110 b:0110 l:000109 d:000109 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86
> c:0026 p:0037 s:0106 b:0106 l:000105 d:000105 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38
> c:0025 p:0029 s:0100 b:0100 l:000099 d:000099 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29
> c:0024 p:0050 s:0092 b:0092 l:000091 d:000091 METHOD /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21
> c:0023 p:0045 s:0082 b:0082 l:000e28 d:001858 EVAL   (irb):11
> c:0022 p:---- s:0080 b:0080 l:000079 d:000079 FINISH
> c:0021 p:---- s:0078 b:0078 l:000077 d:000077 CFUNC  :eval
> c:0020 p:0027 s:0071 b:0071 l:000070 d:000070 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80
> c:0019 p:0031 s:0064 b:0063 l:000062 d:000062 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218
> c:0018 p:0030 s:0058 b:0058 l:001018 d:000057 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149
> c:0017 p:0037 s:0050 b:0050 l:000049 d:000049 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263
> c:0016 p:0011 s:0045 b:0045 l:001018 d:000044 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146
> c:0015 p:0132 s:0041 b:0041 l:000024 d:000040 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244
> c:0014 p:---- s:0038 b:0038 l:000037 d:000037 FINISH
> c:0013 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC  :loop
> c:0012 p:0009 s:0033 b:0033 l:000024 d:000032 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230
> c:0011 p:---- s:0031 b:0031 l:000030 d:000030 FINISH
> c:0010 p:---- s:0029 b:0029 l:000028 d:000028 CFUNC  :catch
> c:0009 p:0023 s:0025 b:0025 l:000024 d:000024 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229
> c:0008 p:0042 s:0022 b:0022 l:001018 d:001018 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145
> c:0007 p:0011 s:0019 b:0019 l:000f68 d:000018 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69
> c:0006 p:---- s:0017 b:0017 l:000016 d:000016 FINISH
> c:0005 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC  :catch
> c:0004 p:0172 s:0011 b:0011 l:000f68 d:000f68 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68
> c:0003 p:0039 s:0006 b:0006 l:001988 d:001a28 EVAL   /usr/local/ruby1.9/bin/irb:12
> c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
> c:0001 p:0000 s:0002 b:0002 l:001988 d:001988 TOP   
> ---------------------------
> -- Ruby level backtrace information-----------------------------------------
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write_i16'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38:in `write_message_begin'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29:in `send_message'
> /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21:in `send_create'
> (irb):11:in `irb_binding'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149:in `block (2 levels) in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263:in `signal_status'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146:in `block in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244:in `block (2 levels) in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `loop'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `block in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145:in `eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69:in `block in start'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `start'
> /usr/local/ruby1.9/bin/irb:12:in `<main>'
> -- C level backtrace information -------------------------------------------
> Line 21 of 'container.rb' (generated by thrift) is the method, send_create
>     def send_create(customerId, id, uuid, address, name, os, stack)
>       send_message('create', Create_args, :customerId => customerId, :id => id, :uuid => uuid, :address => address, :name => name, :os => os, :stack => stack)
>     end
> This is how the method 'send_create' is being called with irb1.9 output (basically the same as irb1.8 output just with great back tracing):
> buffer = Thrift::MemoryBufferTransport.new(1024)
>      ### => #<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>
> protocol = Thrift::BinaryProtocol.new(buffer)
>     ###<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>
> irb(main):009:0> client = Container::Client.new(protocol)
>     ###<Container::Client:0x000001011e8608 @iprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @oprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @seqid=0>
> ### send_create(customerId, id, uuid, address, name, os, stack)
> client.send_create(
>   '0000',
>   '0',
>   '00xxx0x0-x0x0-00xx-xx00-x000x0x0xx00',
>   'www.whateveraddy.com',
>   'thrift_container',
>   '0',
>   '1'
> )
> then the output from the top comes out with the segfault.
> the error line refers to this in binary_protocol.rb
>     def write_i16(i16)
>       trans.write([i16].pack('n'))
>     end
> if that is removed, it fails on:
>     def write_i32(i32)
>       raise RangeError if i32 < -2**31 || i32 >= 2**31
>       trans.write([i32].pack('N'))
>     end

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (THRIFT-610) binary_protocol.rb segfaults [line 86]

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-610?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury updated THRIFT-610:
---------------------------------

    Fix Version/s: 0.5
                       (was: 0.4)

> binary_protocol.rb segfaults [line 86]
> --------------------------------------
>
>                 Key: THRIFT-610
>                 URL: https://issues.apache.org/jira/browse/THRIFT-610
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>    Affects Versions: 0.2
>         Environment: ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] - svn checkout
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0] - git HEAD
>            Reporter: Andrew Kuhnhausen
>             Fix For: 0.5
>
>         Attachments: doot.pl, thrift-segfaul.rb
>
>
> output from irb 1.8
> /usr/local/lib/site_ruby/1.8/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
> output from irb 1.9
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86: [BUG] Segmentation fault
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0]
> -- control frame ----------
> c:0028 p:---- s:0114 b:0114 l:000113 d:000113 CFUNC  :write
> c:0027 p:0029 s:0110 b:0110 l:000109 d:000109 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86
> c:0026 p:0037 s:0106 b:0106 l:000105 d:000105 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38
> c:0025 p:0029 s:0100 b:0100 l:000099 d:000099 METHOD /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29
> c:0024 p:0050 s:0092 b:0092 l:000091 d:000091 METHOD /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21
> c:0023 p:0045 s:0082 b:0082 l:000e28 d:001858 EVAL   (irb):11
> c:0022 p:---- s:0080 b:0080 l:000079 d:000079 FINISH
> c:0021 p:---- s:0078 b:0078 l:000077 d:000077 CFUNC  :eval
> c:0020 p:0027 s:0071 b:0071 l:000070 d:000070 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80
> c:0019 p:0031 s:0064 b:0063 l:000062 d:000062 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218
> c:0018 p:0030 s:0058 b:0058 l:001018 d:000057 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149
> c:0017 p:0037 s:0050 b:0050 l:000049 d:000049 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263
> c:0016 p:0011 s:0045 b:0045 l:001018 d:000044 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146
> c:0015 p:0132 s:0041 b:0041 l:000024 d:000040 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244
> c:0014 p:---- s:0038 b:0038 l:000037 d:000037 FINISH
> c:0013 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC  :loop
> c:0012 p:0009 s:0033 b:0033 l:000024 d:000032 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230
> c:0011 p:---- s:0031 b:0031 l:000030 d:000030 FINISH
> c:0010 p:---- s:0029 b:0029 l:000028 d:000028 CFUNC  :catch
> c:0009 p:0023 s:0025 b:0025 l:000024 d:000024 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229
> c:0008 p:0042 s:0022 b:0022 l:001018 d:001018 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145
> c:0007 p:0011 s:0019 b:0019 l:000f68 d:000018 BLOCK  /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69
> c:0006 p:---- s:0017 b:0017 l:000016 d:000016 FINISH
> c:0005 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC  :catch
> c:0004 p:0172 s:0011 b:0011 l:000f68 d:000f68 METHOD /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68
> c:0003 p:0039 s:0006 b:0006 l:001988 d:001a28 EVAL   /usr/local/ruby1.9/bin/irb:12
> c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
> c:0001 p:0000 s:0002 b:0002 l:001988 d:001988 TOP   
> ---------------------------
> -- Ruby level backtrace information-----------------------------------------
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:86:in `write_i16'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/protocol/binary_protocol.rb:38:in `write_message_begin'
> /usr/local/ruby1.9/lib/ruby/gems/1.9.1/gems/thrift-0.0.810255.1/lib/thrift/client.rb:29:in `send_message'
> /Users/trane/Workspace/Ruby/stackable/thrift/gen-rb/container.rb:21:in `send_create'
> (irb):11:in `irb_binding'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/context.rb:218:in `evaluate'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:149:in `block (2 levels) in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:263:in `signal_status'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:146:in `block in eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:244:in `block (2 levels) in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `loop'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `block in each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `each_top_level_statement'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:145:in `eval_input'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:69:in `block in start'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `catch'
> /usr/local/ruby1.9/lib/ruby/1.9.1/irb.rb:68:in `start'
> /usr/local/ruby1.9/bin/irb:12:in `<main>'
> -- C level backtrace information -------------------------------------------
> Line 21 of 'container.rb' (generated by thrift) is the method, send_create
>     def send_create(customerId, id, uuid, address, name, os, stack)
>       send_message('create', Create_args, :customerId => customerId, :id => id, :uuid => uuid, :address => address, :name => name, :os => os, :stack => stack)
>     end
> This is how the method 'send_create' is being called with irb1.9 output (basically the same as irb1.8 output just with great back tracing):
> buffer = Thrift::MemoryBufferTransport.new(1024)
>      ### => #<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>
> protocol = Thrift::BinaryProtocol.new(buffer)
>     ###<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>
> irb(main):009:0> client = Container::Client.new(protocol)
>     ###<Container::Client:0x000001011e8608 @iprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @oprot=#<Thrift::BinaryProtocol:0x000001011f73d0 @trans=#<Thrift::MemoryBufferTransport:0x0000010120d978 @buf=1024, @index=0>, @strict_read=true, @strict_write=true>, @seqid=0>
> ### send_create(customerId, id, uuid, address, name, os, stack)
> client.send_create(
>   '0000',
>   '0',
>   '00xxx0x0-x0x0-00xx-xx00-x000x0x0xx00',
>   'www.whateveraddy.com',
>   'thrift_container',
>   '0',
>   '1'
> )
> then the output from the top comes out with the segfault.
> the error line refers to this in binary_protocol.rb
>     def write_i16(i16)
>       trans.write([i16].pack('n'))
>     end
> if that is removed, it fails on:
>     def write_i32(i32)
>       raise RangeError if i32 < -2**31 || i32 >= 2**31
>       trans.write([i32].pack('N'))
>     end

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.