Uploaded image for project: 'Qpid'
  1. Qpid
  2. QPID-952

.NET NetworkStream does not immediately detect connection failure.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • M1, M2, M2.1
    • None
    • .NET Client
    • None

    Description

      Summary:
      The NetworkStream used by the Blocking IO does not immediately report the underlying socket connection failure. It can take up to 20 seconds before this is reported. According to the API:

      http://msdn2.microsoft.com/en-us/library/system.net.sockets.networkstream.read(VS.71).aspx

      The Read call only returns zero when the connection has been closed. So we can close the underlying socket which will stop all sends and force an exception on the next read attempt. This in turn will cause failover to be triggered.

      Defect Identification:
      When running with debug on you can see lots of 'Read() 0' logged out when the broker is killed. This is due to the NetworkStream returning 0 instantly as described in the API docs, as a result of the socket being gracefully shutdown. Unfortunately it is still possible to send data without an exception so sends can be lost.

      Proposed Changes:
      If we get 0 bytes being read from the NetworkStream we can block sends and shutdown the socket which will cause failover to occur in the next read loop.

      Attachments

        Activity

          People

            Unassigned Unassigned
            ritchiem Martin Ritchie
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: