Skip to content

Commit 10b40a0

Browse files
committed
[GR-65711] Unclosed half associations for closed socket channels.
PullRequest: graal/21048
2 parents 84143bb + 020d4d5 commit 10b40a0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sdk/src/org.graalvm.nativebridge/src/org/graalvm/nativebridge/ProcessIsolateThreadSupport.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,8 @@ private ThreadChannel(ProcessIsolateThreadSupport owner, SocketChannel channel,
419419
*/
420420
@Override
421421
public void close() throws IOException {
422+
selector.close();
423+
channel.configureBlocking(true);
422424
channel.close();
423425
}
424426

@@ -636,9 +638,8 @@ private void cancelWorkerThreads() throws InterruptedException {
636638

637639
private Runnable createDispatchRunnable(SocketChannel peerThreadChannel) {
638640
return () -> {
639-
try (SocketChannel s = peerThreadChannel) {
640-
Thread currentThread = Thread.currentThread();
641-
ThreadChannel threadChannel = new ThreadChannel(this, s, currentThread);
641+
Thread currentThread = Thread.currentThread();
642+
try (ThreadChannel threadChannel = new ThreadChannel(this, peerThreadChannel, currentThread)) {
642643
workerThreads.add(threadChannel);
643644
try {
644645
dispatchSupport.onWorkerThreadStarted(currentThread, threadChannel);

0 commit comments

Comments
 (0)