FULL PRODUCT VERSION :
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Same experience on multiple windows platforms
and with 1.7.51 and 1.8.25
A DESCRIPTION OF THE PROBLEM :
java deadlocks when
MulticastSocket and DatagramSocket sockets are created at the same time in 2 threads
REGRESSION. Last worked in version 7u51
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
// Threads 1 - Listener for DatagramPacket
new MulticastSocket(6000);
// Thread 2 - DatagramPacket Sender
new DatagramSocket(6000);
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Occasionally deadlocks with following stack trace for both threads
Thread [MulticastSender]
waiting for: (id=21)
AbstractPlainDatagramSocketImpl.init() line: not available [native method] AbstractPlainDatagramSocketImpl.<clinit>() line: not available
DefaultDatagramSocketImplFactory.createDatagramSocketImpl(boolean) line: not available
DatagramSocket.createImpl() line: not available
DatagramSocket.<init>(SocketAddress) line: not available
DatagramSocket.<init>(int, InetAddress) line: not available
DatagramSocket.<init>(int) line: not available
MulticastSender.<init>(InetAddress, int, InetAddress) line: 35
MulticastSender.init line 35 is: ds = new DatagramSocket(port);
Thread [MulticastReceiver] (Suspended)
waiting for: (id=27)
DefaultDatagramSocketImplFactory.createDatagramSocketImpl(boolean) line: not available
MulticastSocket(DatagramSocket).createImpl() line: not available
MulticastSocket(DatagramSocket).<init>(SocketAddress) line: not available
MulticastSocket.<init>(SocketAddress) line: not available
MulticastSocket.<init>(int) line: not available
MulticastReceiver.run() line: 48
where MulticastReceiver.run line 48: ms = new MulticastSocket(port);
REPRODUCIBILITY :
This bug can be reproduced occasionally.
CUSTOMER SUBMITTED WORKAROUND :
synchronize construction