On 9/14/10 9:36 AM, Doron Fediuck wrote:
On Monday 13 September 2010 09:50:27 Emmanuel Lecharny wrote:
Anyone ?
Can someone please take a look on this issue ?
It just seems that you are heavily using the server, sending a hell lot
of data to it. Do you have any releavnt informations about the load on
your server ?

If you look at the code pumping out CPU, you'll see that there is no
black magic in it :

      //
      // On some platforms, a call to System.in.read(new byte[65536],
0,32768) always throws an IOException.
      // So we need to protect against that and chunk the call into
smaller calls.
      // This problem was found on Windows, JDK 1.6.0_03-b05.
      //
      protected int securedRead(InputStream in, byte[] buf, int off, int
len) throws IOException {
          int n = 0;
          for (;;) {
              int nread = in.read(buf, off + n, Math.min(1024, len - n));
              if (nread<= 0) {
                  return (n == 0) ? nread : n;
              }
              n += nread;
              if (n>= len) {
                  return n;
              }
              // if not closed but no bytes available, return
              if (in != null&&  in.available()<= 0) {
                  return n;
              }
          }
      }




Just to clarify, I'm not using the SSHD server side, just client side,
so I'm not sure your remark about heavy server usage it relevant.

As for the code, it looks harmless, but I do not think
networking or I/O should take CPU to 100%. We're missing
something and that's why I posted it here. It could be something
in the JVM or similar, but the issue is severe.

There is another potential issue due to the underlying MINA layer used by sshd : there is a bug in the way the select() method is processed by the JVM in some corner cases, which drive the JVM to eat 100% CPU. What would help here is a thread dump when your CPU hits 100%


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Reply via email to