Getting intermittent error of "Failed to initialize the pool"

We’re using version 1.2.6 of the .NET client and version 2.0.1 community version of the server.

We will occasionally get a flood of the following errors. We are seeing this error in an MVC application. I’ve done quite a bit of google’fu and haven’t seen anything about this couchbase issue. Also note that this seems to happen randomly, although I’m still investigating.

message: Failed to initialize the pool.
level: Error
stacktrace: at System.Web.AspNetSynchronizationContext.OperationStarted() at System.Net.WebClient.DownloadStringAsync(Uri address, Object userToken) at Couchbase.DefaultHttpClient…ctor(Uri baseUri, String username, String password, TimeSpan timeout, Boolean shouldInitConnection) at Couchbase.DefaultHttpClientFactory.Create(Uri baseUri, String username, String password, TimeSpan timeout, Boolean shouldInitializeConnection) at Couchbase.Configuration.CouchbaseClientSection.Couchbase.Configuration.ICouchbaseClientConfiguration.CreateHttpClient(Uri baseUri) at Couchbase.CouchbaseNode…ctor(IPEndPoint endpoint, Uri couchApiBase, ICouchbaseClientConfiguration config, ISaslAuthenticationProvider authenticationProvider) at Couchbase.CouchbasePool.CreateNode(IPEndPoint endpoint, ISaslAuthenticationProvider auth, Dictionary`2 nodeInfo) at Couchbase.CouchbasePool.InitVBucket(ClusterConfig config, ISaslAuthenticationProvider auth) at Couchbase.CouchbasePool.ReconfigurePool(ClusterConfig config)

message: An asynchronous operation cannot be started at this time. Asynchronous operations may only be started within an asynchronous handler or module or during certain events in the Page lifecycle. If this exception occurred while executing a Page, ensure that the Page is marked <%@ Page Async=“true” %>.

loggername: Couchbase.CouchbasePool

Not saying this is a solution, since there probably is an underlying issue, but have you tried using the AsyncController and/or making your action method async and then you kick off a new Task calling the Couchbase specific operation. Not sure if that is even possible in your use-case, though. And again, a hack.

Hello -

I’ll take a deeper look into this…curious are using plain vanilla controllers or AsyncController?

In the meantime, I created a jira ticket for you to monitor:

We are using AsyncControllers. It does not appear that the couchbase methods we are using are actually marked as async methods. This appears to be something that is happening under the hood of couchbase.

To clarify, we have hooked up NLog to couchbase, so that is how we’re gaining visibility into these internal couchbase client errors.

See my answer to a similar issue that is likely the solution (workaround as of now) for this one as well: System.InvalidOperationException with Couchbase and the .Net SDK