Unknown bug during new table creating or opening.

13 views
Skip to first unread message

lumrandir

unread,
Oct 27, 2009, 8:22:27 AM10/27/09
to Rufus Ruby
I tried to run this example with the creation of a new table: and here
is what I got:

==================

require 'rubygems'
require 'rufus/tokyo'
t = Rufus::Tokyo::Table.new('table.tct')

==================

and here is what I got:

==================

Rufus::Tokyo::TokyoError: (err 0) success
from /home/lumrandir/.rvm/gems/ruby/1.8.6/gems/rufus-tokyo-1.0.1/lib/
rufus/tokyo/cabinet table.rb:603:in `raise_error'
from /home/lumrandir/.rvm/gems/ruby/1.8.6/gems/rufus-tokyo-1.0.1/lib/
rufus/tokyo/cabinet/table.rb:588:in `libcall'
from /home/lumrandir/.rvm/gems/ruby/1.8.6/gems/rufus-tokyo-1.0.1/lib/
rufus/tokyo/cabinet/table.rb:136:in `initialize'
from (irb):3:in `new'
from (irb):3
from /home/lumrandir/.rvm/ruby-1.8.6-p383/lib/ruby/site_ruby/1.8/
rubygems/exceptions.rb:82

===================

I ran it on Ruby 1.8.6-p383, but on Ruby 1.9.1 and Ruby Enterprise
Edition 1.8.7 I have same error.

Environment:
rufus-tokyo 1.0.1
ffi 0.5.1
tokyocabinet 1.4.36
Slackware 13.0 x86

Also I created issue here: http://github.com/jmettraux/rufus-tokyo/issues#issue/21

John Mettraux

unread,
Oct 27, 2009, 9:24:45 AM10/27/09
to rufus...@googlegroups.com
On Tue, Oct 27, 2009 at 9:22 PM, lumrandir <lumr...@gmail.com> wrote:
>
> ==================
>
> require 'rubygems'
> require 'rufus/tokyo'
> t = Rufus::Tokyo::Table.new('table.tct')
>
> ==================
>
> and here is what I got:
>
> ==================
>
> Rufus::Tokyo::TokyoError: (err 0) success
>  from /home/lumrandir/.rvm/gems/ruby/1.8.6/gems/rufus-tokyo-1.0.1/lib/
> rufus/tokyo/cabinet table.rb:603:in `raise_error'
>  from /home/lumrandir/.rvm/gems/ruby/1.8.6/gems/rufus-tokyo-1.0.1/lib/
> rufus/tokyo/cabinet/table.rb:588:in `libcall'
>  from /home/lumrandir/.rvm/gems/ruby/1.8.6/gems/rufus-tokyo-1.0.1/lib/
> rufus/tokyo/cabinet/table.rb:136:in `initialize'
>  from (irb):3:in `new'
>  from (irb):3
>  from /home/lumrandir/.rvm/ruby-1.8.6-p383/lib/ruby/site_ruby/1.8/
> rubygems/exceptions.rb:82

Hello,

I have just tested with

Debian GNU/Linux, ffi 0.3.5, TC 1.4.32 or TC 1.4.36, Ruby 1.9.1p129
and it works,
MacOSX snoleo, ffi 0.5.0, TC 1.4.{32|36}, Ruby 1.8.7p72 or Ruby
1.9.1p243 and it works.

That is strange.

Best regards,

--
John Mettraux - http://jmettraux.wordpress.com

lumrandir

unread,
Oct 27, 2009, 10:39:59 AM10/27/09
to Rufus Ruby
> Hello,
>
> I have just tested with
>
> Debian GNU/Linux, ffi 0.3.5, TC 1.4.32 or TC 1.4.36, Ruby 1.9.1p129
> and it works,
> MacOSX snoleo, ffi 0.5.0, TC 1.4.{32|36}, Ruby 1.8.7p72 or Ruby
> 1.9.1p243 and it works.
>
> That is strange.
>
> Best regards,
>
> --
> John Mettraux   -  http://jmettraux.wordpress.com

Hello and thank you for answer.

Really, this simple code works correctly also on Fedora 11 with the
same environment. I think, that the reason is in build of my
tokyocabinet-library under Slackware. Are there people, who worked
with this in Slackware?

Dmitry A. Ustalov

unread,
Oct 27, 2009, 2:56:01 PM10/27/09
to Rufus Ruby
It is sad, really.

I've tried this code at our production environment:

* CentOS 5.4 (x86)
* Ruby Enterprise Edition 2009.10
* Tokyo Cabinet 1.4.35 (built manually:
./configure --prefix=/usr && make && sudo make install)
* rufus-tokyo (1.0.1)
* ffi (0.5.1)

