Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-15541

AWS SDK can mistake stream timeouts for EOF and throw SdkClientExceptions



    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.9.1, 2.8.4, 3.0.2, 3.1.1
    • 3.1.1
    • fs/s3
    • None


      I've gotten a few reports of read timeouts not being handled properly in some Impala workloads. What happens is the following sequence of events (credit to Sailesh Mukil for figuring this out):

      • S3AInputStream.read() gets a SocketTimeoutException when it calls wrappedStream.read()
      • This is handled by onReadFailure -> reopen -> closeStream. When we try to drain the stream, SdkFilterInputStream.read() in the AWS SDK fails because of checkLength. The underlying Apache Commons stream returns -1 in the case of a timeout, and EOF.
      • The SDK assumes the -1 signifies an EOF, so assumes the bytes read must equal expected bytes, and because they don't (because it's a timeout and not an EOF) it throws an SdkClientException.

      This is tricky to test for without a ton of mocking of AWS SDK internals, because you have to get into this conflicting state where the SDK has only read a subset of the expected bytes and gets a -1.

      closeStream will abort the stream in the event of an IOException when draining. We could simply also abort in the event of an SdkClientException. I'm testing that this results in correct functionality in the workloads that seem to hit these timeouts a lot, but all the s3a tests continue to work with that change. I'm going to open an issue with the AWS SDK Github as well, but I'm not sure what the ideal outcome would be unless there's a good way to distinguish between a stream that has timed out and a stream that read all the data without huge rewrites.




        1. HADOOP-15541.001.patch
          3 kB
          Sean Mackrory

        Issue Links



              mackrorysd Sean Mackrory
              mackrorysd Sean Mackrory
              0 Vote for this issue
              6 Start watching this issue