Aliaksei Kruk created THRIFT-1803:
-------------------------------------

             Summary: Ruby Thrift 0.9.0 tries to encode UUID to UTF8 and crashes
                 Key: THRIFT-1803
                 URL: https://issues.apache.org/jira/browse/THRIFT-1803
             Project: Thrift
          Issue Type: Bug
          Components: Ruby - Compiler
    Affects Versions: 0.9
         Environment: $ uname -a
Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.32-1 x86_64 GNU/Linux
(Debian 7 testing)
Cassandra 1.0.12
rvm 1.17.2 (stable)
ruby-1.9.2-p290
$ bundle list
Gems included by the bundle:
  * bundler (1.2.3)
  * cassandra (0.17.0)
  * json (1.7.5)
  * rake (10.0.3)
  * simple_uuid (0.2.0)
  * thrift (0.9.0)
  * thrift_client (0.8.3)
            Reporter: Aliaksei Kruk


Cassandra supports UUID comparator type and thrift 0.8 works with UUID without 
problems.

cassandra-cli:
create column family test_uuid with comparator = 'TimeUUIDType';

ruby:
require 'cassandra'
cassandra = Cassandra.new('test', '127.0.0.1:9160')
cassandra.insert('test_uuid', '1', {SimpleUUID::UUID.new(Time.now.utc) => 'ok' 
})

execution:
$ bundle exec ruby lib/test.rb 
/home/lioxa/.rvm/gems/ruby-1.9.2-p290@test/gems/thrift-0.9.0/lib/thrift/bytes.rb:81:in
 `encode': "\xA2" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
        from 
/home/lioxa/.rvm/gems/ruby-1.9.2-p290@test/gems/thrift-0.9.0/lib/thrift/bytes.rb:81:in
 `convert_to_utf8_byte_buffer'
        from 
/home/lioxa/.rvm/gems/ruby-1.9.2-p290@test/gems/thrift-0.9.0/lib/thrift/client.rb:35:in
 `write_string'
        from 
/home/lioxa/.rvm/gems/ruby-1.9.2-p290@test/gems/thrift-0.9.0/lib/thrift/client.rb:35:in
 `write'
        from 
/home/lioxa/.rvm/gems/ruby-1.9.2-p290@test/gems/thrift-0.9.0/lib/thrift/client.rb:35:in
 `send_message'
        from 
/home/lioxa/.rvm/gems/ruby-1.9.2-p290@test/gems/cassandra-0.17.0/vendor/0.8/gen-rb/cassandra.rb:247:in
 `send_batch_mutate'
        from 
/home/lioxa/.rvm/gems/ruby-1.9.2-p290@test/gems/cassandra-0.17.0/vendor/0.8/gen-rb/cassandra.rb:242:in
 `batch_mutate'
        from 
/home/lioxa/.rvm/gems/ruby-1.9.2-p290@test/gems/thrift_client-0.8.3/lib/thrift_client/abstract_thrift_client.rb:159:in
 `block in handled_proxy'
        from 
/home/lioxa/.rvm/gems/ruby-1.9.2-p290@test/gems/thrift_client-0.8.3/lib/thrift_client/abstract_thrift_client.rb:140:in
 `ensure_socket_alignment'
        from 
/home/lioxa/.rvm/gems/ruby-1.9.2-p290@test/gems/thrift_client-0.8.3/lib/thrift_client/abstract_thrift_client.rb:159:in
 `handled_proxy'
        from 
/home/lioxa/.rvm/gems/ruby-1.9.2-p290@test/gems/thrift_client-0.8.3/lib/thrift_client/abstract_thrift_client.rb:53:in
 `batch_mutate'
        from 
/home/lioxa/.rvm/gems/ruby-1.9.2-p290@test/gems/cassandra-0.17.0/lib/cassandra/protocol.rb:7:in
 `_mutate'
        from 
/home/lioxa/.rvm/gems/ruby-1.9.2-p290@test/gems/cassandra-0.17.0/lib/cassandra/cassandra.rb:463:in
 `insert'
        from lib/test.rb:4:in `<main>'

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to