-
Bug
-
Resolution: Fixed
-
P4
-
9
-
b134
java/net/MulticastSocket/NoLoopbackPackets.java starts a daemon thread which has an infinite loop. Looks like the loop may run forever:
http://hg.openjdk.java.net/jdk9/dev/jdk/file/0cd4b4def24f/test/java/net/MulticastSocket/NoLoopbackPackets.java#l127
...
Thread sender = new Thread(new Sender(groups));
sender.setDaemon(true); // we want sender to stop when main thread exits
sender.start();
...
static class Sender implements Runnable {
private List<SocketAddress> sendToGroups;
public Sender(List<SocketAddress> groups) {
sendToGroups = groups;
}
public void run() {
byte[] buf = "hello world".getBytes();
List<DatagramPacket> packets = new ArrayList<DatagramPacket>();
try {
for (SocketAddress group : sendToGroups) {
DatagramPacket packet = new DatagramPacket(buf, buf.length, group);
packets.add(packet);
}
MulticastSocket msock = new MulticastSocket();
msock.setLoopbackMode(true); // disable loopback mode
for (;;) {
for (DatagramPacket packet : packets) {
msock.send(packet);
}
Thread.sleep(1000); // 1 second
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
...
The test shouldn't leave daemon threads when they finish. It may slow down further test execution a little bit because daemon threads consume some JVM resources. If other tests also leave daemon threads, it may cause intermittent failures of other tests which run in the same JVM. See for exampleJDK-8160642 and JDK-8162757. Sender daemon thread is in jstack output:
"Thread-2012" #2141 daemon prio=5 os_prio=0 tid=0x00007fec3c2ad800 nid=0x740c waiting on condition [0x00007fec941dc000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(java.base@9-ea/Native Method)
at NoLoopbackPackets$Sender.run(NoLoopbackPackets.java:144)
at java.lang.Thread.run(java.base@9-ea/Thread.java:843)
http://hg.openjdk.java.net/jdk9/dev/jdk/file/0cd4b4def24f/test/java/net/MulticastSocket/NoLoopbackPackets.java#l127
...
Thread sender = new Thread(new Sender(groups));
sender.setDaemon(true); // we want sender to stop when main thread exits
sender.start();
...
static class Sender implements Runnable {
private List<SocketAddress> sendToGroups;
public Sender(List<SocketAddress> groups) {
sendToGroups = groups;
}
public void run() {
byte[] buf = "hello world".getBytes();
List<DatagramPacket> packets = new ArrayList<DatagramPacket>();
try {
for (SocketAddress group : sendToGroups) {
DatagramPacket packet = new DatagramPacket(buf, buf.length, group);
packets.add(packet);
}
MulticastSocket msock = new MulticastSocket();
msock.setLoopbackMode(true); // disable loopback mode
for (;;) {
for (DatagramPacket packet : packets) {
msock.send(packet);
}
Thread.sleep(1000); // 1 second
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
...
The test shouldn't leave daemon threads when they finish. It may slow down further test execution a little bit because daemon threads consume some JVM resources. If other tests also leave daemon threads, it may cause intermittent failures of other tests which run in the same JVM. See for example
"Thread-2012" #2141 daemon prio=5 os_prio=0 tid=0x00007fec3c2ad800 nid=0x740c waiting on condition [0x00007fec941dc000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(java.base@9-ea/Native Method)
at NoLoopbackPackets$Sender.run(NoLoopbackPackets.java:144)
at java.lang.Thread.run(java.base@9-ea/Thread.java:843)
- relates to
-
JDK-8160642 sun/security/tools/jarsigner/warnings/HasUnsignedEntryTest.java failed with timeout
-
- Closed
-
-
JDK-8162757 sun/net/www/protocol/http/NoCache.java failed due to timeout
-
- Closed
-