Segfault when trying to use :observe option

The only change in code is added :observe => {:persisted => 1} to set operation.

Here is what happens: https://gist.github.com/buger/01239d8ffe22b0f3ffca
Bug happen when using eventmachine engine. Do not see such errors when using in Rails.

I think i know how it happen, and here is test case that fails every time for me:

require 'couchbase'
require 'em-synchrony'
require 'em-synchrony/em-http'
 
EventMachine.synchrony do
    couch = Couchbase::Bucket.new(:engine => :eventmachine)
 
    couch.set(Time.now.to_s,'test', :observe => {:persisted => 1, :timeout => 10000000}) 
 
    EM.stop
end
# Should give: Couchbase::Error::Timeout: the observe request was timed out

No matter how much timeout i set, it always timeouts when using eventmachine engine.

On the other hand i found that this code works:

require 'couchbase'
require 'em-synchrony'
require 'em-synchrony/em-http'
 
EventMachine.synchrony do
    couch = Couchbase::Bucket.new(:engine => :eventmachine)
 
    key = Time.now.to_s
 
    couch.run do |conn|
        conn.set(key,'test', :persisted => 1)
    end
 
    EM.stop
end

Can you say if it is safe to use "async" mode with EM?

yes, it is okay to use this kind of API, and it works here. does it fail on the local server?

It fail both on local and production servers. And looks like CouchbaseMock too.

0 Answers

No answers yet