Skip to content

Commit d863fa7

Browse files
committed
Hang in PreClose method during dup2 system call
During fcntl, dup2 system calls if read/write happens then PreClose method gets hang. This issue is not seen if we Signal/Kill the thread first and then call the preClose method. Signed-off-by: Shruthi.Shruthi1 <[email protected]>
1 parent a8becd5 commit d863fa7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/java.base/unix/classes/sun/nio/ch/SourceChannelImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -107,8 +107,8 @@ protected void implCloseSelectableChannel() throws IOException {
107107
assert state == ST_CLOSING;
108108
long th = thread;
109109
if (th != 0) {
110-
nd.preClose(fd);
111110
NativeThread.signal(th);
111+
nd.preClose(fd);
112112

113113
// wait for read operation to end
114114
while (thread != 0) {

0 commit comments

Comments
 (0)