Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-3732

Distributed cache clients should use a timeout when opening a connection

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

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.0.0, 1.1.0, 0.7.1, 1.1.1, 1.0.1
    • 1.3.0
    • None
    • None

    Description

      The DistributedMapCacheClient and DistributedSetCacheClient open a socket connection using a CommsSession, either StandardCommsSession or SSLCommsSession.

      StandardCommsSession does the following to create a connection:

      socketChannel = SocketChannel.open(new InetSocketAddress(hostname, port));
      socketChannel.configureBlocking(false);
      

      The problem is that calling open() with the address calls connect before we have put the channel in non-blocking mode, so we could block indefinitely here.

      We should consider calling open(), then set a socket timeout from the timeout property in the cache client, and then call connect(address).

      The SSLCommsSession works slightly differently because it uses the SSLSocketChannel, but we should be able to do the same thing and pass in the SocketChannel after connecting as described above.

      In addition, the clients implement a close() method from the cache client interface, and its called from finalize(), but there should be an lifecycle method that calls close when the service is stopped.

      Attachments

        Activity

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

          People

            bbende Bryan Bende
            bbende Bryan Bende
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment