100% CPU on SocketChannelImpl.connect()
Alan Bateman
Alan.Bateman at Sun.COM
Tue Apr 15 07:53:17 PDT 2008
Guy Korland wrote:
> Hi,
> It seems like the following code causes an endless loop in some cases.
>
> for (;;) {
> InetAddress ia = isa.getAddress();
> if (ia.isAnyLocalAddress())
> ia = InetAddress.getLocalHost();
> n = Net.connect(fd, ia, isa.getPort(),trafficClass);
> if ((n == IOStatus.INTERRUPTED)
> && isOpen())
> continue;
> break;
> }
>
> Guy
>
I haven't seen this code cause problems before. Do you have an example
that demonstrates this? If so, which operating system? I assume for this
to loop the channel must be configured blocking and the connect is
interrupted. Have you run with truss, strace, or equivalent to see if
this is so.
-Alan.
More information about the net-dev
mailing list