100% CPU on SocketChannelImpl.connect()

Guy Korland gkorland at gmail.com
Tue Apr 15 10:46:04 PDT 2008


>I haven't seen this code cause problems before. Do you have an example that
>demonstrates this?
I don't have a specific example, we saw it when using we Jini with an
Exporter that we developed based on NIO.

>If so, which operating system?
We saw it on windows XP

>I assume for this to loop the channel must be configured blocking and
the connect is interrupted.
Yes it's configured blocking but I'm not sure about the interrupt.

>Have you run with truss, strace, or equivalent to see if this is so.
We saw it using JProfiler.

Guy


On Tue, Apr 15, 2008 at 5:53 PM, Alan Bateman <Alan.Bateman at sun.com> wrote:
>
> 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