Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-7450

SSL peerAppDataBuffer expansion needs work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.10.0
    • 1.12.0
    • membership, messaging
    • None

    Description

      I commented out the first invocation of expandPeerAppData() in NioSslEngine.unwrap() and found that the handling of BufferOverFlowException in that method doesn't always handle increase of the decrypt buffer ("peerAppData") correctly with all cipher suites.

      The handling of that exception needs to ensure that it increases the capacity of the peerAppData buffer every time an overflow happens.  Repeated overflows should cause the buffer to keep expanding until it's big enough to hold the decrypted data.

      If that's done the initial invocation of expandPeerAppData() could be removed, saving us from having to perform calculations that usually aren't necessary.

      The exception handling could be something like this:

      int newCapacity = (peerAppData.limit() - peerAppData.position()) * 2 + peerAppData.position();
      newCapacity = Math.max(newCapacity, peerAppData.capacity() / 2 * 3);
      peerAppData = bufferPool.expandWriteBufferIfNeeded(TRACKED_RECEIVER, peerAppData, newCapacity);
      peerAppData.limit(peerAppData.capacity());
      break; 
      
      

      I've done informal testing of that change and it seems to work.  The test created a cache using 100k socket buffers and did puts using 70k byte-array payloads that were replicated to a second node.  TLSv1.2 was used as the SSL protocol.  Logging traces that I had in place showed the buffer increasing in capacity with each overflow exception until the buffer was big enough to hold the 70k+ decrypted update messages.

      Attachments

        Activity

          People

            echobravo Ernest Burghardt
            bschuchardt Bruce J Schuchardt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h 40m
                1h 40m