and everything works fine. Strange and sad bug =(

On 27 окт, 18:24, John Mettraux <jmettr...@openwfe.org> wrote:

John Mettraux

unread,
Oct 27, 2009, 9:55:42 PM10/27/09
to rufus...@googlegroups.com
2009/10/28 Dmitry A. Ustalov <eve...@gmail.com>:

>
> It is sad, really.
>
> I've tried this code at our production environment:
>
> * CentOS 5.4 (x86)
> * Ruby Enterprise Edition 2009.10
> * Tokyo Cabinet 1.4.35 (built manually:
> ./configure --prefix=/usr && make && sudo make install)
> * rufus-tokyo (1.0.1)
> * ffi (0.5.1)
>
> and everything works fine. Strange and sad bug =(

Dmitry is also working with ffi 0.5.1, I ran my tests with ffi 0.5.0
and 0.3.5. I thought it might be a factor in the issue but now it
seems that it's Slackware related, too bad.

Dmitry A. Ustalov

unread,
Oct 28, 2009, 1:01:21 PM10/28/09
to Rufus Ruby
I though, not. Just look:

eveel@notazik{~}% cat /etc/redhat-release
Fedora release 11 (Leonidas)
eveel@notazik{~}% rvm ree
eveel@notazik{~}% ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-linux], MBARI 0x8770,
Ruby Enterprise Edition 2009.10
eveel@notazik{~}% gem list | egrep '(ffi|rufus)'
ffi (0.5.1, 0.5.0)
rufus-tokyo (1.0.1)
eveel@notazik{~}% irb -rrufus/tokyo
>> Rufus::Tokyo::Cabinet.new('data.tch')
Rufus::Tokyo::TokyoError: failed to open/create db 'data.tch' {}
from /home/eveel/.rvm/gems/ree/1.8.7/gems/rufus-tokyo-1.0.1/lib/rufus/
tokyo/cabinet/abstract.rb:195:in `initialize'
from (irb):1:in `new'
from (irb):1
from :0
>> Rufus::Tokyo::Table.new('table.tch')
=> #<Rufus::Tokyo::Table:0x93c8f30>

But when I'm switching to system default ruby:
eveel@notazik{~}% ruby -v
ruby 1.8.6 (2009-06-08 patchlevel 369) [i386-linux]
eveel@notazik{~}% irb -rrufus-tokyo
>> Rufus::Tokyo::Cabinet.new('data.tch')
=> #<Rufus::Tokyo::Cabinet:0xb781e658>
>> Rufus::Tokyo::Table.new('table.tch')
=> #<Rufus::Tokyo::Table:0xb7808010>

John Mettraux

unread,
Oct 28, 2009, 1:05:25 PM10/28/09
to rufus...@googlegroups.com
On Thu, Oct 29, 2009 at 2:01 AM, Dmitry A. Ustalov <eve...@gmail.com> wrote:
>
> I though, not. Just look:

?

> eveel@notazik{~}% cat /etc/redhat-release
> Fedora release 11 (Leonidas)
> eveel@notazik{~}% rvm ree
> eveel@notazik{~}% ruby -v
> ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-linux], MBARI 0x8770,
> Ruby Enterprise Edition 2009.10
> eveel@notazik{~}% gem list | egrep '(ffi|rufus)'
> ffi (0.5.1, 0.5.0)
> rufus-tokyo (1.0.1)
> eveel@notazik{~}% irb -rrufus/tokyo
>>> Rufus::Tokyo::Cabinet.new('data.tch')
> Rufus::Tokyo::TokyoError: failed to open/create db 'data.tch' {}
>        from /home/eveel/.rvm/gems/ree/1.8.7/gems/rufus-tokyo-1.0.1/lib/rufus/
> tokyo/cabinet/abstract.rb:195:in `initialize'
>        from (irb):1:in `new'
>        from (irb):1
>        from :0
>>> Rufus::Tokyo::Table.new('table.tch')
> => #<Rufus::Tokyo::Table:0x93c8f30>

OK, understood. I will take some time to try on REE tomorrow.

Thanks and best regards,

Dmitry A. Ustalov

unread,
Oct 28, 2009, 1:08:36 PM10/28/09
to Rufus Ruby
nice typo:)

> though
thought

John Mettraux

unread,
Oct 28, 2009, 1:12:00 PM10/28/09
to rufus...@googlegroups.com
2009/10/29 Dmitry A. Ustalov <eve...@gmail.com>:

>
> nice typo:)
>
>> though
> thought

OK, if meanwhile you find anything, please post here, I have no clue
where to look.

I'm going to bed. Cheers,

lumrandir

