.NET BufferedStream error

We are using Couchbase Server 2.5.0 on Windows 2012 R2. The server has been running for quite some time now and we don’t typically flush anything nor do we touch anything - it just runs. In either case, the following error is now being thrown by our webservers when making calls to the CouchBase server:

System.Exception:

  • -1: System.NotSupportedException: Cannot write to a BufferedStream while the read buffer is not empty if the underlying stream is not seekable. Ensure that the stream underlying this BufferedStream can seek or avoid interleaving read and write operations on this BufferedStream. at System.IO.BufferedStream.ClearReadBufferBeforeWrite() at System.IO.BufferedStream.Write(Byte[] array, Int32 offset, Int32 count) at Memcached.ClientLibrary.SockIO.Write(Byte[] bytes, Int32 offset, Int32 count) in C:\Users\Matt\Downloads\clientlib\SockIO.cs:line 411 at Memcached.ClientLibrary.SockIO.Write(Byte[] bytes) in C:\Users\Matt\Downloads\clientlib\SockIO.cs:line 391 at Memcached.ClientLibrary.MemcachedClient.Get(String key, Object hashCode, Boolean asString) in C:\Users\Matt\Downloads\clientlib\MemCachedClient.cs:line 1118 at Memcached.ClientLibrary.MemcachedClient.Get(String key) in C:\Users\Matt\Downloads\clientlib\MemCachedClient.cs:line 1068 at ShopVisible.Core.ParsingEngine.baseFunctions.isCachedHtml(XmlNode functionNode, String& retValContent) in D:\working\ShopVisible.v2\ShopVisible.Core\Shopvisible.Core.ParsingEngine\baseFunctions.cs:line 1009 at ShopVisible.Core.ParsingEngine.baseFunctions.parseCachedHTML(XmlDocument document) in D:\working\ShopVisible.v2\ShopVisible.Core\Shopvisible.Core.ParsingEngine\baseFunctions.cs:line 1103 at ShopVisible.Core.ParsingEngine.baseFunctions.parseAllData(XmlDocument oDoc) in D:\working\ShopVisible.v2\ShopVisible.Core\Shopvisible.Core.ParsingEngine\baseFunctions.cs:line 1297 at ShopVisible.Core.ParsingEngine.baseParser.buildPage(String templateToParse) in D:\working\ShopVisible.v2\ShopVisible.Core\Shopvisible.Core.ParsingEngine\baseParser.cs:line 671
  • at _Default.Page_Load(Object sender, EventArgs e)

    I’m not sure how to reproduce it but it is happening sporadically. Where / how do I begin troubleshooting this? We have never had to troubleshoot CouchBase before so assume I am new to the whole thing.

    Thanks in advance!
    Jignesh

    Hi jigneshp,

    This looks like a client side issue. From the stack trace I can see you are using .NET memcached client library which is not owned by Couchbase. You might want raise a question directly with them, the project has been dormant for sometime so you might not get a reply :(. I also see that someone else has hit this over two years ago and did not get an answer.

    Maybe this is a good excuse to start looking at using the official Couchbase SDK?

    Sorry I could not help more.

    I believe the Memcache library you are referring to is the one that we are using since we wrote the code. I just don’t understand the Memcache / Couchbase install to know how to make sense of the error.

    I’ll let this stay here in case others have any suggestions but I will go contact the developers of the library.

    Thanks,
    Jignesh