Potential bug in Ruby bindings of Apache Qpid

· Read in about 2 min · (357 words) ·

I wanted to experiment with Ruby bindings of Apache Qpid.

Lets install the the server and client:

$ sudo yum install qpid-cpp-server ruby-qpid qpid-tools
$ service qpidd start

Now check which version of Ruby bindings have we installed here:

$ rpm -qi ruby-qpid
Name        : ruby-qpid
Version     : 0.8
Release     : 2.fc15
Architecture: x86_64
Install Date: Fri 13 Jan 2012 06:21:55 PM IST
Group       : Development/Ruby
Size        : 219877
License     : ASL 2.0
Signature   : RSA/SHA256, Wed 27 Jul 2011 06:41:06 PM IST, Key ID 067f00b6a82ba4b7
Source RPM  : ruby-qpid-0.8-2.fc15.src.rpm
Build Date  : Wed 09 Feb 2011 03:48:16 PM IST
Build Host  : x86-11.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : http://qpid.apache.org/
Summary     : Ruby language client for AMQP
Description :
The Apache Qpid project's Ruby language client for AMQP.

Okay, now lets create a simple script and send some messages.

#!/usr/bin/ruby
# file: qpid-test.rb
require 'qpid'

host = "localhost"
port = 5672
address = "amq.topic"
spec_marshal_file = "/usr/lib/ruby/site_ruby/1.8/qpid/spec_cache/amqp.0-10-qpid-errata.rb_marshal"
spec_object = Marshal.load(File.open(spec_marshal_file).read())

socket = TCPSocket.new(host, port)
connection = Qpid::Connection.new(socket, :spec => spec_object)
puts "Connection instance created..."

connection.open

puts "Connection instance opened..."

session    = connection.create_session
puts "Session initiated..."

receiver   = session.create_receiver address
puts "Receiver object created..."

sender     = session.create_sender address
puts "Sender object created..."


sender.send Qpid::Message.new :content => "Hello world!"

message = receiver.fetch Qpid::Messaging::Duration::SECOND
puts "#{message.content}"
session.acknowledge
connection.close

On running the script we should get a “Hello world!” message.

$ ruby qpid-test.rb
Connection instance created...
qpid-test.rb:13qpid-test.rb:13: [BUG] Segmentation fault
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

Aborted (core dumped)

This is not what we expected. What is wrong here? Perhaps a bug in the Ruby bindings.

Then I went to the source code repository of Ruby bindings on github.com: https://github.com/apache/qpid/tree/trunk/qpid/cpp/bindings/qpid/ruby

According to the instructions I installed the latest bindings:

$ sudo gem install qpid

And removed the one I installed earlier

$ yum erase ruby-qpid

Now thats funny because the gem I ended up installing using the command is: http://rubygems.org/gems/qpid QPID (Queriable Patient Inference Dossier, developed at Massachusetts General Hospital), which is not even related to Apache Qpid.

How am I supposed to installed the latest Ruby bindings for Apache Qpid client?