unread,
Oct 28, 2009, 2:23:09 PM10/28/09
to Rufus Ruby
I've tried this example and our tests on ruby 1.9.1, Fedora 11. It's
working nice there.

John Mettraux

unread,
Oct 28, 2009, 7:21:09 PM10/28/09
to rufus...@googlegroups.com
On Thu, Oct 29, 2009 at 3:23 AM, lumrandir <lumr...@gmail.com> wrote:
>
> I've tried this example and our tests on ruby 1.9.1, Fedora 11. It's
> working nice there.

Hello,

does it work with REE on your Fedora 11 ?


Best regards,

John Mettraux

unread,
Oct 28, 2009, 9:40:40 PM10/28/09
to rufus...@googlegroups.com
On Thu, Oct 29, 2009 at 2:01 AM, Dmitry A. Ustalov <eve...@gmail.com> wrote:
>
> I though, not. Just look:
>
> eveel@notazik{~}% cat /etc/redhat-release
> Fedora release 11 (Leonidas)
> eveel@notazik{~}% rvm ree
> eveel@notazik{~}% ruby -v
> ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-linux], MBARI 0x8770,
> Ruby Enterprise Edition 2009.10
> eveel@notazik{~}% gem list | egrep '(ffi|rufus)'
> ffi (0.5.1, 0.5.0)
> rufus-tokyo (1.0.1)
> eveel@notazik{~}% irb -rrufus/tokyo
>>> Rufus::Tokyo::Cabinet.new('data.tch')
> Rufus::Tokyo::TokyoError: failed to open/create db 'data.tch' {}
>        from /home/eveel/.rvm/gems/ree/1.8.7/gems/rufus-tokyo-1.0.1/lib/rufus/
> tokyo/cabinet/abstract.rb:195:in `initialize'
>        from (irb):1:in `new'
>        from (irb):1
>        from :0

Hello Dmitry,

I tried with ruby-enterprise-1.8.6-20090610 and ruby-ffi 0.5.0 with
rufus-tokyo 1.0.1 on both Mac OSX 10.6 and Arch GNU/Linux. Works fine.

However, I could reproduce your issue with :

---8<---
jmettraux@arch ~ $ ruby -v
ruby 1.8.6 (2008-08-11 patchlevel 287) [x86_64-linux]
Ruby Enterprise Edition 20090610
jmettraux@arch ~ $ irb
ruby-enterprise-1.8.6-20090610 > require 'rubygems'; require 'rufus-tokyo'
=> true
ruby-enterprise-1.8.6-20090610 > h = Rufus::Tokyo::Cabinet.new('data.tch')
=> #<Rufus::Tokyo::Cabinet:0x7f050d1d1c08 @path="data.tch",
@db=#<FFI::Pointer address=0x1c435c0>,
@default_proc=#<Proc:0x00007f050d21a458@/home/jmettraux/.rvm/gems/ruby-enterprise/1.8.6/gems/rufus-tokyo-1.0.1/lib/rufus/tokyo/hmethods.rb:103>>
ruby-enterprise-1.8.6-20090610 > h = Rufus::Tokyo::Cabinet.new('data.tch')


Rufus::Tokyo::TokyoError: failed to open/create db 'data.tch' {}

from /home/jmettraux/.rvm/gems/ruby-enterprise/1.8.6/gems/rufus-tokyo-1.0.1/lib/rufus/tokyo/cabinet/abstract.rb:195:in
`initialize'


from (irb):3:in `new'
from (irb):3

ruby-enterprise-1.8.6-20090610 >
--->8---

This error occurs on "double-opening". Is your pasted output accurate ?

lumrandir

unread,
Oct 29, 2009, 12:32:46 AM10/29/09
to Rufus Ruby


On 29 окт, 04:21, John Mettraux <jmettr...@openwfe.org> wrote:
> On Thu, Oct 29, 2009 at 3:23 AM, lumrandir <lumran...@gmail.com> wrote:
>
> > I've tried this example and our tests on ruby 1.9.1, Fedora 11. It's
> > working nice there.
>
> Hello,
>
> does it work with REE on your Fedora 11 ?
>
> Best regards,
>
> --
> John Mettraux   -  http://jmettraux.wordpress.com

Hello.

No, it isn't working on my Fedora. I've installed Fedora instead of
Slackware specifically in order to get rid of this problem, but now I
have another problem :)
It's just the same as in Dmitry's case.

John Mettraux

unread,
Oct 29, 2009, 12:35:51 AM10/29/09
to rufus...@googlegroups.com
2009/10/29 lumrandir <lumr...@gmail.com>:

Which version of REE ?

Lumren Randir

unread,
Oct 29, 2009, 1:00:43 AM10/29/09
to rufus...@googlegroups.com
> Which version of REE ?

bash-4.0$ rvm use ree
bash-4.0$ ruby -v

John Mettraux

unread,
Oct 29, 2009, 1:42:06 AM10/29/09
to rufus...@googlegroups.com

OK, I could reproduce the issue on Arch GNU/Linux with the same REE.

This seems to fix the issue :

---8<---
diff --git a/lib/rufus/tokyo/cabinet/abstract.rb
b/lib/rufus/tokyo/cabinet/abstract.rb
index 1330165..2b3f3ab 100644
--- a/lib/rufus/tokyo/cabinet/abstract.rb
+++ b/lib/rufus/tokyo/cabinet/abstract.rb
@@ -217,7 +217,8 @@ module Rufus::Tokyo

name = name + params.collect { |k, v| "##{k}=#{v}" }.join('')

- (lib.tcadbopen(@db, name) == 1) || raise(
+ #(lib.tcadbopen(@db, name) == 1) || raise(
+ (lib.tcadbopen(@db, name) != 0) || raise(
TokyoError.new("failed to open/create db '#{name}' #{params.inspect}"))

#
--->8---

Please tell me if it's OK for you as well and if I need to apply this
technique to other Tokyo structures.


Thanks in advance,

Lumren Randir

unread,
Oct 29, 2009, 10:23:05 AM10/29/09
to rufus...@googlegroups.com
John Mettraux <jmet...@openwfe.org> писал(а) в своём письме Thu, 29 Oct
2009 10:42:06 +0500:

Yes, this error looks nullified, but now I have some new problem:

bash-4.0$ script/server
=> Booting WEBrick
=> Rails 2.3.4 application starting on http://0.0.0.0:3000
/home/lumrandir/workspace/peppery-school/vendor/gems/rufus-tokyo-1.0.1/lib/rufus/tokyo/cabinet/abstract.rb:195:in
`initialize': failed to open/create db
'/home/lumrandir/workspace/peppery-school/db/strawberry/development/database.tch#mode=wcef'
{:mode=>"wcef"} (Rufus::Tokyo::TokyoError)

As far I can tell by looking at the rufus-tokyo source, it's similar to
the previous case.

John Mettraux

unread,
Oct 29, 2009, 10:30:41 AM10/29/09
to rufus...@googlegroups.com

Hello,

I don't understand your email.

The error seems to occur exactly at the same place so it is not "nullified".

Maybe it's linked to the wcef mode... Does it occur when you drop that mode ?

Which ruby ? Which platform ?

Sorry,

Lumren Randir

unread,
Oct 29, 2009, 12:02:59 PM10/29/09
to rufus...@googlegroups.com
> Hello,
>
> I don't understand your email.
>
> The error seems to occur exactly at the same place so it is not
> "nullified".
>
> Maybe it's linked to the wcef mode... Does it occur when you drop that
> mode ?
>
> Which ruby ? Which platform ?
>
> Sorry,
>

Oh, I'm sorry, it's my mistake.
I've edited source in gem directory, but forgot to re-unpack gem in
vendor/.

Surely, now it looks like working.

Thank you for help.

John Mettraux

unread,
Oct 29, 2009, 10:47:54 PM10/29/09
to rufus...@googlegroups.com
On Fri, Oct 30, 2009 at 1:02 AM, Lumren Randir <lumr...@gmail.com> wrote:
>
> Oh, I'm sorry, it's my mistake.
> I've edited source in gem directory, but forgot to re-unpack gem in
> vendor/.
>
> Surely, now it looks like working.

OK,

I've updated the code with what we learnt here :

http://github.com/jmettraux/rufus-tokyo/commit/cf43603f0b033c83c5c1a862fff20632d9686c63

The tests are all green for me on Arch GNU/Linux with REE 2009.10
(1.8.7), green for my traditional platforms as well.


Thanks to you and Dmitry for the input, best regards,

Dmitry A. Ustalov

unread,
Oct 31, 2009, 7:24:19 AM10/31/09
to Rufus Ruby
Thank you John!

Please, release next rufus-tokyo version as soon as possible.

John Mettraux

unread,
Nov 1, 2009, 2:23:12 AM11/1/09
to rufus...@googlegroups.com
On Sat, Oct 31, 2009 at 8:24 PM, Dmitry A. Ustalov <eve...@gmail.com> wrote:
>
> Please, release next rufus-tokyo version as soon as possible.

Hello, I just released rufus-tokyo 1.0.2 via http://gemcutter.org

gem install rufus-tokyo --source http://gemcutter.org


Best regards,

Reply all
Reply to author
Forward
0 new messages