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

Add a reason for ConnectionClosedEvent

    XMLWordPrintable

Details

    • New Feature
    • Status: Backlog
    • Minor - P4
    • Resolution: Unresolved
    • None
    • None
    • Connectivity
    • None

    Description

      Previously we didn't add a reason field into ConnectionClosedEvent because this event is called from Dispose method and we didn't have a way to determine for what reason this method has been called.

      But as we found in the scope of https://jira.mongodb.org/browse/HELP-18973, this value can be helpful for some connectivity investigations.

      Two options which were discussed in the slack:

      1. Add a new Close(ConnectionClosedReason reason) method which will contain triggering event logic and Dispose logic. The disadvantage of this way (additionally to having Close and Dispose methods for the same class) is that it's unclear whether Dispose method should still have triggering events or no. If yes, we still can potentially have the same issue with empty reason field as we have now, if no - then we can have the potential situation without ConnectionClosedEvent at all.
      2. Investigate how this logic works in java. As far as I can see they trigger the ConnectionClosedEvent before calling stream.Close (afaik, this is an equivalent of stream.Dispose in c#): https://github.com/mongodb/mongo-java-driver/blob/91e670f86303121c7afe68145d3ca5d341079506/driver-core/src/main/com/mongodb/internal/connection/DefaultConnectionPool.java#L598 

      Attachments

        Activity

          People

            Unassigned Unassigned
            dmitry.lukyanov@mongodb.com Dmitry Lukyanov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: