HADOOP-16767 Handle non-IO exceptions in reopen() (#2685)

Contributed by Sergei Poganshev.

Catches Exception instead of IOException in closeStream() 
and so handle exceptions such as SdkClientException by 
aborting the wrapped stream. This will increase resilience
to failures, as any which occuring during stream closure
will be caught. Furthermore, because the
underlying HTTP connection is aborted, rather than closed,
it will not be recycled to cause problems on subsequent
operations.
This commit is contained in:
yzhangal 2021-02-08 08:03:43 -08:00 committed by GitHub
parent ef14e16d36
commit ceea43115b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -476,7 +476,7 @@ public class S3AInputStream extends FSInputStream implements CanSetReadahead {
// and an abort is triggered, the initial attempt's statistics // and an abort is triggered, the initial attempt's statistics
// aren't collected. // aren't collected.
streamStatistics.streamClose(false, drained); streamStatistics.streamClose(false, drained);
} catch (IOException e) { } catch (Exception e) {
// exception escalates to an abort // exception escalates to an abort
LOG.debug("When closing {} stream for {}", uri, reason, e); LOG.debug("When closing {} stream for {}", uri, reason, e);
shouldAbort = true; shouldAbort = true;