Can't get any data by using mono under Mac OS X


#1

Do you have the Beer Sample Bucket installed? if not, log into the management console and then Settings>Sample Buckets> and Select the beer-sample bucket.

Also, try using CouchbaseClient.ExecuteGet(…) and check the OperationResult’s status and message.

One other thing, make sure the view and the client are both looking at development views or if production, publish the view.

-Jeff


#2

Hi
I am new to Couchbase and really want to use it in our games.
The thing is when I try the simple code following the tutorial in this site, it just doesn’t work!

My test code is very simple:
in program.cs

using System;
using Couchbase;
using Enyim.Caching.Memcached;
using Newtonsoft.Json;

namespace CouchbaseTest
{
class MainClass
{
public static void Main (string[] args)
{
Console.WriteLine (“Hello World!”);
var client = new CouchbaseClient();
var savedBeer = client.Get(“new_holland_brewing_company-sundog”);
Console.WriteLine(savedBeer);

	}
}

}

in app.config file

<?xml version="1.0" encoding="utf-8"?>

and I can’t read any data from Get command, it just returns NULL.
I also tried copy this same project to windows and compile it with VS, using Microsoft.Net runtime. Turns out every thing is fine. I can get json string without problem.

My Mac OS X version is 10.9.2 and mono runtime is Mono JIT compiler version 3.2.6 ((no/9b58377 Thu Jan 16 17:49:56 EST 2014)
I tried .net lib version 1.3.3 and 1.3.4, neither works.
I also tried pull all couchbase .net source code from github and put them in my project, compile them and run, still no luck.

Does any one have this problem? Did I missed something?

thanks a lot!

Bowie


#3

Thanks Jeff!

I did install beer-sample both on Mac OS X and windows. As I said, on windows, it just works like a charm. But no luck on Mac. I also tried ExecuteGet and get “Unable to locate node” error message.

One question: how to make client looking at development view?

Thanks again!

Bowie


#4

Hmm, Unable to locate node errors are a generic issue usually caused by the client not properly bootstrapping. In Windows, this happens pretty often when you are running a HTTP debugger like fiddler or charles. You could have something similar happening here.

I would enable logging: http://docs.couchbase.com/couchbase-sdk-net-1.3/#configuring-logging and see what the log gives you.

To ensure the client is looking at the development views, you set the documentNameTransformer in the config:









Also, make sure you can hit ports 8091 and 8092 over HTTP.

-Jeff


#5

Hi Jeff
I can make a hit on 8091 and 8092.
On 8091, it will bring me to Cousebase manager website and on 8092, it gives me {“couchdb”:“Welcome”,“version”:“1.2.0a-a425d97-git”,“couchbase”:“2.5.0-1059-rel-enterprise”}

As for logging, I tried to do this yesterday and failed
I just follow the link you mentioned and change to
since there is no “c:” on Mac system but there was no such a file after I run my program.
One thing I can’t figure out is how to “set the log factory to NLogAdapter”. Should I write init code in my program or just add configuration section to app.config is ok.

Bowie


#6

Hi Jeff
I can make a hit on 8091 and 8092.
On 8091, it will bring me to Cousebase manager website and on 8092, it gives me {“couchdb”:“Welcome”,“version”:“1.2.0a-a425d97-git”,“couchbase”:“2.5.0-1059-rel-enterprise”}

As for logging, I tried to do this yesterday and failed
I just follow the link you mentioned and change to
since there is no “c:” on Mac system but there was no such a file after I run my program.
One thing I can’t figure out is how to “set the log factory to NLogAdapter”. Should I write init code in my program or just add configuration section to app.config is ok.

Bowie


#7

Hi Jeff
I managed to get logging to work.
Below is logging content:

2014-03-28 11:50:07.9679|WARN|Enyim.Caching.MemcachedClient|Creating new client. CID: 90d7ac9a-877d-4113-8fd7-bf724cca379f CouchbaseClient
2014-03-28 11:50:08.0093|WARN|Couchbase.CouchbasePool|Starting Couchbase.CouchbasePool
2014-03-28 11:50:08.0381|WARN|Couchbase.MessageStreamListener|Starting the listener. Queue=True
2014-03-28 11:50:08.0381|WARN|Couchbase.MessageStreamListener|Started working.
2014-03-28 11:50:08.0507|WARN|Couchbase.MessageStreamListener|Looking for the first working node.
2014-03-28 11:50:08.7313|WARN|Couchbase.MessageStreamListener|Resolved pool url http://127.0.0.1:8091/pools to http://127.0.0.1:8091/pools/default/bucketsStreaming/beer-sample?bucket_uuid=482b61e66598c8c16bd7b8fff764b103
2014-03-28 11:50:08.7316|WARN|Couchbase.MessageStreamListener|Start receiving messages.
2014-03-28 11:50:08.7647|WARN|Couchbase.CouchbasePool|Creating node Couchbase.CouchbasePool
2014-03-28 11:50:08.7794|ERROR|Couchbase.CouchbasePool|Failed to initialize the pool.
2014-03-28 11:50:23.4896|WARN|Couchbase.MessageStreamListener|HB: Pinging current node ‘http://127.0.0.1:8091/pools’ to check if it’s still alive.
2014-03-28 11:50:23.4919|WARN|Couchbase.MessageStreamListener|HB: Trying 'http://127.0.0.1:8091/pools
2014-03-28 11:50:23.4942|WARN|Couchbase.MessageStreamListener|Processing message: {“name”:“beer-sample”,“bucketType”:“membase”,“authType”:“sasl”,“saslPassword”:"",“proxyPort”:0,“replicaIndex”:false,“uri”:"/pools/default/buckets/beer-sample?bucket_uuid=482b61e66598c8c16bd7b8fff764b103",“streamingUri”:"/pools/default/bucketsStreaming/beer-sample?bucket_uuid=482b61e66598c8c16bd7b8fff764b103",“localRandomKeyUri”:"/pools/default/buckets/beer-sample/localRandomKey",“controllers”:{“compactAll”:"/pools/default/buckets/beer-sample/controller/compactBucket",“compactDB”:"/pools/default/buckets/default/controller/compactDatabases",“purgeDeletes”:"/pools/default/buckets/beer-sample/controller/unsafePurgeBucket",“startRecovery”:"/pools/default/buckets/beer-sample/controller/startRecovery"},“nodes”:[{“couchApiBaseHTTPS”:“https://192.168.88.188:18092/beer-sample",“couchApiBase”:“http://192.168.88.188:8092/beer-sample”,“replication”:1,“clusterMembership”:“active”,“status”:“healthy”,“otpNode”:“ns_1@192.168.88.188”,“thisNode”:true,“hostname”:“192.168.88.188:8091”,“clusterCompatibility”:131077,“version”:“2.5.0-1059-rel-enterprise”,“os”:“i386-apple-darwin11.4.2”,“ports”:{“httpsMgmt”:18091,“httpsCAPI”:18092,“sslProxy”:11214,“proxy”:11211,“direct”:11210}}],“stats”:{“uri”:"/pools/default/buckets/beer-sample/stats",“directoryURI”:"/pools/default/buckets/beer-sample/statsDirectory",“nodeStatsListURI”:"/pools/default/buckets/beer-sample/nodes"},“ddocs”:{“uri”:"/pools/default/buckets/beer-sample/ddocs"},“nodeLocator”:“vbucket”,“fastWarmupSettings”:false,“autoCompactionSettings”:false,“uuid”:“482b61e66598c8c16bd7b8fff764b103”,“vBucketServerMap”:{“hashAlgorithm”:“CRC”,“numReplicas”:0,“serverList”:[“192.168.88.188:11210”],“vBucketMap”:[[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0]]},“bucketCapabilitiesVer”:"",“bucketCapabilities”:[“touch”,"couchapi”]}

seems there is just one error: 2014-03-28 11:50:08.7794|ERROR|Couchbase.CouchbasePool|Failed to initialize the pool.

Bowie


#8

Yeah, it looks like your bootstrapping despite the “failed to initialize pool”. Try running a view request with logging enabled. Also, if you have the source, step through and try to find where it fails.


#9

Hi Jeff
After trace into source code, I found when execute code “socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Linger, true);”, it throw exception:Message “Value does not fall within the expected range.” and then logged out “Failed to initialize the pool” message.


#10

It looks like a bug specific to Mono. Would you mind filing a bug in jira? You can do so here: http://www.couchbase.com/issues/browse/NCBC

I’ll look into a fix for the May release of the 1.3.X client, otherwise feel free to take a stab at it and if you can fix it, please send a pull request on Github :slight_smile:

Thanks,

jeff


#11

After looked into C# documents, I found out that there is wrong writing code like: socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Linger, true);
the last argument should not be “true”.
After change code to

		LingerOption lingerOption = new LingerOption (true, 10);
		socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Linger, lingerOption);

I can manage to get data from Couchbase on Mac OS X!!!

Thanks a lot Jeff!!

Bowie