Error while using ruby sdk with EventMachine


I’m getting this error when trying to start your goliath example:

couchbase-ruby-client/examples/chat-goliath-grape# ruby app.rb -sv [26428:INFO] 2014-03-04 15:59:43 :: Starting server on in development mode. Watch out for stones. ruby: ed.cpp:927: virtual void ConnectionDescriptor::Write(): Assertion `!bWatchOnly' failed.

I tried both CouchbaseMock and Couchbase 2.2, same.

Any ideas?


What ruby version are you using?


Tried both ruby-2.0.0-p247 [ x86_64 ] and ruby-2.0.0-p353 [ x86_64 ], same.

I’m using Ubuntu 12.04.


does it fail immediately, or after first query


On start, no queries made. Looks like fails when try to initialize connection pool.


I managed to reproduce it couple of times, but it was always after some activity. Will look into it


Any updated on this issue? Thanks!


so far I cannot reproduce it reliably. but i will keep trying


Any updates? Its becoming pretty critical issue, since moxi, which used for 3-rd party clients, crashing a lot under relatively high load. I minimized test-case, crashing every time for me:

require 'eventmachine' require 'em-synchrony' require 'couchbase'

EM.epoll # if we removing epoll all working as expected, but goliath require it
EM.synchrony do => :eventmachine, bucket: “default”, :node_list => [“localhost:8091”])



Here is strace output, can be useful:


okay, I’ve got it reproducing each time with your script. Thanks. I will try to find a solution



Thanks for feedback


The patch has been merged to master branch, so feel free to update your Gemfile pointing to github mirror. Next release will be in the beginning of the April


Perfect. Thanks!


After some time i started getting another error, don’t know if it connected with this issue, but who knows.

ruby: ed.cpp:1025: void ConnectionDescriptor::_WriteOutboundData(): Assertion `nbytes > 0’ failed.

I can’t provide reliable test for now, it fails only after some time.


Worth noticing that error happens while couchbase had rebalance.


Recorded on bug tracker. If you will get any updates, please reply there.



Here is core dump for nbytes > 0 issue:

As before it happens only when rebalance is active. So when i start rebalance everything goes down :slight_smile:


Worth noticing that we having server troubles

And it happened that this error wont go away when i stopped rebalance…


yes, it uses plain socket(2) call to create sockets, but all IO done in ruby extension, not in libcouchbase.

In particular socket created here


I have to disable EM engine for a while, and added “TCPSocket = EventMachine::Synchrony::TCPSocket”, problem gone for some time. But i have feeling that overriding TCPSocket wont affect couch driver, since it use own C library for sending requests.