Repository navigation
fix: Close instruction file and reEncryptInstructionFile GetObject Response Streams - #541
Open
akareddy04 wants to merge 1 commit into
Open
akareddy04 wants to merge 1 commit into
akareddy04 wants to merge 1 commit into
Conversation
Fixes #539. ContentMetadataDecodingStrategy.loadInstructionFileMetadata parsed the instruction file GetObject stream with JsonNodeParser and never closed it. The parser stops at the end of the JSON value without reading to EOF, so the instruction file client's pooled connection was never released; after maxConnections decrypting GetObject calls, requests time out waiting for a connection. The stream is now closed with try-with-resources, including when parsing fails. S3EncryptionClient.reEncryptInstructionFile had the same class of leak: it called getObject only for the response metadata and never closed the returned stream. It now closes it right away. Tests: - ContentMetadataStrategyTest: instruction file stream is closed after a successful parse and after a parse failure. - S3EncryptionClientReEncryptInstructionFileTest#testReEncryptInstructionFileClosesGetObjectStream: unit test that the GetObject stream is closed. - S3EncryptionClientInstructionFileTest#testGetObjectReleasesInstructionFileConnection: integration test with a one-connection instruction file client and repeated GetObject calls.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available: #539
Description of changes:
loadInstructionFileMetadataparsed the instruction file'sGetObjectresponse stream but never closed it. As a result, each decrypt that used an instruction file could leak a pooled HTTP connection until the pool was exhausted. This change closes that stream with try-with-resources, including when parsing fails. It also closes theGetObjectstream inreEncryptInstructionFile, which only needs the object's metadata.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Check any applicable: