Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-10347

Client does not reconnect when the server closes a persistent connection

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 6.14.0
    • Component/s: None
    • Labels:
      None
    • Template:
      PUP Bug Template
    • Epic Link:
    • Team:
      Coremunity
    • Sprint:
      Platform Core KANBAN
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      It was possible for the new HTTP client to try to use a cached HTTP connection, but fail if the server had previously said the connection should be kept alive, but decided to close it later, such as if the server restarted.
    • QA Risk Assessment:
      Needs Assessment

      Description

      Puppet may fail to reuse a previously cached connection under the following conditions:

      1. It uses the new HTTP client
      2. The previous request was kept alive (the server didn't send Connection: close)
      3. The server closes the connection between the time that the client caches it and when the client tries to reuse it.

      Puppet will report that the connection was "interrupted after 0.001 seconds".

      The issue occurs because puppet's HTTP client makes a non-local return from the block passed to Net::HTTP#request. As a result the Net::HTTP#end_transport method is never called, which is what sets last_communication to the current timestamp. https://github.com/ruby/ruby/blob/v2_5_7/lib/net/http.rb#L1567

      The next time Net::HTTP#request is called, the client's side of the socket is still open and it interprets the nil last_communication value to mean "we've never used this connection before", so it skips the call to Net::HTTP#connect. https://github.com/ruby/ruby/blob/v2_5_7/lib/net/http.rb#L1537-L1546

      But as soon as it tries to write the request and read the response, EOFError is raised.

        Attachments

          Activity

            People

            Assignee:
            josh Josh Cooper
            Reporter:
            josh Josh Cooper
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support