0
votes

I have installed Memcached and tried some simple examples, which worked fine. Now I am trying to create a server and use Memcached functionalities.

I have started with the most simple example.rb file:

require 'memcached'
  puts 'Hello'

However, when I try to load the file into I get the following error.

/Users/matiii79/.rvm/gems/ruby-2.2.0@global/gems/memcached- 1.8.0/lib/rlibmemcached.bundle: [BUG] Segmentation fault at 0x00000000000440 ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]

-- Crash Report log information -------------------------------------------- See Crash Report log file under the one of following: * ~/Library/Logs/CrashReporter * /Library/Logs/CrashReporter * ~/Library/Logs/DiagnosticReports * /Library/Logs/DiagnosticReports for more details.

-- Control frame information ----------------------------------------------- c:0009 p:-17567916705026 s:0039 e:000038 TOP [FINISH] c:0008 p:---- s:0037 e:000036 CFUNC :require c:0007 p:0113 s:0033 e:000032 METHOD /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54 c:0006 p:0017 s:0023 e:000022 TOP
/Users/matiii79/.rvm/gems/ruby-2.2.0@global/gems/memcached-1.8.0/lib/memcached.rb:19 [FINISH] c:0005 p:---- s:0021 e:000020 CFUNC :require c:0004 p:0083 s:0017 e:000016 RESCUE /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128 c:0003 p:0388 s:0014 e:000013 METHOD /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39 c:0002 p:0007 s:0004 E:000820 EVAL example.rb:1 [FINISH] c:0001 p:0000 s:0002 E:000f40 TOP [FINISH]

-- Ruby level backtrace information ---------------------------------------- example.rb:1:in <main>' /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:inrequire' /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in rescue in require' /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in require' /Users/matiii79/.rvm/gems/ruby-2.2.0@global/gems/memcached-1.8.0/lib/memcached.rb:19:in <top (required)>' /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire' /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'

-- Machine register context ------------------------------------------------ rax: 0x0000000000000030 rbx: 0x0000000106766f59 rcx: 0x0000000000000000 rdx: 0xfffffffffffffff0 rdi: 0x0000000000000030 rsi: 0x0000000000000000 rbp: 0x00007fff598f6900 rsp: 0x00007fff598f6900 r8: 0x0000000000000017 r9: 0x00000000f0000000 r10: 0x0000000000000a58 r11: 0x00007fff93182d10 r12: 0x00007fff78694070 r13: 0x00007fd2cb500000 r14: 0x0000000000000004 r15: 0x00007fff598f69e0 rip: 0x00000001067cbbe6 rfl: 0x0000000000010246

-- C level backtrace information ------------------------------------------- 0 libruby.2.2.0.dylib 0x00000001064a6ccb rb_vm_bugreport + 155 1 libruby.2.2.0.dylib
0x000000010634b0e0 rb_bug_context + 480 2 libruby.2.2.0.dylib
0x00000001064232a3 sigsegv + 83 3 libsystem_platform.dylib
0x00007fff93181f1a _sigtramp + 26 4 libruby.2.2.0.dylib
0x00000001067cbbe6 ruby_xmalloc + 17 5 ???
0x00007fff598f6920 0x0 + 140734695958816

-- Other runtime information -----------------------------------------------

  • Loaded script: example.rb

  • Loaded features:

    0 enumerator.so 1 rational.so 2 complex.so 3 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/x86_64-darwin14/enc/encdb.bundle 4 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/x86_64-darwin14/enc/trans/transdb.bundle 5 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/unicode_normalize.rb 6 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/x86_64-darwin14/rbconfig.rb 7 thread.rb 8 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/x86_64-darwin14/thread.bundle 9 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/compatibility.rb 10 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/defaults.rb 11 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/deprecate.rb 12 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/errors.rb 13 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/version.rb 14 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/requirement.rb 15 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/platform.rb 16 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/basic_specification.rb 17 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/stub_specification.rb 18 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/util/stringio.rb 19 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb 20 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/exceptions.rb 21 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb 22 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/monitor.rb
    23 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb 24 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems.rb 25 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/path_support.rb 26 /Users/matiii79/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb

[NOTE] You may have encountered a bug in the Ruby interpreter or extension libraries. Bug reports are welcome. Don't forget to include the above Crash Report log file. For details: http://www.ruby-lang.org/bugreport.html

Abort trap: 6

Any ideas what is going on? Of course, if I remove the first line of the example.rb file, it loads fine.

1
The memcached gem documentation says: 'You need Ruby 1.8.7 or Ruby 1.9.2. Other versions may work, but are not guaranteed.' So it might be a compatibility problem.Jesus Castello
I have ruby 2.2.0p0, how do I install Ruby 1.9.2? I have tried with RVM and this is what I get: RVM does not know how to build working ruby-1.9.2-p330 on OSX 10.10,. Thanks!Matias
If you can, I would recommend using the Dalli memcached client instead. It supports Ruby 1.9.3+Jesper
I will try it @Jesper. I am new on this: should I be able to perform every Memcached functionality with the Dalli cliente? Thanks!Matias
@Matias Dalli is a fully featured memcached client which has pretty much supplanted all the other memcached clients for ruby out there. It should have all the functionality you need.Jesper

1 Answers

0
votes

As Jesper suggested, I solved the issue using Dalli memcached client.