Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3e34107
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 9, 2025
889dc27
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 9, 2025
3d77d04
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 9, 2025
0846f61
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 9, 2025
a82f740
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 9, 2025
27eb67a
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 9, 2025
0b063b1
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 9, 2025
021e9d7
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 9, 2025
6e79f68
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 10, 2025
b8373c0
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 10, 2025
b0d9a3e
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 10, 2025
25ab870
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 10, 2025
f70e129
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 10, 2025
d753312
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 10, 2025
0c5739c
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 10, 2025
6063291
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 10, 2025
bd6b6cf
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 10, 2025
47ef1fa
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 10, 2025
ccd7819
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 10, 2025
b79edaf
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 10, 2025
9a7ce71
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 10, 2025
c107c4c
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 11, 2025
e160d0d
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 11, 2025
a339b8d
fix(ENGKNOW-2746): Refresh meta data to resolve stale file handle.
gmagnu Sep 11, 2025
7772fe1
fix(ENGKNOW-2746): Prepare PR
gmagnu Sep 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,29 +81,14 @@ public int read(byte[] b, int off, int len) throws IOException {
// Safe to cast because length-position can only be less than len.
len = (int) (length() - position);
}
// Individual operations are retried automatically with our retry wrapper, but we
// may get errors, such as stale file handle, that we can recover from by
// reopening the file before attempting the read operation again.
int numRetries = 0;
while (true) {
try (InputStream stream = source.open(position, len)) {
int read = StreamUtils.readToBuffer(stream, b, off, len);
if (read > 0) {
position += read;
}
log.trace("Actually read: {}", read);
return read;
} catch (IOException e) {
if (e.getMessage().equals("Stale file handle")) {
numRetries++;
if (numRetries >= 3) {
log.warn("Stale file handle on {} after {} retries", getMeta().getNamedUrl(), numRetries, e);
throw(e);
}
} else {
throw(e);
}

try (InputStream stream = source.open(position, len)) {
int read = StreamUtils.readToBuffer(stream, b, off, len);
if (read > 0) {
position += read;
}
log.trace("Actually read: {}", read);
return read;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,12 @@ public long skip(long n) throws IOException {
* NB: If reopening the stream fails - it is not retried.
*/
private void reopen() {
// Close the current stream
StreamUtils.tryClose(in);
// Need to open it using the outer super class open (and be careful NOT to warp it again)
// Close the underlying source stream (to clear any cached state)
RetryStreamSourceWrapper.super.close();

// Need to open it using the outer super class open (and be careful NOT to wrap it again)
if (length == null) {
in = RetryStreamSourceWrapper.super.open(start + getPosition());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ public void close() {
wrapped.close();
}

@Override
public void validateAccess() {
wrapped.validateAccess();
}

@Override
public boolean exists() {
return wrapped.exists();
Expand Down
Loading