Archived

This forum has been archived. Please start a new discussion on GitHub.

the usage of cpu goes to 100% when the network is disconnect

dear friends:
I use vc7.0 as the server,Java as the client.and the OS is Windows2003.
at the client(using java), when I make the network disconnect or I pull out the twisted-pair.the usage of cpu goes to 100%.
If I suspend the Ice.ThreadPool.Client-0 thread,the usage of cpu goes down. why?
My code as below:
private void conClient2Server()
{
try
{
ic = Ice.Util.initialize();

Ice.ObjectPrx base = ic.stringToProxy(
_appGateConnstring);
SingleApgInterfacePrx = APG.APGInterfacePrxHelper.checkedCast(base);
if (SingleApgInterfacePrx == null)
{
clientbeanLog.error("prox invalid!");
throw new Error("prox invalid!");
}
else
{
clientbeanLog.info("connect success!");
}
}
catch (Ice.LocalException e)
{
clientbeanLog.error(e, e);
e.printStackTrace();
}
catch (Exception e)
{
clientbeanLog.error(e, e);
System.err.println(e.getMessage());
}

Thank you!

Comments

  • benoit
    benoit Rennes, France
    Hi,

    Which Java and Ice version are you using? What do you mean by suspending the "Ice.ThreadPool.Client-0" thread? Do you stop the client program?

    The best to figure out what the client is doing would be to dump and post the JVM stack traces. On Windows, you can do this by hitting the Ctrl + Break keys in the command shell window where your Java client is running.

    Cheers,
    Benoit.
  • benoit wrote: »
    Hi,

    Which Java and Ice version are you using? What do you mean by suspending the "Ice.ThreadPool.Client-0" thread? Do you stop the client program?

    The best to figure out what the client is doing would be to dump and post the JVM stack traces. On Windows, you can do this by hitting the Ctrl + Break keys in the command shell window where your Java client is running.

    Cheers,
    Benoit.

    Thank you for your quick reply,Benoit.
    I use j2sdk1.4.2_04 and Ice V3.11.and my IDE is Eclipse v3.2.1.when I make the network disconnect or I pull out the twisted-pair.the usage of cpu goes to 100%. after I connect the network,the usage of cpu remain 100%.

    I haven't stop the programm.I find there are 2 Ice threads running in my programm:Thread [Ice.ThreadPool.Client-0] and Thread[Ice.ConnectionMonitor] ,when I suspend the thread whose name is [Ice.ThreadPool.Client-0] in Eclipse v3.2.1,I find the usage of cpu goes down,If I resume it,the usage of cpu goes to 100%;but if I suspend[Ice.ConnectionMonitor],the usage of cpu has no change.
  • marc
    marc Florida
    Before we dig deeper into this, can you please update your Java version, and try again? j2sdk1.4.2_04 is quite old. Here in these forums we only provide support for an up-to-date Java version.
  • Thank you for your reply, marc.
    If I update the jsdk version1.5,which means I have to update Vc7.0 to Visual Studio 2005?Because I use c++ as server.and I heard of jdk1.5 is compatible with Visual Studio 2005 while use Ice .Really?
    Meanwhile,I had do a lot of work with jsdk 1.4.I am afraid it will have troubles If I update the jsdk version.
  • the stack infomation as below:

    org.apache.catalina.startup.Bootstrap at localhost:3841
    Thread [main] (Running)
    Thread [http-8080-Processor10] (Running)
    Thread [http-8080-Processor11] (Running)
    Thread [http-8080-Processor12] (Running)
    Thread [http-8080-Processor13] (Running)
    Thread [http-8080-Processor14] (Running)
    Thread [http-8080-Processor15] (Running)
    Thread [http-8080-Processor16] (Running)
    Thread [http-8080-Processor17] (Running)
    Thread [http-8080-Processor18] (Running)
    Thread [http-8080-Processor19] (Running)
    Thread [http-8080-Processor20] (Running)
    Thread [http-8080-Processor9] (Running)
    Thread [http-8080-Processor8] (Running)
    Thread [http-8080-Processor7] (Running)
    Thread [http-8080-Processor6] (Running)
    Thread [http-8080-Processor5] (Running)
    Thread [http-8080-Processor4] (Running)
    Thread [http-8080-Processor3] (Running)
    Thread [http-8080-Processor2] (Running)
    Thread [http-8080-Processor1] (Running)
    Thread [ContainerBackgroundProcessor[StandardEngine[Catalina]]] (Running)
    Thread [TP-Monitor] (Running)
    Thread [TP-Processor4] (Running)
    Thread [TP-Processor3] (Running)
    Thread [TP-Processor2] (Running)
    Thread [TP-Processor1] (Running)
    Thread [http-8080-Monitor] (Running)
    Thread [http-8080-Processor25] (Running)
    Thread [http-8080-Processor24] (Running)
    Thread [http-8080-Processor23] (Running)
    Thread [http-8080-Processor22] (Running)
    Thread [http-8080-Processor21] (Running)
    Thread [Ice.ThreadPool.Client-0] (Suspended)
    WindowsSelectorImpl$SubSelector.poll0(long, int, int[], int[], int[], long) line: not available [native method] [local variables unavailable]
    WindowsSelectorImpl$SubSelector.poll() line: 263
    WindowsSelectorImpl$SubSelector.access$400(WindowsSelectorImpl$SubSelector) line: 245
    WindowsSelectorImpl.doSelect(long) line: 128
    WindowsSelectorImpl(SelectorImpl).lockAndDoSelect(long) line: 59
    WindowsSelectorImpl(SelectorImpl).select(long) line: 70
    WindowsSelectorImpl(SelectorImpl).select() line: 74
    ThreadPool.select() line: 1111
    ThreadPool.run(BasicStream) line: 488
    ThreadPool.access$100(ThreadPool, BasicStream) line: 12
    ThreadPool$EventHandlerThread.run() line: 1248
    Thread [Ice.ConnectionMonitor] (Running)
    D:\j2sdk1.4.2_04\bin\javaw.exe (2007-1-24 下午03:26:30)
  • marc
    marc Florida
    I believe there is even a newer version for JDK 1.4 available. Please check the Sun download pages for details.

    I don't understand what you mean with JDK 1.5 being compatible with Visual C++ 7.0 only. As far as Ice is concerned, the version of Java you are using has no impact whatsoever on which C++ compiler you are using.

    It would also be helpful if you could send us a few stack traces of the thread that uses 100% of the CPU. (After the JDK update :) )
  • marc
    marc Florida
    Oops... I forgot to mention: Can you please update your user profile with your full name? Thanks!
  • marc
    marc Florida
    The latest JDK 1.4 version is 1.4.2_13:

    http://java.sun.com/j2se/1.4.2/ReleaseNotes.html#142_13

    Looking through the release notes, it appears that several problems with select() have been fixed.
  • marc wrote: »
    The latest JDK 1.4 version is 1.4.2_13:

    http://java.sun.com/j2se/1.4.2/ReleaseNotes.html#142_13

    Looking through the release notes, it appears that several problems with select() have been fixed.

    Thank you!
    I have updated my profile. and I will update my jdk version and try again.
  • zhoubin wrote: »
    Thank you!
    I have updated my profile. and I will update my jdk version and try again.

    Thank you ,marc and benoit!
    After updating jdk to jdk1.5.0_09,it's ok!
    Best regards to you!