-
Bug
-
Resolution: Fixed
-
P4
-
14
-
b17
-
x86
-
linux_redhat_7.3
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8306776 | 17.0.8 | Masanori Yano | P4 | Resolved | Fixed | b01 |
JDK-8321929 | 11.0.23 | Paul Hohensee | P4 | Resolved | Fixed | b01 |
JDK-8335259 | openjdk8u432 | Kazuhisa Takakuri | P4 | Resolved | Fixed | b01 |
ADDITIONAL SYSTEM INFORMATION :
OS:
Red Hat Linux 7.4 Linux 3.10.0-693.el7.x86_64 #1 SMP
Java:
openjdk version "14-ea" 2020-03-17
OpenJDK Runtime Environment (build 14-ea+20-879)
OpenJDK 64-Bit Server VM (build 14-ea+20-879, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
JDK release (JDK 14-ea+20).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run test case as background process.
java ESctp &
2. Repleat to invoke "lsof -U -a -p [PID]" during running above process
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Number of unix socket keeps 1
ACTUAL -
Number of unix socket increases linearly
---------- BEGIN SOURCE ----------
import java.net.*;
import java.util.*;
import java.io.*;
import java.nio.channels.*;
import com.sun.nio.sctp.*;
class ESctp
{
static Selector selector;
static int NUM = 10;
static SelectorThread selthread;
public static void main(String[] args) throws Exception
{
int port = 12345;
if (!isSCTPSupported()) {
System.out.println("SCTP protocol is not supported");
System.out.println("Test cannot be run");
return;
}
if (args.length == 1) {
try {
port = Integer.parseInt(args[0]);
} catch(Exception e) {}
}
new Server(port).start();
new Server2(port+1).start();
Thread.sleep(100); // wait for server ready
selector = Selector.open();
init(port+1);
selthread = new SelectorThread();
selthread.start();
for (int i = 0 ; i < 500 ; ++i) {
System.out.println(i);
doIt(port);
Thread.sleep(200);
}
System.out.println("end");
System.exit(0);
}
static boolean isSCTPSupported() {
try {
SctpChannel c = SctpChannel.open();
c.close();
return true;
} catch (IOException ioe) {
ioe.printStackTrace();
} catch (UnsupportedOperationException e) {
System.out.println(e);
}
return false;
}
static void init(int port) throws Exception
{
InetSocketAddress sa = new InetSocketAddress("localhost", port);
for (int i = 0 ; i < 3 ; ++i) {
SctpChannel channel = SctpChannel.open(sa, 1, 1);
channel.configureBlocking(false);
channel.register(selector, SelectionKey.OP_READ);
}
}
static void doIt(int port) throws Exception
{
InetSocketAddress sa = new InetSocketAddress("localhost", port);
for (int i = 0 ; i < NUM ; ++i) {
System.out.println(" " + i);
SctpChannel channel = SctpChannel.open(sa, 1, 1);
channel.configureBlocking(false);
SelectionKey key = selthread.regchannel(channel);
key.cancel();
selector.wakeup();
channel.close();
Thread.sleep(200);
}
}
static class SelectorThread extends Thread
{
Object lock = new Object();
SctpChannel channel;
SelectionKey key;
SelectionKey regchannel(SctpChannel ch) throws Exception
{
synchronized (lock) {
channel = ch;
selector.wakeup();
lock.wait();
}
return key;
}
public void run()
{
try {
while (true) {
selector.select(10000);
synchronized (lock) {
if (channel != null) {
key = channel.register(selector, SelectionKey.OP_READ);
channel = null;
lock.notify();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
static class Server2 extends Thread
{
SctpChannel[] x;
int port;
Server2(int port) {
this.port = port;
}
public void run()
{
x = new SctpChannel[32];
int i = 0;
try {
SctpServerChannel ss = SctpServerChannel.open();
InetSocketAddress sa = new InetSocketAddress("localhost", port);
ss.bind(sa);
while (true) {
SctpChannel soc = ss.accept();
x[i] = soc;
i++;
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
static class Server extends Thread
{
int port;
Server(int port) { this.port = port; }
public void run()
{
try {
SctpServerChannel ss = SctpServerChannel.open();
InetSocketAddress sa = new InetSocketAddress("localhost", port);
ss.bind(sa);
while (true) {
SctpChannel soc = ss.accept();
soc.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
---------- END SOURCE ----------
FREQUENCY : rarely
- backported by
-
JDK-8306776 (sctp) JDK-7118373 is not fixed for SctpChannel
- Resolved
-
JDK-8321929 (sctp) JDK-7118373 is not fixed for SctpChannel
- Resolved
-
JDK-8335259 (sctp) JDK-7118373 is not fixed for SctpChannel
- Resolved
- relates to
-
JDK-7118373 (se) Potential leak file descriptor when deregistrating at around the same time as an async close
- Closed
-
JDK-8274453 (sctp) com/sun/nio/sctp/SctpChannel/CloseDescriptors.java test should be resilient to lsof warnings
- Resolved
- links to
-
Commit openjdk/jdk8u-dev/a0715ab4
-
Commit openjdk/jdk11u-dev/04b1f4c2
-
Commit openjdk/jdk17u-dev/a000b2d6
-
Commit openjdk/jdk/d91e227a
-
Review openjdk/jdk8u-dev/427
-
Review openjdk/jdk11u-dev/2249
-
Review openjdk/jdk17u-dev/1235
-
Review openjdk/jdk/5274