.NET client / AspNet Exceptions

@jmorris Any tips on how to hook up aspnet with the above configuration? I’m sure it’s a simple oversight, but I’m now seeing:
Exception information:
Exception type: ConfigurationErrorsException
Exception message: Object reference not set to an instance of an object.

And, this points to the asp declaration:

<sessionState cookieless="false" regenerateExpiredSessionId="true" mode="Custom" cookieName="ASP.Net_SessionId" customProvider="couchbaseAspNet" timeout="59">
           <providers>
             <add name="couchbaseAspNet" type="Couchbase.AspNet.SessionState.CouchbaseSessionStateProvider, Couchbase.AspNet" bucket="transient1" headerPrefix="header::" dataPrefix="session::" />
           </providers>
         </sessionState>

Still monkeying around with this…

@unhuman -

There were some config changes for 2.0 - you can read the docs here: https://github.com/couchbaselabs/couchbase-aspnet

The example up there should also help. Could you provide the entire stacktrace and exception details?

-Jeff

@jmorris So, the example config is not compatible with the configuration provided for the sectionGroup based hierarchy to get it to work with muxio. Here’s what I have for the various aspects… This stuff worked fine before our attempts to get muxio working (many incarnations, obviously)… We’ve been using AspNet 2.0.0 for quite some time already.

<configSections>
  <sectionGroup name="couchbase">
    <section name="multiplexio" type="Couchbase.Configuration.Client.Providers.CouchbaseClientSection, Couchbase.NetClient" />
  </sectionGroup>
  <!-- OTHER STUFF -->
</configSections>

And then…

<sessionState cookieless="false" regenerateExpiredSessionId="true" mode="Custom" cookieName="ASP.Net_SessionId_Guest" customProvider="couchbase" timeout="59">
  <providers>
    <add name="couchbase" type="Couchbase.AspNet.SessionState.CouchbaseSessionStateProvider, Couchbase.AspNet" bucket="transient1" headerPrefix="header::" dataPrefix="session::" />
  </providers>
</sessionState>

There error reported below (line 254) is actually on the : <add name="couchbase" ... > line above

I’ve experimented with various things populating the customProvider name to try and see if that’s what links it up to the other configuration… Didn’t seem to make a difference. Before we had a nested hierarchy,

And then…

<couchbase>
  <multiplexio enableConfigHeartBeat="false" useSsl="false">
    <servers>
      <add uri="http://dv20-chb1-dev-bootstrap-vip.core.cvent.org:8091/pools" />
    </servers>
    <buckets>
      <add name="transient1" password="" useSsl="false">
        <connectionPool name="custom" waitTimeout="5000" shutdownTimeout="3000">
        </connectionPool>
      </add>
      <add name="data1" password="" useSsl="false">
        <connectionPool name="custom" waitTimeout="5000" shutdownTimeout="3000">
        </connectionPool>
      </add>
    </buckets>
    <connectionPool name="custom" type="Couchbase.IO.ConnectionPool`1[Couchbase.IO.MultiplexingConnection], Couchbase.NetClient"></connectionPool>
    <ioService name="multiplexio" type="Couchbase.IO.Services.MultiplexingIOService, Couchbase.NetClient" />
  </multiplexio>
</couchbase>

Here is the response:
Event code: 3008
Event message: A configuration error has occurred.
Event time: 2/7/2017 9:05:23 PM
Event time (UTC): 2/8/2017 2:05:23 AM
Event ID: 4196d5e24e114bcebf728369ffa36064
Event sequence: 2
Event occurrence: 1
Event detail code: 0

Application information:
Application domain: /LM/W3SVC/2/ROOT/events-1-131309931190961097
Trust level: Full
Application Virtual Path: /events
Application Path: C:\local.git\dir\VSProjects\Company\Application\
Machine name: HUMAN-W02

Process information:
Process ID: 6916
Process name: w3wp.exe
Account name: COMPANY\IISMan

Exception information:
Exception type: ConfigurationErrorsException
Exception message: Object reference not set to an instance of an object. (C:\company.git\dir\VSProjects\Company\Application\web.config line 254)
at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType)
at System.Web.SessionState.SessionStateModule.SecureInstantiateProvider(ProviderSettings settings)
at System.Web.SessionState.SessionStateModule.InitCustomStore(SessionStateSection config)
at System.Web.SessionState.SessionStateModule.InitModuleFromConfig(HttpApplication app, SessionStateSection config)
at System.Web.SessionState.SessionStateModule.Init(HttpApplication app)
at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers)
at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context)
at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context)
at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)

