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 0.0.0.0:9000 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
Couchbase::Bucket.new(:engine => :eventmachine, bucket: “default”, :node_list => [“localhost:8091”])

EventMachine.stop

end

Here is strace output, can be useful: https://gist.github.com/buger/4f45910ae84c139c4ca5

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

Fixed http://review.couchbase.org/34738

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.

https://www.couchbase.com/issues/browse/RCBC-169

Thanks

Here is core dump for nbytes > 0 issue: https://www.dropbox.com/s/ssltscvgyxz7va4/core.tgz

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 http://www.couchbase.com/communities/q-and-a/data-loss-251

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 https://github.com/couchbase/couchbase-ruby-client/blob/master/ext/couchbase_ext/plugin_common.c#L134-L151

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.