`IOError: closed stream` after sending an invalid query
behrangsa opened this issue · comments
After sending an invalid query (passing integer instead of string as the ID), the subsequent calls to find
fail.
Document.find(2)
NoMethodError: undefined method `length' for 2:Fixnum
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/thrift-0.8.0/lib/thrift/protocol/binary_protocol.rb:111:in `write_string'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/thrift-0.8.0/lib/thrift/client.rb:35:in `write'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/thrift-0.8.0/lib/thrift/client.rb:35:in `send_message'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/adapters/thrift/hbase/hbase.rb:241:in `send_getRowWithColumns'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/adapters/thrift/hbase/hbase.rb:236:in `getRowWithColumns'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/adapters/thrift/connection.rb:68:in `method_missing'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/adapters/thrift/table.rb:139:in `find'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/finders.rb:163:in `hbase_query_find'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/query_instrumentation.rb:43:in `block in hbase_query_find'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.3/lib/active_support/notifications.rb:55:in `instrument'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/query_instrumentation.rb:38:in `hbase_query_find'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/finders.rb:152:in `query_hbase'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/finders.rb:104:in `do_find'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/finders/rescue_missing_table_on_find.rb:10:in `block in do_find'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/finders/rescue_missing_table_on_find.rb:32:in `create_table_and_retry_if_table_missing'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/finders/rescue_missing_table_on_find.rb:10:in `do_find'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/query_instrumentation.rb:18:in `block in do_find'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.3/lib/active_support/notifications.rb:53:in `block in instrument'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.3/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.3/lib/active_support/notifications.rb:53:in `instrument'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/query_instrumentation.rb:13:in `do_find'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/finders/scope.rb:89:in `find'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/finders.rb:8:in `find'
from (irb):4
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/railties-3.1.3/lib/rails/commands/console.rb:45:in `start'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/railties-3.1.3/lib/rails/commands/console.rb:8:in `start'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/railties-3.1.3/lib/rails/commands.rb:40:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'ruby-1.9.3-p0 :005 > Document.find("2")
IOError: closed stream
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/thrift-0.8.0/lib/thrift/transport/socket.rb:62:in `write'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/thrift-0.8.0/lib/thrift/transport/buffered_transport.rb:95:in `flush'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/thrift-0.8.0/lib/thrift/client.rb:41:in `send_message'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/adapters/thrift/hbase/hbase.rb:241:in `send_getRowWithColumns'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/adapters/thrift/hbase/hbase.rb:236:in `getRowWithColumns'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/adapters/thrift/connection.rb:68:in `method_missing'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/adapters/thrift/table.rb:139:in `find'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/finders.rb:163:in `hbase_query_find'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/query_instrumentation.rb:43:in `block in hbase_query_find'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.3/lib/active_support/notifications.rb:55:in `instrument'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/query_instrumentation.rb:38:in `hbase_query_find'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/finders.rb:152:in `query_hbase'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/finders.rb:104:in `do_find'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/finders/rescue_missing_table_on_find.rb:10:in `block in do_find'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/finders/rescue_missing_table_on_find.rb:32:in `create_table_and_retry_if_table_missing'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/finders/rescue_missing_table_on_find.rb:10:in `do_find'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/query_instrumentation.rb:18:in `block in do_find'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.3/lib/active_support/notifications.rb:53:in `block in instrument'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.3/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/activesupport-3.1.3/lib/active_support/notifications.rb:53:in `instrument'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/query_instrumentation.rb:13:in `do_find'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/finders/scope.rb:89:in `find'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/massive_record-0.2.1/lib/massive_record/orm/finders.rb:8:in `find'
from (irb):5
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/railties-3.1.3/lib/rails/commands/console.rb:45:in `start'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/railties-3.1.3/lib/rails/commands/console.rb:8:in `start'
from /Users/user/.rvm/gems/ruby-1.9.3-p0@foo/gems/railties-3.1.3/lib/rails/commands.rb:40:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'ruby-1.9.3-p0 :006 >
Hey, this is done on purpose, the developer needs to ensure that the ID is a string.
This doesn't make sense. When a non-String ID is passed, only the current call should fail and it should not affect future calls. If you think otherwise, it would be nice if you could give an explanation.
This looks like saying that if in MySQL I create a malformed SQL query, then not only that query should not work, but also no subsequent queries should work either unless I restart the app! Doesn't make sense at all.
Oh sorry, I didn't get your question. I don't need to restart the application (on dev or production) when I get this error, I can do a request afterwards without any problem.
I see that you are using ruby 1.9.3, we haven't done any test with it, but I guess that it shouldn't be the problem... what is the version of hbase / thrift that you are running?
Vincent,
It's thrift 0.2.0 and hbase 0.90.4. I am actually using MapR's VM which can be downloaded from here: http://package.mapr.com/releases/v1.2.0/vmdemo/MapR-VM-1.2.0.12140GA-1-m5.tar.bzip2