0
votes

currently I'm using Azure cache in my WCF application, and I got this exception when putting data into cache:

Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode< ERRCA0017 >:SubStatus< ES0006 >:There is a temporary failure. Please retry later. (One or more specified cache servers are unavailable, which could be caused by busy network or servers. For on-premises cache clusters, also verify the following conditions. Ensure that security permission has been granted for this client account, and check that the AppFabric Caching Service is allowed through the firewall on all cache hosts. Also the MaxBufferSize on the server must be greater than or equal to the serialized object size sent from the client.)

And here's the inner exception:

System.ServiceModel.CommunicationException: The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:00:30'. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at System.ServiceModel.Channels.SocketConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout) --- End of inner exception stack trace --- at System.ServiceModel.Channels.SocketConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout) at System.ServiceModel.Channels.SocketConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout, BufferManager bufferManager) at System.ServiceModel.Channels.BufferedConnection.WriteNow(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, BufferManager bufferManager) at System.ServiceModel.Channels.BufferedConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout, BufferManager bufferManager) at System.ServiceModel.Channels.FramingDuplexSessionChannel.OnSend(Message message, TimeSpan timeout) at System.ServiceModel.Channels.OutputChannel.Send(Message message, TimeSpan timeout) at Microsoft.ApplicationServer.Caching.CacheResolverChannel.Send(Message message, TimeSpan timeout) at Microsoft.ApplicationServer.Caching.WcfClientChannel.SendOnChannel(EndpointID endpoint, TimeSpan& timeout, WaitCallback callback, Object state, Boolean async, IDuplexSessionChannel channel, Message message) --- End of inner exception stack trace --- at Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ResponseBody respBody) at Microsoft.ApplicationServer.Caching.DataCache.ExecuteAPI(RequestBody reqMsg, IMonitoringListener listener) at Microsoft.ApplicationServer.Caching.DataCache.InternalPut(String key, Object value, DataCacheItemVersion oldVersion, TimeSpan timeout, DataCacheTag[] tags, String region, IMonitoringListener listener) at Microsoft.ApplicationServer.Caching.DataCache.<>c_DisplayClass19.b_18() at Microsoft.ApplicationServer.Caching.MonitoringListenerFactory.EmptyListener.Microsoft.ApplicationServer.Caching.IMonitoringListener.Listen[TResult](Func`1 innerDelegate) at Microsoft.ApplicationServer.Caching.DataCache.Put(String key, Object value)

The problem is this message is very general, doesn't give much details

I already tried to increase requestTimeout in dataCacheClient to 2 minutes. This doesn't solve the problem, so it should not because of connection to cache timeout

I know it's not because of amount of data too big also, because the same amount of data on production server doesn't have problem (this happens on testing server). I connect from local computer to testing database and also don't have problem

Anyone has any ideas how to solve this problem? Thanks

Below is my current configuration for Azure cache

<dataCacheClient name="default" requestTimeout="30000" isCompressionEnabled="true" >
  <localCache isEnabled="true" sync="TimeoutBased" objectCount="4194304" ttlValue="80000" />
</dataCacheClient>
1
well, Microsoft's error messages are often very general.Raptor

1 Answers

0
votes

Please set ReceiveTimeout Property between 40-50 seconds in your code to avoid socket timeouts.

Have a retry logic in your code to retry the operation if the error suggests so.

And if this issue persists over longer period of time then take a look at the cache instance performance counters to see if you are nearing 100% limit or maxing out capacity in some sense in which case you should reassess your capacity, refer Capacity Planning Considerations for In-Role Cache (Windows Azure Cache)