Object reference not set to an instance of an object.
at Couchbase.Configuration.Client.ClientConfiguration…ctor(ICouchbaseClientDefinition definition)
at Couchbase.AspNet.ClusterClient.Configure(String name, NameValueCollection config)
at Couchbase.AspNet.SessionState.CouchbaseSessionStateProvider.Initialize(String name, NameValueCollection config)
at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType)

Request information:
Request URL: http://localhost/Application/
Request path: /Application/
User host address: ::1
User:
Is authenticated: False
Authentication Type:
Thread account name: COMPANY\IISMan

Thread information:
Thread ID: 10
Thread account name: COMPANY\IISMan
Is impersonating: False
Stack trace: at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType)
at System.Web.SessionState.SessionStateModule.SecureInstantiateProvider(ProviderSettings settings)
at System.Web.SessionState.SessionStateModule.InitCustomStore(SessionStateSection config)
at System.Web.SessionState.SessionStateModule.InitModuleFromConfig(HttpApplication app, SessionStateSection config)
at System.Web.SessionState.SessionStateModule.Init(HttpApplication app)
at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers)
at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context)
at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context)
at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)

Custom event details:

@jmorris When you have another minute - we’re still kind of stuck here.

@unhuman -

Sorry for the delay, I’ll take a look at getting this later today and provide an example and/or fix if I can.

Thanks,

Jeff

@unhuman -

I pushed an example of configuring for muxio here: https://github.com/couchbaselabs/couchbase-aspnet/tree/muxio-example

-Jeff

1 Like

@unhuman these settings will also allow you to configure the client so that you do not get in a pool-starvation state w/the default pooling IO.

-Jeff

1 Like

@jmorris,

Thanks for the suggestions. We’ve got a functioning configuration now.

We have noticed, however, that logged messages say: Couchbase.IO.ConnectionPool`1[[Couchbase.IO.IConnection

We were expecting them to reference:
Couchbase.IO.ConnectionPool`1[[Couchbase.IO.MultiplexingConnection

Unless MultiplexingConnection is an IConnection and that’s expected…

-H

1 Like

@jmorris

We’ve been running load tests with MultiplexingIO on and it seems to be roughly equivalent to our existing connections. That’d be a win.

We have uncovered some (3 so far) new failure paths that I wanted to run by you to see about mitigation:

1: Timeouts?

 logger: Couchbase.AspNet.SessionState.SessionStateItem
   message: { [-]
     Exception: null
     Key: PREFIX::header::2hpfbm0akuebydcy2slfavlj
     Message: The operation has timed out.
     Status: OperationTimeout

2: Notice the garbage logged.

 logger: Couchbase.AspNet.SessionState.SessionStateItem
   message: { [-]
     Exception: null
     Key: L2::Events::header::5gc32vini142wsaeeo0qtqzh
     Message: Expected opaque 133617 but got 133301??????e
     Status: ClientFailure
   } 

^ this confuses me, since it’s logging Header.Opaque, which is a uint… Where’s the trailing garbage come from?

3:

   logger: Couchbase.IO.ConnectionBase
   message: System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Couchbase.IO.Converters.DefaultConverter.CopyAndReverse(Byte[] src, Int32 offset, Int32 length)
   at Couchbase.IO.Converters.DefaultConverter.ToInt32(Byte[] buffer, Int32 offset, Boolean useNbo)
   at Couchbase.IO.Converters.DefaultConverter.ToInt32(Byte[] buffer, Int32 offset)
   at Couchbase.IO.MultiplexingConnection.ParseReceivedData()
   at Couchbase.IO.MultiplexingConnection.ReceiveThreadBody()

Thanks - H

@unhuman -

It’s hard to get a complete picture of what’s going on here, but here are my initial thoughts:

1 - Not sure what exactly caused this specific timeout, but they can happen for a number of reasons - It could be you overloaded your server hardware or a network glitch. The client will timeout an operation before it blocks indefinitely.
2 - I suspect the garbage is because the operation was terminated mid-flight, so you have a partial read.
3 - I am not 100% sure why this would occur tbh - it could be a side effect of a timeout.

One thing to note with muxio is that you have multiple operations being read at that same time or waiting to write, if a connection is torn down all operations using that connection will fail. Also, the 2.4.0 release has several bug fixes and improvements for muxio and 2.4.1 will also.

If you get to a point where this is reproducible, please create a Jira ticket. Additionally, I’ll have our QE team monitor this while we test.

Thanks!

-Jeff