]
Bela Ban commented on JGRP-2257:
--------------------------------
So you're saying that the socket read throws a SocketClosedException, but
Socket.isClosed() returns false?
Hmm, is this a bug in the JVM? I don't see how I could fix this...
UDP#PacketReceiver stuck in busy loop when socket throws closed
exception but socket is not closed
--------------------------------------------------------------------------------------------------
Key: JGRP-2257
URL:
https://issues.jboss.org/browse/JGRP-2257
Project: JGroups
Issue Type: Bug
Affects Versions: 3.6.12
Environment: Windows Server 2016, 32GBytes memory running as a Hyper-V guest
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
It was reported with just a single node running.
Reporter: Paul Illingworth
Assignee: Bela Ban
Fix For: 4.0.12
I have a had a report of a scenario where it looks like the UDP#PacketReceiver is stuck
spinning in a busy loop. The following is a snippet of the log file from the system in
question.
{noformat}
2018-03-16 14:05:43,273 SEVERE [] (214,unicast receiver,shared=udp) JGRP000190: failed
receiving packet
java.net.SocketException: socket closed
at java.net.TwoStacksPlainDatagramSocketImpl.peekData(Native Method)
at java.net.DatagramSocket.receive(DatagramSocket.java:743)
at org.jgroups.protocols.UDP$PacketReceiver.run(UDP.java:694)
at java.lang.Thread.run(Thread.java:748)
2018-03-16 14:05:43,273 SEVERE [] (214,unicast receiver,shared=udp) JGRP000190: failed
receiving packet
java.net.SocketException: socket closed
at java.net.TwoStacksPlainDatagramSocketImpl.peekData(Native Method)
at java.net.DatagramSocket.receive(DatagramSocket.java:743)
at org.jgroups.protocols.UDP$PacketReceiver.run(UDP.java:694)
at java.lang.Thread.run(Thread.java:748)
2018-03-16 14:05:43,273 SEVERE [] (214,unicast receiver,shared=udp) JGRP000190: failed
receiving packet
java.net.SocketException: socket closed
at java.net.TwoStacksPlainDatagramSocketImpl.peekData(Native Method)
at java.net.DatagramSocket.receive(DatagramSocket.java:743)
at org.jgroups.protocols.UDP$PacketReceiver.run(UDP.java:694)
at java.lang.Thread.run(Thread.java:748)
{noformat}
Looking at the code it looks like the call to receive a packet
{code:java}
receiver_socket.receive(packet);
{code}
results in an exception being thrown because the socket is closed but then when the
exception is caught
{code:java}
if(receiver_socket.isClosed()) {
{code}
method is queried which says the socket has not been closed and the loop then continues
for ever.
I guess this is related to JGRP-1669. To quote
_I hope there is no condition which causes the socket receive() to spit out endless
exceptions while not being closed..._