New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot call #close in ruby 1.9 #23

Closed
swerling opened this Issue Nov 15, 2009 · 4 comments

Comments

Projects
None yet
2 participants
@swerling

swerling commented Nov 15, 2009

I tried this on 2 machines, with a variety of versions of ffi and tokyo cabinet. It works in 1.8, but does not in 1.9, failing on the line 'db.close':

require 'rubygems'
require 'rufus/tokyo'

def test_tokyo
  db = Rufus::Tokyo::Cabinet.new('/tmp/data.tch', :type => :hash,
                                                  :mode => 'wc', # create/write
                                                  :opts => 'ld')
  db['nada'] = 'surf'
  puts "Should be 'surf': #{db['nada']}"
  puts "Should be 'nil': #{db['xyz']}"
  5000.times { |i| db[(i+1).to_s] = "x" }
  puts "Should be '5000': #{db.inject { |r, (k, v)| k }}"
  closed = db.close
  puts "Should be 'true': #{closed}"
  raise "Could not close db" if !closed # this line really pukes in 1.9
end

5.times {test_tokyo; sleep 0.5}
@jmettraux

This comment has been minimized.

Owner

jmettraux commented Nov 16, 2009

Which platform ? GNU/Linux ? MacOSX ?
Which version of Tokyo Cabinet ?
Which version of rufus-tokyo ?
What is the error message / trace ? It should not puke.

Works for me on ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0] and ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0] with TC 1.4.36. FFI 0.5.1.

@jmettraux

This comment has been minimized.

Owner

jmettraux commented Nov 16, 2009

newer version of FFI have bool type. Adapted. Closed by b70a7dd

@swerling

This comment has been minimized.

swerling commented Nov 21, 2009

I've tried this configuration on 2 machines (both w/ ubuntu jaunty installed). Details:

tokyo-cabinet: following versions from source:
tokyocabinet-1.4.36
tokyocabinet-1.4.39

Other info:

swerling@walter:~$ ruby -v
  ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux]
  (ruby 1.9.1p243 installed from source)

swerling@walter:~$ gem -v
  1.3.5

swerling@walter:~$ gem list | egrep "(ffi)|(rufus)"
  ffi (0.5.1)
  rufus-tokyo (1.0.2)

swerling@walter:~$ cat /etc/issue
  Ubuntu 9.04 \n \l

swerling@walter:~$ uname -a
  Linux walter 2.6.28-15-generic #52-Ubuntu SMP Wed Sep 9 10:49:34 UTC 2009 i686 GNU/Linux

rufus-tokyo 1.0.2
  installed via gems v 1.3.5

ubuntu (jaunty)
  uname -a: Linux walter 2.6.28-15-generic #52-Ubuntu SMP Wed Sep 9 10:49:34 UTC 2009 i686 GNU/Linux

swerling@walter:~/dev/sinai$ ruby test_tokyo_works.rb
  Should be 'surf': surf
  Should be 'nil':
  Should be '5000': 5000
  Should be 'true': false
  test_tokyo_works.rb:15:in `test_tokyo': Could not close db (RuntimeError)
          from test_tokyo_works.rb:18:in `block in '
          from test_tokyo_works.rb:18:in `times'
          from test_tokyo_works.rb:18:in `'
@swerling

This comment has been minimized.

swerling commented Nov 21, 2009

Just tried this with rufus-tokyo 1.0.3, and the problem is gone. Thanks.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment