mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8184157: (ch) AsynchronousFileChannel hangs with internal error when reading locked file
Reviewed-by: alanb
This commit is contained in:
parent
da6f042616
commit
a8af569fa0
5 changed files with 66 additions and 16 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -228,7 +228,6 @@ public class WindowsAsynchronousFileChannelImpl
|
|||
@Override
|
||||
public void run() {
|
||||
long overlapped = 0L;
|
||||
boolean pending = false;
|
||||
try {
|
||||
begin();
|
||||
|
||||
|
@ -242,7 +241,6 @@ public class WindowsAsynchronousFileChannelImpl
|
|||
overlapped);
|
||||
if (n == IOStatus.UNAVAILABLE) {
|
||||
// I/O is pending
|
||||
pending = true;
|
||||
return;
|
||||
}
|
||||
// acquired lock immediately
|
||||
|
@ -253,9 +251,9 @@ public class WindowsAsynchronousFileChannelImpl
|
|||
// lock failed or channel closed
|
||||
removeFromFileLockTable(fli);
|
||||
result.setFailure(toIOException(x));
|
||||
} finally {
|
||||
if (!pending && overlapped != 0L)
|
||||
if (overlapped != 0L)
|
||||
ioCache.remove(overlapped);
|
||||
} finally {
|
||||
end();
|
||||
}
|
||||
|
||||
|
@ -448,13 +446,12 @@ public class WindowsAsynchronousFileChannelImpl
|
|||
} catch (Throwable x) {
|
||||
// failed to initiate read
|
||||
result.setFailure(toIOException(x));
|
||||
if (overlapped != 0L)
|
||||
ioCache.remove(overlapped);
|
||||
} finally {
|
||||
if (!pending) {
|
||||
if (!pending)
|
||||
// release resources
|
||||
if (overlapped != 0L)
|
||||
ioCache.remove(overlapped);
|
||||
releaseBufferIfSubstituted();
|
||||
}
|
||||
end();
|
||||
}
|
||||
|
||||
|
@ -628,9 +625,9 @@ public class WindowsAsynchronousFileChannelImpl
|
|||
result.setFailure(toIOException(x));
|
||||
|
||||
// release resources
|
||||
releaseBufferIfSubstituted();
|
||||
if (overlapped != 0L)
|
||||
ioCache.remove(overlapped);
|
||||
releaseBufferIfSubstituted();
|
||||
|
||||
} finally {
|
||||
end();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue