Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-1497

Allow to enable SO_LINGER option with zero timeout

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.3.3
    • 4.4 Alpha1
    • HttpClient (classic)
    • None

    Description

      According to http://docs.oracle.com/javase/8/docs/api/java/net/StandardSocketOptions.html#SO_LINGER linger option is disabled by default. Currently if SocketConfig.soLinger is set to zero (default value is -1), then Socket.setSoLinger(false, 0) will be called, so linger will be disabled, which is undesirable. Zero SO_LINGER timeout is the essential feature for HttpClient, without it we will fall into one of two options:
      1. With disabled SO_LINGER all system sockets can fall into TIME_WAIT status and client will stuck
      2. With enabled non-zero SO_LINGER client will wait up to 1 second at AbstractConnPool.getPoolEntryBlocking (Line 230) while closing expired connections under lock (this lock is already held by PoolingEntryFuture.get(), so there is no quick fix to release this lock for other threads)
      I had encountered both of these issues on live systems.

      I understand that this change will break backward compatibility of config interpretation, but can we have this in 4.4?

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            hirthwork Dmitry Potapov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment