title: Azure function exception - Error writing logs to table storage: Microsoft.Azure.Cosmos.Table.StorageException
body: <p>I have an azure function that communicates with blob storage to read the last sync date time and then based on that, reading the data from the Cosmos database.</p>
  <p>Few interactions work fine and randomly throwing the following exception in some cases</p>
  <blockquote>
  <p>&quot;Error writing logs to table storage:
  Microsoft.Azure.Cosmos.Table.StorageException: An operation on a
  socket could not be performed because the system lacked sufficient
  buffer space or because a queue was full. ---&gt;
  System.Net.Http.HttpRequestException: An operation on a socket could
  not be performed because the system lacked sufficient buffer space or
  because a queue was full. ---&gt; System.Net.Sockets.SocketException
  (10055): An operation on a socket could not be performed because the
  system lacked sufficient buffer space or because a queue was full. at
  System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port,
  CancellationToken cancellationToken) --- End of inner exception stack
  trace --- at System.Net.Http.ConnectHelper.ConnectAsync(String host,
  Int32 port, CancellationToken cancellationToken) at
  System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage
  request, Boolean allowHttp2, CancellationToken cancellationToken) at
  System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage
  request, CancellationToken cancellationToken) at
  System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage
  request, CancellationToken cancellationToken) at
  System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage
  request, Boolean doRequestAuth, CancellationToken cancellationToken)
  at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage
  request, CancellationToken cancellationToken) at
  System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage
  request, CancellationToken cancellationToken) at
  System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task<code>1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts) at Microsoft.Azure.Cosmos.Table.RestExecutor.TableCommand.Executor.ExecuteAsync[T](RESTCommand</code>1
  cmd, IRetryPolicy policy, OperationContext operationContext,
  CancellationToken token) --- End of inner exception stack trace --- at
  Microsoft.Azure.Cosmos.Table.RestExecutor.TableCommand.Executor.ExecuteAsync[T](RESTCommand<code>1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token) at Microsoft.Azure.WebJobs.Logging.Utility.SafeExecuteAsync(CloudTable table, TableBatchOperation batch) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Logging\Internal\Utility.cs:line 178 at Microsoft.Azure.WebJobs.Logging.Utility.WriteBatchAsync[T](ILogTableProvider logTableProvider, IEnumerable</code>1 e1) in
  C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Logging\Internal\Utility.cs:line
  268 at
  Microsoft.Azure.WebJobs.Logging.LogWriter.FlushTimelineAggregateAsync(Boolean
  always) in
  C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Logging\Internal\LogWriter.cs:line
  265 at Microsoft.Azure.WebJobs.Logging.LogWriter.FlushCoreAsync() in
  C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Logging\Internal\LogWriter.cs:line
  316 Request Information RequestID: RequestDate: StatusMessage:
  ErrorCode:&quot;</p>
  </blockquote>
  <p>Can any one advise me how I can fix it?</p>