Segmentation Fault with Couchbase 1.3.14


#1

Hi,

Sorry to post this in this forum. I couldn’t figure out how to submit an issue using the issue tracker.

I am suffering from a Segmentation Fault with Couchbase 1.3.14 gem on Ubuntu 14.04.3 LTS
I tested with ruby 2.1.10@rails4.2 and 2.3.1@rails4.2

$ apt-cache show libcouchbase2-core Package: libcouchbase2-core Source: libcouchbase Version: 2.6.2-1 Architecture: amd64 Maintainer: Couchbase SDK Team <support@couchbase.com> Installed-Size: 712 Depends: libc6 (>= 2.15), libgcc1 (>= 1:4.1.1), libssl1.0.0 (>= 1.0.0), libstdc++6 (>= 4.6) Provides: libcouchbase2 Multi-Arch: same Homepage: http://www.couchbase.com/develop/c/current Priority: optional Section: libs Filename: pool/trusty/main/libc/libcouchbase/libcouchbase2-core_2.6.2-1_amd64.deb Size: 275904 SHA256: 028bb01795a0f2af252a42260e1d1d928928274721c956d12cbea225e4c9c239 SHA1: 167f041a9659bbd882afc0e02ba7e56a2087c677 MD5sum: 987f04f0f06300e26339f53efad19824 Description: library for the Couchbase protocol, core files libcouchbase is a library implementing Couchbase protocol. . This package provides the core for libcouchbase. It contains an IO implementation based on select(2). If preferred, you can install one of the available backends (libcouchbase2-libevent or libcouchbase2-libev). libcouchbase will automatically use the installed backend. It is also possible to integrate another IO backend or write your own. Description-md5: 7bebf69e53f067fcbeb90fda2068dda2

gem list couchbase *** LOCAL GEMS *** couchbase (1.3.14)

You can find segmentation fault log in this gist


#2

A single job runs just fine but it occurs as soon as I add another job into the Sidekiq queue when a job is running.


#5

does it fails every time or occasionally?


#6

Do you use prefixes when sending keys to the server? Could you try without them?


#7

Thanks @avsej for paying attention to this.

It occurs every time. I am new to Couchbase so I am not sure what you meant by ‘prefixes’ but the key format looks like this:

"device_market_apps:#{id}"


#8

Could you make sure that connection object is not shared between threads?


#9

@avsej I will try it and keep you posted. Thank you!


#10

@avsej You’ve made my day! It works. Thank you again.


#11

Hi again,

I’ve used a global connection instance to handle all the Couchbase connections and now I can’t use it any more. Do I need to specifically use ConnectionPool as below or does Couchbase gem handles connection_pool automatically?

::Couchbase::ConnectionPool.new(5, :hostname => host, :port => port)


#12

you have to specify it explicitly


#13

Hi @avsej,

I am wondering if I can reuse the connection once it is made in a thread, not between threads. It seems that re-connecting to Couchbase slows down the speed significantly.

D, [2016-08-09T12:48:57.285503 #23841] DEBUG -- : CouchbaseUtil.get executed 0.475940383s D, [2016-08-09T12:48:57.626489 #23841] DEBUG -- : CouchbaseUtil.set executed 0.340808652s


#14

ofcourse you should reuse connections. If you are not spawning threads too often, you could just put the connection into thread local storage via Thread.current, and you are safe.

Couchbase.bucket simplifies this task: