CompanyBook/massive_record — Issue #84: `IOError: closed stream` after sending an invalid query
Author: behrangsa
Created: 2012-01-18 23:11:55+00:00
State: open

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 `'
from script/rails:6:in `require'
from script/rails:6:in `

'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 `'
from script/rails:6:in `require'
from script/rails:6:in `

'ruby-1.9.3-p0 :006 >
```