View got ArgumentError (wrong number of arguments (given 5373957, expected 0))

views

#1

I play with ruby beer examples running into problem as below:

cb = Couchbase.connect(hostname: 'localhost', username: 'sample', password: 'sample', bucket: "beer-sample")
irb(main):125:0> view = cb.design_docs['brewery'].all(limit: 3)
=> #<Couchbase::View:70258122815940 @endpoint="_design/brewery/_view/all" @params={:connection_timeout=>75000, :limit=>3}>

irb(main):126:0> view.each { |e| puts e.key }
(512) Brewing Company
21st Amendment Brewery Cafe
3 Fonteinen Brouwerij Ambachtelijke Geuzestekerij
Traceback (most recent call last):
       11: from script/rails:6:in `<main>'
       10: from script/rails:6:in `require'
        9: from /usr/local/lib/ruby/gems/2.5.0/gems/railties-3.2.22.5/lib/rails/commands.rb:41:in `<top (required)>'
        8: from /usr/local/lib/ruby/gems/2.5.0/gems/railties-3.2.22.5/lib/rails/commands/console.rb:8:in `start'
        7: from /usr/local/lib/ruby/gems/2.5.0/gems/railties-3.2.22.5/lib/rails/commands/console.rb:47:in `start'
        6: from (irb):126
        5: from /usr/local/lib/ruby/gems/2.5.0/gems/couchbase-1.3.15/lib/couchbase/view.rb:200:in `each'
        4: from /usr/local/lib/ruby/gems/2.5.0/gems/couchbase-1.3.15/lib/couchbase/view.rb:378:in `fetch'
        3: from /usr/local/lib/ruby/gems/2.5.0/gems/couchbase-1.3.15/lib/couchbase/view.rb:496:in `fetch_sync'
        2: from /usr/local/lib/ruby/gems/2.5.0/gems/couchbase-1.3.15/lib/couchbase/view.rb:496:in `write'
        1: from /usr/local/lib/ruby/gems/2.5.0/gems/couchbase-1.3.15/lib/couchbase/view.rb:496:in `bytesize'
ArgumentError (wrong number of arguments (given 5373957, expected 0))

This is the running env:

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (3.2.22.5)
      actionpack (= 3.2.22.5)
      mail (~> 2.5.4)
    actionpack (3.2.22.5)
      activemodel (= 3.2.22.5)
      activesupport (= 3.2.22.5)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.4)
      rack (~> 1.4.5)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.2.1)
    activemodel (3.2.22.5)
      activesupport (= 3.2.22.5)
      builder (~> 3.0.0)
    activerecord (3.2.22.5)
      activemodel (= 3.2.22.5)
      activesupport (= 3.2.22.5)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activeresource (3.2.22.5)
      activemodel (= 3.2.22.5)
      activesupport (= 3.2.22.5)
    activesupport (3.2.22.5)
      i18n (~> 0.6, >= 0.6.4)
      multi_json (~> 1.0)
    airbrussh (1.3.0)
      sshkit (>= 1.6.1, != 1.7.0)
    arel (3.0.3)
    builder (3.0.4)
    capistrano (3.11.0)
      airbrussh (>= 1.0.0)
      i18n
      rake (>= 10.0.0)
      sshkit (>= 1.9.0)
    concurrent-ruby (1.0.5)
    connection_pool (2.2.2)
    couchbase (1.3.15)
      connection_pool (>= 1.0.0, <= 3.0.0)
      multi_json (~> 1.0)
      yaji (~> 0.3, >= 0.3.2)
    couchbase-model (0.5.4)
      activemodel
      couchbase (~> 1.3.3)
    erubis (2.7.0)
    eventmachine (1.0.9.1)
    execjs (2.7.0)
    ffi (1.9.25)
    hashie (3.5.7)
    hike (1.2.3)
    i18n (0.9.5)
      concurrent-ruby (~> 1.0)
    journey (1.0.4)
    jquery-rails (3.1.5)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    json (1.8.6)
    mail (2.5.5)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.25.1)
    multi_json (1.13.1)
    net-scp (1.2.1)
      net-ssh (>= 2.6.5)
    net-ssh (5.0.2)
    oauth (0.5.4)
    omniauth (1.4.2)
      hashie (>= 1.2, < 4)
      rack (>= 1.0, < 3)
    omniauth-oauth (1.1.0)
      oauth
      omniauth (~> 1.0)
    omniauth-twitter (1.4.0)
      omniauth-oauth (~> 1.1)
      rack
    polyglot (0.3.5)
    rack (1.4.7)
    rack-cache (1.8.0)
      rack (>= 0.4)
    rack-ssl (1.3.4)
      rack
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (3.2.22.5)
      actionmailer (= 3.2.22.5)
      actionpack (= 3.2.22.5)
      activerecord (= 3.2.22.5)
      activeresource (= 3.2.22.5)
      activesupport (= 3.2.22.5)
      bundler (~> 1.0)
      railties (= 3.2.22.5)
    railties (3.2.22.5)
      actionpack (= 3.2.22.5)
      activesupport (= 3.2.22.5)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (>= 0.14.6, < 2.0)
    rake (12.3.1)
    rb-fsevent (0.10.3)
    rb-inotify (0.9.10)
      ffi (>= 0.5.0, < 2)
    rdiscount (2.2.0.1)
    rdoc (3.12.2)
      json (~> 1.4)
    sass (3.5.6)
      sass-listen (~> 4.0.0)
    sass-listen (4.0.0)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
    sass-rails (3.2.6)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    sprockets (2.2.3)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sshkit (1.17.0)
      net-scp (>= 1.1.2)
      net-ssh (>= 2.8.0)
    thor (0.20.0)
    tilt (1.4.1)
    treetop (1.4.15)
      polyglot
      polyglot (>= 0.3.1)
    tzinfo (0.3.54)
    uglifier (4.1.14)
      execjs (>= 0.3.0, < 3)
    yaji (0.3.6)
    yajl-ruby (1.4.0)

PLATFORMS
  ruby

DEPENDENCIES
  capistrano
  couchbase
  couchbase-model
  eventmachine
  jquery-rails
  omniauth
  omniauth-twitter
  rails
  rdiscount
  sass-rails
  uglifier
  yajl-ruby

BUNDLED WITH
   1.16.2

Any help will be highly appreciated!


#2

Hi @leonard.zhou, I’ve checked this issue on current master, and it seems like it is not reproduced. Note that I’ve updated view layer, and now it is much more reliable. The following steps I use to test

git clone git://github.com/couchbase/couchbase-ruby-client.git
cd couchbase-ruby-client
bundle install
bundle exec rake compile
bundle exec rake console

irb(main):001:0> cb = Couchbase.connect('couchbase://127.0.0.1/beer-sample', password: 'password', username: 'Administrator')
=> #<Couchbase::Bucket:0x0000555f63923390 "couchbase://127.0.0.1/beer-sample/" transcoder=Couchbase::Transcoder::Document, default_flags=0x0, connected=true, timeout=2500000, bootstrap_transport=:cccp>

irb(main):002:0> view = cb.design_docs['brewery'].all(limit: 3)
=> #<Couchbase::View:46934090392060 @endpoint="_design/brewery/_view/all" @params={:connection_timeout=>75000, :limit=>3}>

irb(main):003:0> view.each { |e| puts e.key }
21st_amendment_brewery_cafe
3_fonteinen_brouwerij_ambachtelijke_geuzestekerij
357
=> nil