Error: "Value was too large or too small for an Int32"

We are experiencing a problem because of the following error message:

System.OverflowException: Value was either too large or too small for an Int32.
    at System.Convert.ThrowInt32OverflowException()
    at System.Convert.ToInt32(Int64 value)
    at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
    at Newtonsoft.Json.Linq.Extensions.Convert[T,U](T token)
    at Couchbase.Management.Buckets.BucketManager.GetBucketSettings(JToken json)
    at Couchbase.Management.Buckets.BucketManager.GetAllBucketsAsync(GetAllBucketsOptions options)
 [19:48:06 INF] Client connected
 [19:48:06 INF] Waiting for client to connect...
 [19:48:08 INF] Attempting to get all buckets -
 [19:48:08 ERR] Failed to get all buckets -

This is similar to issue this issue: GetAllBucketsSettings…, in that the result is “Failed to get all buckets”. However, the message is slightly different.

We are not explicitly requesting a list of buckets in our code. Rather, this is a simple key/value IO to a single bucket.

Couchbase 6.6.2, Enterprise Edition
CouchbaseNetClient, 3.1.7
Couchbase.Transactions, 1.0.0

This is happening in all of our environments.

Based on that information, its likely an overflow here: couchbase-net-client/BucketManager.cs at master · couchbase/couchbase-net-client · GitHub (or below). Here is a ticket for tracking.

Based on the stacktrace provided this is encountered in the Management API and not the Key Value API , so I don’t quite understand this statement. Can you elaborate?


Thanks for opening the ticket. I will follow it.
I guess what I was saying is that our code is not requesting a list of buckets anywhere, and that all we are doing is fairly simple KV operations. Because our code is not referenced at all in the stacktrace, I didn’t know if/where something that we were doing was causing the problem.
I’m sure you’re right that it is in the Management API, which I was unaware of before this post.
I will say that I’ve noticed that when our service is running (it runs in k8s and is monitored by healthchecks), there is a high value for ops/sec being registered in the Couchbase console (~10,000). These operations are not, to my knowledge, any of our business code as very little work is getting done due to the problem. Eventually the service fails and the operations stop.
I will also add that we do use Couchbase.Transactions in our code. I don’t know if that might be relevant, but I’ll let it be known anyway.

Hi @malclear , thanks for letting us know.

I suspect the bucket listing could be coming from the transactions library. Though the end behavior here isn’t expected. Long story short, there is some metadata work for transactions that will have the clients performing some operations in the background. I don’t know that’s for certain what you’re observing without getting more info.

A couple of questions to help diagnose:

  • How many buckets are you using from the app to the cluster?
  • How many client instances are connecting to the cluster?

Is it this system overflow that causes your service to stop? We’ll definitely want to get to the bottom of it.

@Richard_Ponton, any thoughts?

One other update @malclear, we may have found the problem. I think we’ll be able to get you some more info on Monday.

@ingenthr, The Transactions library does call GetAllBucketsAsync in the background cleanup thread.

I’ve opened a ticket using our paid support on this subject. I will post the resolution to the issue here when that process is complete.

1 Like

Thanks much. If you have an Enterprise Subscription, that’s certainly the right thing to do. It’ll go to some of the same people, but of course the service level commitment is different. Thanks!