Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1547

Transient error handling

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.1
    • Labels:
      None
    • Environment:

      We have a web application that queries a MongoDB database and as we have thousands of documents we paginate on MongoDB (I tell this but I do not think it matters) and if we do not interact with the web application for some minutes, then, when we start again the first request it fails (it is probably a timeout) and the MongoDB Driver throws this exception:
      Type: MongoConnectionException,
      StackTrace: at MongoDB.Driver.Linq.MongoQueryProviderImpl`1.Execute(Expression expression)
      at MongoDB.Driver.Linq.MongoQueryProviderImpl`1.Execute[TResult](Expression expression)
      at System.Linq.Queryable.Count[TSource](IQueryable`1 source)

      Next requests go okay.

      So far, we have wrapped all requests to MongoDB with Func<T> and Actions so we perform a simple retry strategy but this has some problems:
      1) We have to wrap all MongoDB calls within Func<T> so there is high probability that we miss some statements
      2) The retry works fine but the Exception is not thrown right away. It is thrown like 30-45 seconds after the request are sent.

      So we would like to have some mechanism to handle these situations centrally (for example, in Entity Framework you can inject the transient error handling strategy by means of subclasses).

            Assignee:
            Unassigned Unassigned
            Reporter:
            suikevil Roberto PĂ©rez
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: