Java calls repaint to much (100% CPU)

Hello,
I'm creating an emulator, and the image to display is created with an ImageProducer. Now, I have this code:
public class Video extends JPanel {
    private int a;
    private Image screen;
    private Lcd lcd;
    private Dimension lcdDimension;
    private int scale;
    private int scaleFactor = 3;
    /** Creates a new instance of Video */
    public Video() {
        lcd = new Lcd(64, 32);
        lcdDimension = lcd.getDimension();
        screen = createImage(lcd);
        setScale(2);
   public void paint(Graphics g) {
        System.out.println(a++);
        screen.flush();
        g.drawImage(screen, 0, 0, lcdDimension.width*scale*scaleFactor, lcdDimension.height*scale*scaleFactor, Color.WHITE, this);
    public Dimension getPreferredSize() {
        return new Dimension(lcdDimension.width*scale*scaleFactor, lcdDimension.height*scale*scaleFactor);
    public Lcd getLcd() { return lcd; }
    public void setScale(int s) { scale = s; }
    public int getScale() { return scale; }
}The problem is, as soon as I open the menu and close it (I don't click on anything, no code should be executed), java starts repainting the Video frame like mad...
I can see the number count go up on the standard output with about 200 / second...

i dont know if this will work but try putting this code in ur class and put private Graphics dbg; at the top
public void update(Graphics g)
          if (dbImage == null)
              dbImage = createImage (this.getSize().width, this.getSize().height);
              dbg = dbImage.getGraphics ();
          dbg.setColor (getBackground ());
          dbg.fillRect (0, 0, this.getSize().width, this.getSize().height);
          dbg.setColor (getForeground());
          paint (dbg);
          g.drawImage (dbImage, 0, 0, this);
      }

Similar Messages

  • OHJ4.1.16 Repainting Problems and 100%CPU on java 1.4

    Hi
    We are considering using OHJ4.1.16 as our application help, I have it working such that when the help is invoked either from the toolbar or the menu OHJ is displayed, but there are major repainting problems when the OHJ window is closed by clicking on the X button and then the help is invoked again from the toolbar or the menu item.
    Please note that the first time it displays and paints fine only when the OHJ frame is closed and invoked again the problem occurs
    The problems encountered are repainting(really whacky), 100% CPU utilization
    Please have a look at the code below and tell me if i am not doing it right, Also is there anyway i can trap events on the OHJ frame so that i can dispose it everytime the window is closed by the user??
    The following code is executed when the help is invoked
         public void startHelp()
         helpObject.showNavigatorWindow();     
         helpObject.setVisible(true);
         public static void launchApplication()
              String helpset1 = "/resources/help/Test.hs";
              Vector booksVector = new Vector();
              booksVector.add(helpset1);
                   if(m_instance == null)
                        m_instance = new ApplicationHelp(booksVector);
                   else
                        m_instance.startHelp();                    
    we are using java 1.4, the above problem makes OHJ unusable!!

    Hi, John. We're trying to reproduce your problem. If you run any of the OHJ 4.1.16 demos in the bin directory of the installation, do you run into the 100% CPU utilization problem? If so, how? The cshDemo.bat file creates a dummy application that has an OHJ deployment, so please test that one in particular.
    Thanks,
    Ryan

  • LinkedBlockingQueue taking 100% CPU on linux

    I've just discoverd that java.util.concurrent.LinkedBlockingQueue takes 100% CPU on linux (AMD XP2400 512MB of RAM Fedora Core 3 using:
    java version "1.5.0_04"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
    Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)
    I don't know what's happening (could it be a bug?). On Windows 2000 (Pentium4) it works fine.
    Is there a special setting that has to be set on Linux for this code to work? Is this code working on your linux box?
    If you know any work around that acheives the same effect, I'd be glad to here it.
    Help! please!
    import java.util.concurrent.LinkedBlockingQueue;
    import java.util.concurrent.TimeUnit;
    import java.util.ArrayList;
    public class Test {
        public Test() {
        public static void main(String[] args) {
            Test t = new Test();
            t.execute();
        public void execute() {
            try {
                System.out.println("1");
    LinkedBlockingQueue queue = new LinkedBlockingQueue();
    ArrayList list = (ArrayList) queue.poll(3162240000L, TimeUnit.SECONDS);    // wait 100 year (!) for an element in the queue
            System.out.println("2");
            } catch (Exception e) {
                e.printStackTrace();
    }

    Yes it's the poll call that causes problems.
    I've looked at the bug database and did not find something similar. I've created a bug for this. I hope that it will be fixed in the future.
    As I cannot wait, I've find an alternative in "Java 1.4 backport of JSR 166 (java.util.concurrent)"
    http://www.mathcs.emory.edu/dcl/util/backport-util-concurrent/
    It is kinda stuipid to run Java 1.5 and having to use a backport of java.util.concurrent but I have no choice.
    I guess that this is a threading problem as on Windows 2000 on a Pentium4 I've got no problem.

  • Repaint() causes 100%cpu useage

    im not sure where ive gone wrong but its using 100% of cpu. source below (a little messey - im a beginner)
    its a graphing extention to an applet - thanks for the help
    public class MyCanvasGraph extends Canvas {
    public void update(Graphics g) {
    paint(g);
    int graph1X = 0;
    int graph1Y = 20;
    int graph2X = 0;
    int graph2Y = 175;
         public void paint(Graphics g){     
         String whichStation = Team.convertInt(monitorSelected);
    int scaleBY = 10 ;
    int scaleBY2 = 100 ;
    int[] dataRecieved = Team.getRecieved();
         int timeForGraph = Team.timeCounter();
         int[] dataWaiting = Team.getWaiting();
    timeForGraph=timeForGraph/500;     
    // retrieve values of data at A - H and Scale to fit graph by value of scaleBY
    if (timeChange!=timeForGraph) { // only update graph if data has changed - allows applet to run smoother
         if ( monitorChange == monitorSelected ) { // make sure the monitored station is the same otherwise graph needs to be cleared
              System.arraycopy(graphArrayWaiting, 1, graphArrayWaiting, 0, 240);
    graphArrayWaiting[239] = dataWaiting[monitorSelected]/scaleBY ;
    System.arraycopy(graphArrayRecieved, 1, graphArrayRecieved, 0, 240);
    int ammountRecieved = dataRecieved[monitorSelected]/scaleBY2 ;
    if ( ammountRecieved>=1000) {ammountRecieved=1000;}
    graphArrayRecieved[239] = ammountRecieved ;
    else { monitorChange = monitorSelected;
         for(int t=0;t<=240;t++){
    graphArrayWaiting[t]=0;
    graphArrayRecieved[t]=0;}
    // KEY
    g.setColor(Color.blue);
    g.fillRect( 25, 147 ,12,12);
    g.drawString("Data Waiting", 40, 158);
    g.setColor(Color.black);
    g.drawRect( 25, 147 ,12,12);
    g.setColor(Color.red);
    g.fillRect( 125, 147 ,12,12);
    g.drawString("Data Sent", 140 , 158);
    g.setColor(Color.black);
    g.drawRect( 125, 147 ,12,12);
    g.setColor(new Color(192,192,192));
    g.drawRect( 20, 143 ,180,20);
         // TOP GRAPH
              g.setColor(Color.black);
              g.drawLine(graph1X + 20, graph1Y+10, graph1X + 20, graph1Y + 110); // draw Y axis
              g.drawLine(graph1X + 20, graph1Y + 110, graph1X + 260, graph1Y + 110); // draw X axis
              g.drawString("T I M E", graph1X + 225 , graph1Y + 125); // write TIME
              g.drawString("D", graph1X + 9 , graph1Y + 40); // write DATA
              g.drawString("A", graph1X + 9 , graph1Y + 60);
              g.drawString("T", graph1X + 9 , graph1Y + 80);
              g.drawString("A", graph1X + 9 , graph1Y + 100);
         // BOTTOM GRAPH     
    g.drawLine(graph2X + 20, graph2Y, graph2X + 20, graph2Y + 100); // draw Y axis
              g.drawLine(graph2X + 20, graph2Y + 100, graph2X + 260, graph2Y + 100); // draw X axis
              g.drawString("A", graph2X + 30 , graph2Y + 125); // WRITE a - h
              g.drawString("B", graph2X + 60 , graph2Y + 125);
              g.drawString("C", graph2X + 90 , graph2Y + 125);
              g.drawString("D", graph2X + 120 , graph2Y + 125);
              g.drawString("E", graph2X + 150 , graph2Y + 125);
              g.drawString("F", graph2X + 180 , graph2Y + 125);
              g.drawString("G", graph2X + 210 , graph2Y + 125);
              g.drawString("H", graph2X + 240 , graph2Y + 125);     
              g.drawString("D", graph2X + 9 , graph2Y + 30); // write DATA
              g.drawString("A", graph2X + 9 , graph2Y + 50);
              g.drawString("T", graph2X + 9 , graph2Y + 70);
              g.drawString("A", graph2X + 9 , graph2Y + 90);
    g.setColor(Color.white);
    g.fillRect(graph1X + 21, graph1Y -19,239,129); // Get rid of previous lines on graph 1
    g.fillRect(graph2X + 21, graph2Y +1 ,239,99); // Get rid of previous lines on graph 2
    g.setColor(new Color(192,192,192)); // set bar graph grid colour to grey
    for(int s=1;s<=10;s++){ // draws 10 lines to make a grid for graph 1
    g.drawLine(graph1X + 20, graph1Y + 10*s , graph1X + 260, graph1Y + 10*s );
    for(int s=1;s<=10;s++){ // draws 10 lines to make a grid for graph 2
    g.drawLine(graph2X + 20, graph2Y + 10*s - 10, graph2X + 260, graph2Y + 10*s - 10);
         // WHICH STATION IS BEING MONITORED
         g.setColor(Color.black);
    g.drawRect( 130, 12 ,120,13);
    g.setColor(Color.blue);
    g.drawString("Monitoring Station ", 137 , 23);
    g.setColor(Color.red);
    g.drawString(whichStation, 238 , 23);
    g.setColor(Color.blue); // set line colour to blue
    // PLOT GRAPH ONE LINE GRAPH
    for(int t=1;t<=2;t++){          
         timeChange=timeForGraph ;// see if the tame hs changed     
         for(int s=1;s<=238;s++){
              g.setColor(Color.red);
              g.drawLine(graph1X+20+s, 130-graphArrayRecieved[s], graph1X+s+21, 130-graphArrayRecieved[s+1]);
              g.setColor(Color.blue);
              g.drawLine(graph1X+20+s, 130-graphArrayWaiting[s], graph1X+s+21, 130-graphArrayWaiting[s+1]);
              // prepare data for graph 2
    int dataAt ;
    int recievedAt ;
    int dataAtA = dataWaiting[1];
    dataAtA = dataAtA/scaleBY;
    int recievedAtA = dataRecieved[1];
    recievedAtA = recievedAtA/scaleBY2;
    int dataAtB = dataWaiting[2];
    dataAtB = dataAtB/scaleBY;
    int recievedAtB = dataRecieved[2];
    recievedAtB = recievedAtB/scaleBY2;
    int dataAtC = dataWaiting[3];
    dataAtC = dataAtC/scaleBY;
    int recievedAtC = dataRecieved[3];
    recievedAtC = recievedAtC     /scaleBY2;
    int dataAtD= dataWaiting[4];
    dataAtD = dataAtD/scaleBY;
    int recievedAtD = dataRecieved[4];
    recievedAtD = recievedAtD/scaleBY2;
    int dataAtE = dataWaiting[5];
    dataAtE = dataAtE/scaleBY;
    int recievedAtE = dataRecieved[5];
    recievedAtE = recievedAtE/scaleBY2;
    int dataAtF = dataWaiting[6];
    dataAtF = dataAtF/scaleBY;
    int recievedAtF = dataRecieved[6];
    recievedAtF = recievedAtF/scaleBY2;
    int dataAtG = dataWaiting[7];
    dataAtG = dataAtG/scaleBY;
    int recievedAtG = dataRecieved[7];
    recievedAtG = recievedAtG/scaleBY2;
    int dataAtH = dataWaiting[8];
    dataAtH = dataAtH/scaleBY;
    int recievedAtH = dataRecieved[8];
    recievedAtH = recievedAtH/scaleBY2;
    for(int s=1;s<=8;s++){  
    switch (s) {
    case 1 : dataAt = dataAtA;
              recievedAt = recievedAtA ;     
              break ;           
    case 2 : dataAt = dataAtB;
    recievedAt = recievedAtB ;
    break;
    case 3 : dataAt = dataAtC;
              recievedAt = recievedAtC ;
    break;
    case 4 : dataAt = dataAtD;
    recievedAt = recievedAtD ;
    break;
    case 5 : dataAt = dataAtE;
    recievedAt = recievedAtE ;
    break;
    case 6 : dataAt = dataAtF;
    recievedAt = recievedAtF ;
    break;
    case 7 : dataAt = dataAtG;
    recievedAt = recievedAtG ;
    break;
    case 8 : dataAt = dataAtH;
    recievedAt = recievedAtH ;
    break;
    default : dataAt = dataAtA;      
              recievedAt = recievedAtA ;
              break ;
    }// end case
         // PLOT GRAPH 2 (BAR GRAPH)
         g.fillRect( graph2X - 5 + 30*s , graph2Y + 100 - dataAt, 10, dataAt ); // bar for A
    g.setColor(Color.red);
         g.fillRect( graph2X +5 + 30*s , graph2Y + 100 - recievedAt, 10, recievedAt ); // bar for A
         g.setColor(Color.blue);
    } // end loop
    } //end if statement (refresh control)
    } // closes for loop
    repaint();
    } // closes paint
         } // closes MyCanvasGraph

    This is the second %100 cpu utilization message I see in less than 24 hours.
    I recommend you start with the basics, and learn about about paint() repaint() logic, if you have to wonder why calling repaint() is not necessary inside of paint() you need to learn the basics first.
    http://java.sun.com/docs/books/tutorial/uiswing/painting/overview.html
    http://java.sun.com/products/jfc/tsc/articles/painting/index.html
    Please read these two links.

  • Java using 100% cpu

    Java seems to be using 100% of the cpu all the time, no applications running (except system needed functions). The sample process reveals this, but I'm not sure how to interpret it (then it loops through similar code):
    Call graph:
        2170 Thread_79073   DispatchQueue_1: com.apple.main-thread  (serial)
        + 2170 ???  (in java)  load address 0x100254000 + 0x1a98  [0x100255a98]
        +   2170 ???  (in java)  load address 0x100254000 + 0x429a  [0x10025829a]
        +     2170 ???  (in java)  load address 0x100254000 + 0x4843  [0x100258843]
        +       2170 CFRunLoopRunSpecific  (in CoreFoundation) + 230  [0x7fff8e803486]
        +         2170 __CFRunLoopRun  (in CoreFoundation) + 1204  [0x7fff8e803c74]
        +           2170 __CFRunLoopServiceMachPort  (in CoreFoundation) + 188  [0x7fff8e7fb50c]
        +             2170 mach_msg  (in libsystem_kernel.dylib) + 73  [0x7fff91a84d71]
        +               2170 mach_msg_trap  (in libsystem_kernel.dylib) + 10  [0x7fff91a8567a]
        2170 Thread_79079
        + 2170 thread_start  (in libsystem_c.dylib) + 13  [0x7fff9a32cb75]
        +   2170 _pthread_start  (in libsystem_c.dylib) + 335  [0x7fff9a3298bf]
        +     2170 ???  (in java)  load address 0x100254000 + 0x3240  [0x100257240]
        +       2170 ???  (in java)  load address 0x100254000 + 0x2cf3  [0x100256cf3]
        +         2170 ???  (in libclient64.dylib)  load address 0x1002e9000 + 0xb9323  [0x1003a2323]
        +           2170 ???  (in libclient64.dylib)  load address 0x1002e9000 + 0xb947b  [0x1003a247b]
        +             2170 ???  (in libclient64.dylib)  load address 0x1002e9000 + 0x966d2  [0x10037f6d2]
        +               2170 ???  (in libclient64.dylib)  load address 0x1002e9000 + 0x9690e  [0x10037f90e]
        +                 2170 ???  (in <unknown binary>)  [0x100cb6438]
        +                   2170 ???  (in <unknown binary>)  [0x100cbb85a]
        +                     2170 ???  (in <unknown binary>)  [0x100cbb85a]
        +                       2170 ???  (in <unknown binary>)  [0x100cc6d6e]
        +                         2170 JVM_MonitorWait  (in libjvmlinkage.dylib) + 59  [0x1009e7b0b]
        +                           2170 JVM_MonitorWait  (in libclient64.dylib) + 154  [0x10038be08]
        +                             2170 ???  (in libclient64.dylib)  load address 0x1002e9000 + 0xd483c  [0x1003bd83c]
        +                               2170 ???  (in libclient64.dylib)  load address 0x1002e9000 + 0xd4aeb  [0x1003bdaeb]
        +                                 2170 ???  (in libclient64.dylib)  load address 0x1002e9000 + 0x134f0  [0x1002fc4f0]
        +                                   2170 ???  (in libclient64.dylib)  load address 0x1002e9000 + 0xbee13  [0x1003a7e13]
        +                                     2170 mach_msg  (in libsystem_kernel.dylib) + 73  [0x7fff91a84d71]
        +                                       2170 mach_msg_trap  (in libsystem_kernel.dylib) + 10  [0x7fff91a8567a]
        2170 Thread_79080: Java: Exception Handler Thread
    Any ideas on what may be causing it?
    Steve E.

    Here are two things to try:
    PRAM RESET
    Zap the PRAM
    Shut down the computer.
    Locate the following keys on the keyboard: Command, Option, P, and R. You will need to hold these keys down simultaneously in step 4.
    Turn on the computer.
    Press and hold the Command-Option-P-R keys. You must press this key combination before the gray screen appears.
    Hold the keys down until the computer restarts and you hear the startup sound for the second time.
    Release the keys.
    This system management tool may help, read the PDF first:
    OnyX for Mac
    http://www.macupdate.com/app/mac/11582/onyx
    http://helpdesk.hsc.unt.edu/wp-content/uploads/2010/02/Mac-OS-X-10.6-run-OnyX.pd f

  • Java consuming 100% cpu  urgent

    hi
    Users are complaining about application slowness to login when i check the top process in linux it shows java process consuming 99.9% of cpu.how can i check which process is consuming and what its doing exactly and how to prevent it
    with rgds
    shyam

    The recommended setting for JVM is as follows:
    - No more than 100 active users per JVM
    - No more than 1 active JVM per CPU (Ideally 1 JVM per 2 CPUs)
    - Make sure you have enough memory so your JVMs will be running without swapping
    For the max.heap memory, Oracle recommends:
    -ms128m -mx256m if you have 512 MB memory
    -ms256m -mx512m if you have more than 512 MB memory
    In addition, verify that you do the following in jserv.properties:
    - Make sure you have 'wrapper.bin.parameters=-DLONG_RUNNING_JVM=true'
    - Make sure you comment out 'wrapper.bin.parameters=-DCACHEMODE=LOCAL'

  • Java process take 100% cpu

    Hello,
    I have a webapp running on Tomcat 5.0.28/RHEL 3.0. After some time (approximatively 1 hour), a java process take 100% cpu load and never stop, but the application do nothing.
    Some detail on my configuration :
    Distribution : Redhat Enterprise Linux 3.0 (updated)
    Kernel 2.4.21-37.0.1.ELsmp
    Glibc 2.3.2-95.37
    JVM : JRockit 1.4.2.08 (the last one)
    Tomcat : 5.0.28
    Server : 2*Xeon 3GHz HT, 2Go RAM
    JVM param : -Xmx:256m -Xms:256m
    Thanks for your answers ...

    Try taking thread dump (send a SIGQUIT to JRockit using "kill"). If you
    get a thread dump, the VM is alive, and it's probably your java program
    that's broken. In that case, make a JRA recording to see what's happening:
    http://e-docs.bea.com/jrockit/docs142/usingJRA/jra.html
    The methods pane is probably what you're looking for.
    If you don't get any thread dump when sending a SIGQUIT to JRockit,
    come back here.
    Regards //Johan
    Gr?goire Rolland wrote:
    Hello,
    I have a webapp running on Tomcat 5.0.28/RHEL 3.0. After some time (approximatively 1 hour), a java process take 100% cpu load and never stop, but the application do nothing.
    Some detail on my configuration :
    Distribution : Redhat Enterprise Linux 3.0 (updated)
    Kernel 2.4.21-37.0.1.ELsmp
    Glibc 2.3.2-95.37
    JVM : JRockit 1.4.2.08 (the last one)
    Tomcat : 5.0.28
    Server : 2*Xeon 3GHz HT, 2Go RAM
    JVM param : -Xmx:256m -Xms:256m
    Thanks for your answers ...

  • 100% CPU usage on Call Manager Publisher

    High CPU usage on Cisco Call Manager Publisher.
    The CPU is constantly spiking at upwards of 90% as a result of the "Services.exe" process. Can anyone please advise why this is consuming CPU.
    thanks,
    Srini

    Hi Srini.
    Just post this question in  IP Telephony  seciton where u will get answers quickly.
    Regards
    Esa

  • CustomTableCellRenderer consume 100%CPU

    I have a Table wtih a customTableCellRenderer. I �ve found out that the method getTableCellRendererComponent of my cellRenderer will be repeatly called. Thats why it consumes 100% Cpu.
    Here the setting of table
    tableOverview.setDefaultRenderer(Object.class,new AppointmentStateIconTableCellRenderer());And thats my customTableCellRenderer
    * Created on 03.09.2005
    * TODO To change the template for this generated file go to Window -
    * Preferences - Java - Code Style - Code Templates
    package client.gui;
    import java.awt.Color;
    import java.awt.Component;
    import java.io.IOException;
    import javax.swing.JTable;
    import javax.swing.table.DefaultTableCellRenderer;
    import client.AppointmentStateIcon;
    public class AppointmentStateIconTableCellRenderer extends
              DefaultTableCellRenderer {
         private long init = 0;
         public Component getTableCellRendererComponent(JTable table, Object value,
                   boolean isSelected, boolean hasFocus, int row, int column) {
              Component renderer = null;
              table.setShowGrid(false);
              if (value instanceof AppointmentStateIcon){
                             try {
                        renderer = new AppointmentStateIconTableRenderer(
                                  (AppointmentStateIcon) value);
                   } catch (IOException e) {
              } else {
                   renderer = super.getTableCellRendererComponent(table, value,isSelected, hasFocus,row,column);
              renderer.setForeground(Color.BLACK);
              renderer.setBackground(Color.WHITE);
              return renderer;
    }thx for fast help

    Do not construct a new Renderer everytime when your value is a instance of AppointmentStateIcon. A renderer just act as a rubber-stamp for rendering all cells in the table; it renders the first cell, changes the contents of that cell renderer, shifts the origin to the new location, re-draws it, and so on. Try to overrides the validate, revalidate, repaint, and firePropertyChange methods to be no-ops to help to increase the performance. Read the API Documentation for DefaultCellRenderer for more information.

  • Tomcat 4.0 and Oracle 10g takes 100% CPU and grinds to a halt

    Hi, I have a system to support that is currently running on Tomcat 4.0 on a Windows Server 2003 R2 SP2 machine with 3.06Ghz, 4Gb Memory, 2Gb Page file connecting to an Oracle 8.1.6 database on a Windows NT 4 virtual server with 3.2Ghz, 1152Mb Memory, 1536Mb Page file.
    I have another Windows virtual server 2003 R2 SP2 machine with 2Gb of memory and a 4Gb page. This server has Tomcat 4.0 and an Oracle 10.2.0.3.0 database. I have made sure that the Oracle 10g classes12.jar file is used.
    I am trying to run the application on the new server. In some tests I had users logging on one by one for the first 5 users - performance was great and the application ran faster than the current live system. When I then got another 10 - 15 people logging on the CPU stuck at 100% on the server, even exploring the server was almost impossible, and the application slowed down to unworkable.
    We dont know if the problem lies with the very fact that we are trying to connect to a 10g database which is cost based and the application was written using rule based Oracle 8. Or is it the virtual server? Or is it the fact that we have both the application and the database on the same server.
    I dont know if it is possible to have another Tomcat4.0 server running on our live server but connecting to the 10g database - what would happen with classes12.zip and classes12.jar? would there be a conflict?
    I would really appreciate some help here. You should know though that I am not a hardened java programmer - I can dabble, but am an Oracle Forms, Reports, Discoverer, SQL person by trade. I am also a trainee DBA, so again am not an expert by any means.
    Thanks in advance for your help
    Lizzie

    lizzie8 wrote:
    Hi, I have a system to support that is currently running on Tomcat 4.0 on a Windows Server 2003 R2 SP2 machine with 3.06Ghz, 4Gb Memory, 2Gb Page file connecting to an Oracle 8.1.6 database on a Windows NT 4 virtual server with 3.2Ghz, 1152Mb Memory, 1536Mb Page file.Tomcat 4? We're up to Tomcat 6. The important difference is the JDK supported. What JDK are you using for Tomcat?
    >
    I have another Windows virtual server 2003 R2 SP2 machine with 2Gb of memory and a 4Gb page. This server has Tomcat 4.0 and an Oracle 10.2.0.3.0 database. I have made sure that the Oracle 10g classes12.jar file is used.classes12.jar is pretty old technology. The JAR should match your JDK and version of Oracle.
    I am trying to run the application on the new server. In some tests I had users logging on one by one for the first 5 users - performance was great and the application ran faster than the current live system. When I then got another 10 - 15 people logging on the CPU stuck at 100% on the server, even exploring the server was almost impossible, and the application slowed down to unworkable.You don't say anything about the whether or not you're using a connection pool or what's happening to the open connections and cursors. If you find that those are drifting up over time, it's likely that the code isn't closing resources properly.
    We dont know if the problem lies with the very fact that we are trying to connect to a 10g database which is cost based and the application was written using rule based Oracle 8. Or is it the virtual server? Or is it the fact that we have both the application and the database on the same server.Database and app server should be separated, IMO.
    I dont know if it is possible to have another Tomcat4.0 server running on our live server but connecting to the 10g database - what would happen with classes12.zip and classes12.jar? would there be a conflict?
    I would really appreciate some help here. You should know though that I am not a hardened java programmer - I can dabble, but am an Oracle Forms, Reports, Discoverer, SQL person by trade. I am also a trainee DBA, so again am not an expert by any means.You need more data. Get some tools to see where the time is being spent. Start monitoring your Oracle connections and cursors to see what's going on. Install some filters to get raw timings on your Java calls. Without data, you're guessing in the dark.
    %

  • CF9 CPU at 100%. Moved to new CF11 server and copied files over and it's still at 100% CPU almost immediately on new server

    Our web server is stuck at 100% CPU.  Three days ago we were on CF9 and started running into this problem until the server crashed and wasn't salvageable.  Luckily we had a fresh Windows 2008 Server R2 ready to go with a fresh copy of CF11 on it.  I copied all the website files over and we were back up and running.  A day later the CPU is back to 100% on the new CF11 Windows 2008R2 server.  I also updated CF11 to the latest update 3 that was just released.
    If I turn off the CF service the CPU usage goes back to normal.  If I turn CF back on, the CPU goes back to 100% within like 5 seconds.  So it doesn't seem like some slow running page or anything that eventually eats up all the memory or whatever.  I'm not an expert at looking at the logs, but I don't see anything too out of the ordinary.  The one thing that looks strange to me is I see this line over and over.
    Dec 12, 2014 11:28:41 AM Information [ajp-bio-8014-exec-59] - Starting HTTP request {URL='http://zzen1wbudopwg.nchyt.com/encfm/en0024-ssj5iway6wvg/cbeim94a1s2kebu.php?do=194', method='get'}
    That line makes me think we got hacked somehow, but it's hard to know.
    I did up my JVM heap size and max size to 1024MB.  We have 4GB of memory.  And i changed teh JVM arguments to what's below based on a forum post.  Nothing seems to help.
    -server -XX:PermSize=192m -XX:MaxPermSize=192m -XX:+UseParallelGC -Xbatch -Dcoldfusion.home={application.home} -Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.JavaUtilLog -Duser.language=en -Dcoldfusion.rootDir={application.home} -Dcoldfusion.libPath={application.home}/lib -Dorg.apache.coyote.USE_CUSTOM_STATUS_MSG_IN_HEADER=true -Dcoldfusion.jsafe.defaultalgo=FIPS186Random
    Any additional ideas on how to debug this or what to look at?  Thanks!

    Thanks Charlie for your insight.  I searched everywhere to find a cfhttp request that was causing the issue, but couldn't find it.  I did find some unusual files that were loaded though that I know we didn't put there.  I did a search and found this link that shows the code.  Coldfusion CFIDE bitcoin mining exploit – PHP involved… | code-complete.com and that you mention in your article too.  I don't see any of the executables running or files that were mentioned though.  I found that code in 8 different spots though and removed them.  Maybe our old server had the executables and hacked files on them.  Hard to know as it won't boot up anymore!
    I think I did possibly isolate the HTTP request {URL='http://zzen1wbudopwg.nchyt.com/encfm/en0024-ssj5iway6wvg/cbeim94a1s2kebu.php?do=218', method='get'} in the http.log file to a certain site in IIS though.  And it wasn't our main site.  I turn off this website in IIS and it appears the weird request goes away.  I turn the site back on and it starts to re-appear.  It doesn't always load constantly so it's a little hard to tell.  This site is pretty small.  I went through each file on the site and did find one file that did appear to be hacked.  It wasn't coldfusion code though.  Just some html links.  I removed it.  That's all I could find.  No cfhttp calls or anything else.
    We re-installed Coldfusion 11 on Friday as well and upgraded to Update 3.  It doesn't stay locked at 100% as much right now, but it being over the weekend we don't get much traffic.  Monday will be the real test.  I think I will leave that smaller site turned off for now and see how things perform.  I'm doing a full virus scan for the heck of it overnight too.  Don't really expect it to find anything though. I also turned on advanced logging in IIS 7.5 and don't see anything out of the ordinary.  I made sure client variables weren't in the registry either.
    Here's a part of the http.log file when I turn the IIS site on.  I turn the site off and it stops popping up in the logs.
    "Information","ajp-bio-8014-exec-57","12/13/14","22:33:14",,"Starting HTTP request {URL='http://zzen1wbudopwg.nchyt.com/encfm/en0024-ssj5iway6wvg/cbeim94a1s2kebu.php?do=233', method='get'}"
    "Information","ajp-bio-8014-exec-57","12/13/14","22:36:17",,"Starting HTTP request {URL='http://zzen1wbudopwg.nchyt.com/encfm/en0024-ssj5iway6wvg/cbeim94a1s2kebu.php?do=601', method='get'}"
    "Information","ajp-bio-8014-exec-57","12/13/14","22:38:31",,"Starting HTTP request {URL='http://zzen1wbudopwg.nchyt.com/encfm/en0024-ssj5iway6wvg/cbeim94a1s2kebu.php?do=459', method='get'}"
    "Information","ajp-bio-8014-exec-57","12/13/14","22:38:54",,"Starting HTTP request {URL='http://zzen1wbudopwg.nchyt.com/encfm/en0024-ssj5iway6wvg/cbeim94a1s2kebu.php?do=108', method='get'}"
    "Information","ajp-bio-8014-exec-57","12/13/14","22:39:55",,"Starting HTTP request {URL='http://zzen1wbudopwg.nchyt.com/encfm/en0024-ssj5iway6wvg/cbeim94a1s2kebu.php?do=218', method='get'}"
    "Information","ajp-bio-8014-exec-63","12/13/14","22:52:03",,"Starting HTTP request {URL='http://zzen1wbudopwg.nchyt.com/encfm/en0024-ssj5iway6wvg/cbeim94a1s2kebu.php?do=54', method='get'}"
    "Information","ajp-bio-8014-exec-64","12/13/14","22:57:32",,"Starting HTTP request {URL='http://zzen1wbudopwg.nchyt.com/encfm/en0024-ssj5iway6wvg/cbeim94a1s2kebu.php?do=40', method='get'}"
    "Information","ajp-bio-8014-exec-64","12/13/14","22:58:37",,"Starting HTTP request {URL='http://zzen1wbudopwg.nchyt.com/encfm/en0024-ssj5iway6wvg/cbeim94a1s2kebu.php?do=702', method='get'}"

  • NIO Selector.select() enters a 100% CPU infinite loop on interruption

    This issue is only reproducible in Windows.
    When a thread is calling Selector.select() and the other thread interrupts the selector thread, Selector.select() enters an infinite loop taking up CPU time.  All other JDKs I've tried including IBM 1.5 / 1.6, SUN 1.5 / 1.6 simply returned 0 when its interrupted.  I think JRockit needs to behave similarly, without 100% CPU consumption.  Here's the test code:
    import java.nio.channels.Selector;
    public class Main {
          public static void main(String[] args) throws Exception {
                  final Thread mainThread = Thread.currentThread();
                  final Selector s = Selector.open();
                  new Thread() {
                          @Override
                          public void run() {
                                      try {
                                                Thread.sleep(1000);
                                      } catch (InterruptedException e) {
                                                // Ignore.
                                      System.out.println("interrupt()");
                                      mainThread.interrupt();
                  }.start();
                  System.out.println("select()");
                  s.select(5000);
                  System.out.println("success");
                  s.close();
    Expected result:
            select()
            interrupt()
            success
    Actual result:
            select()
            interrupt()
            &lt;stuck with 100% CPU consumption&gt;
    Version:
            JRMC-3.0.3-1.5.0 - build R27.6.0-50_o-100423-1.5.0_15-20080626-2105-windows-ia32, compiled mode
            JRMC-3.0.3-1.6.0 - build R27.6.0-50_o-100423-1.6.0_05-20080626-2105-windows-ia32, compiled mode

    Hi,
    This looks like a bug. Please open a support ticket and request a patch if you need a fix asap. If you can wait we will fix this in an upcoming release. Thank you for your help

  • 100% CPU load but no clue in thread dump, EP. Win a bottle of champagne...

    Hi,
    We are suddenly facing 100% CPU load in our EP cluster (5 x 8-way Xeon multiprocessor machines). We have a serious performance problem that is burning a lot of our time and causes a lot of stress for over 3 weeks now.
    We have taken tens of thread dumps from Application Nodes.
    - In none of the thread dumps we see the Finalizer thread
    running.
    - From the garbage collector log we see that full garbage
    collection runs occur very rarily (once an hour).
    - We use the compacting garbage collector.
    - In a lot of thread dumps we do not even see our own portal code in the stack traces of the threads!
    - In Windows Task Manager we see the jlaunch.exe processes
    consume all available CPU time.
    - Portal users see a blank portal page when the CPU load hits 100%. When the load goes down again, things return to normal.
    - There are no errors logged in any of the log files of the portal. We checked all of them. We expected a log full of errors somewhere but nothing even remotely interesting was found. Windows Event Viewer shows nothing either.
    - The amount of sockets in CLOSE_WAIT status is < 10 on every machine in the cluster.
    This forces me to conclude that something in the jlaunch.exe executable consumes the CPU time. This raises the following 3 questions:
    - What does the mystifying jlaunch.exe do besides executing java.exe ?
    - Why is the Java virtual machine launched by a custom executable like jlaunch (What is it that cannot be program med in Java) ? Can it be GZip compression ?
    - If the problem is not caused by jlaunch.exe, then it must be caused by the JVM. What activity, invisible in thread dumps, is performed by the JVM that can cause the high CPU load ?
    Our development- and support teams are desperate. All suggestions are welcome. The person that comes up with
    the solution to our problem gets a nice bottle of champagne.
    Regards,
    Chris Twigt

    Hi,
    - What does the mystifying jlaunch.exe do besides executing java.exe ?
    This is so that the startupframework can connect more easily and take control of the JVM in some situations
    - Why is the Java virtual machine launched by a custom executable like jlaunch (What is it that cannot be program med in Java) ?
    I assume when SAP release their JVM (in the next major release), that will be called directly.
    - If the problem is not caused by jlaunch.exe, then it must be caused by the JVM. What activity, invisible in thread dumps, is performed by the JVM that can cause the high CPU load ?
    Loads of thing, but there should be clues in the thread dumps.  (the reason why your code is not in those thread dumps is that your code is only active during the processing of a particular request, unless you have a service, afterwards there are no trace of it as the thread which does the processing goes back to sleep)
    I've experienced a similar situation with a an 6.40 portal, and it was then caused by the following:
    1. User A comes logs in and sees that some cache timeout has occured , therefore it issues a SQL query which does a full table scan on a table of approx. 1 GB (on of the UME tables)
    2. User B comes in just afterwards and also sees that the cache timeout has occured, and issues the same SQL query as User A
    3. User C .... and so on untill the query from User A eventually finishes
    So
    1. Check database. Any big queries running ?
    2. Check file activity, are there a lot of writing ?
    3. Check network activity, especially to the state controller which is the weakest link
    4. What about portal logs ? Any activity during the hang ?
    Also, please provide one of the thread dumps for further analysis..
    cheers
    Dagfinn

  • How to control timing without 100% CPU usage

    I wanted fine control over timing (in windows XP), but ran into two problems.
    Problem 1: If you use the Swing timer, or Thread.sleep, the resolution is limited to 10 or 11 milliseconds. There is a Thread.sleep(millis, nanos) function, but I tested it and it still has 11ms resolution in WinXP.
    Problem 2: If you use jbanes's GAGE timer, CPU utilization will always be 100%.
    Solution: Use a hybrid technique. I would love to have nanosecond resolution AND low CPU utilization at any speed (and if you have any suggestions, please post them) but for now:
    class /*name*/ extends Thread{
    public void run(){
              setDelay(delaySettings[speed]); //Set "delay" to the desired delay in nanoseconds
              long nanos;
              while(true){
                   if(running){ //"running" is a boolean that can pause or unpause the game
                        nanos=System.nanoTime()+delay;
                        tick(); //Do the game logic and graphics for one frame
                        if(delay>11000000){ //If the system timer can handle it
                             try{sleep(delay/1000000);} //delay/1000000 gives millis
                             catch(Exception e){System.out.println("Caught sleep exception: "+e);}
                        }else{ //use a nanotimer (cpu-expensive)
                             while(System.nanoTime()<nanos){}
                   }else{ //it is paused, so wait a bit
                        try{sleep(50);}
                        catch(Exception e){System.out.println("Caught sleep exception: "+e);}
    //The rest of your code
    }If your desired delay is greater than the system timer resolution (here, I have it set at 11,000,000 nanoseconds, or 11ms) then you can use the Thread.sleep(milliseconds) call, which will have approximately 0% CPU utilization until the thread wakes up. Theoretically, you could use this time for another thread, but at the very minimum, your computer should use less power / generate less heat. If your desired resolution is smaller than 11,000,000 nanoseconds, it goes into a loop that checks nanoTime()... which gives you 100% CPU usage, but is very accurate. This works pretty well if you want to control the framerate dynamically (I use the "-"/"=" buttons to adjust speed) and it handles "pause" events, though I'm sure there are better ways to do that.
    Note: The timing granularity above 11ms for this technique is probably 11ms, though the code could be modified to provide nanosecond granularity at any speed.
    Note 2: I found this to run 3% faster than when I used the GAGE timer.
    -Cherry

    Pause the game when u alt-tab away ^_^
    Thats what most native fullscreen games do (the
    non-networked kind atleast)Good idea, but the crux of the issue is really the underlying scheduler which allows
    the thread to race.
    How to "Eliminate" 100% CPU usage.
    Tony's Law of the exec constant. <<<<"Any thread or process running on a non-preemptive operating system MUST NOT use blocking
    IO, and MUST preempt itself at leat 20MS per iteration."
    The reason it is called a constant is because it is the minimum time needed to ensure
    the underlying operating system gets enough CPU cycles to function correctly.
    Every milliseconds below this increases exponentially the chance of locking up or
    crashing despite the speed of your system.
    Most people who program do not realize the the implications of running under defective schedulers
    such as the one provided with MS windows where, for example, you can block on a socket, and
    hang your whole system.
    >>> Do NOT use Thread.sleep() <<< but instead use Object.wait();
    Do not use blockng IO. If you have to use java.io, use available() to make such you ONLY
    read the exact amount of bytes you need without blocking and make sure to prempt
    yourself at least 20MS per iteration.
    ie:
    InputStream inputStream;
    while(working)
    Object waitObject = new Object();
    int readCount = 0;
    int availableBytes = 0;
    int  totalBytes = 10;
       while(readCount < totalBytes)
          if((availableBytes = inputStream.available())!=0)
              read() (the # of Bytes available)
          else
              synchronized(waitObject)
                   waitObject.wait(200);        // 5X per second poll
                    waitObject.notifyAll();
    Using wait() removes the current thread from being scheduled; Thread.sleep()
    leaves the Thread on the schedule list. wait() releases all monitors allow other
    threads to have them; THread.sleep() does not.
    The 100% CPU issue is especially bad under NT BTW.
    If you do this not only will your CPU usage go to negligible, but you
    will never again lock your system because of it.
    Good Luck!
    (T)

  • 100% CPU Usage caused by HMI

    Hi everybody:
    I'm working with LabVIEW DSC 8.2.1 in a system that monitors many variables of a plant, such a typical SCADA system. For this reason, the use of the graphic tools is highly used on the development of this system. Everything works fine, but I have only one problem.... the usage of the CPU.
    When I am working on the development system I (not the executable) I start the application and after the variables are initialized and every process has started and are running , the CPU usage is raised around 90 - 100%. After a few days investigating the reason of this, I realized thay when I change the view on the screen to another view, for example the block diagram of the application, while the application is still running, the CPU usage goes around 15 - 25%. I've tried these many times changing the view from Front panel to Block Diagram and viceversa and the result is always the same: Front Panel= around 100%; Block diagram or another view (other applications MMIs, or Block Diagrams, etc.)= around 20%.
    Another thing that I realized is that the other view (different to front panel) has to fill the entire screen to work the way I'm telling before.
    When I build and run the executable, the usage of the CPU is the same... (around 100%), but I can't see any other application, because the application built is the shell of the OS, so no other views are available.
    I don't know if there's some other consideration to take into account about the HMI when creating an application, and I'll appreciate very much your help.
    Thanks in advance!
    Ignacio von Unger

     From http://100cpuusage.blogspot.com/
    100 Percent CPU Usage when you run programs after you install Windows XP Service Pack 2
    CPU Usage 100% Symptoms
    When you run some programs, the CPU Usage meter in Task Manager may indicate CPU Usage 100%. When CPU utilization reaches 100 percent, programs will run very slowly or stop responding (hang) and your computer is freezing or crashing.
    Noteress CTRL+ALT+DEL to view CPU utilization, click Task Manager, and then click the Performance tab.
    These symptoms occur after you install Microsoft Windows XP Service Pack 2 (SP2).
    CPU Usage 100% Cause
    These problem occurs because of the user interface code that is included in Windows XP SP2. The high CPU utilization is caused by the additional overhead that occurs when the IsWindow function is called by the user interface code.
    RESOLUTION
    Hotfix information
    A supported hotfix is now available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next service pack that contains this hotfix.
    To resolve this problem, submit a request to Microsoft Online Customer Services to obtain the hotfix. To submit an online request to obtain the hotfix, visit the following Microsoft Web site:
    http://go.microsoft.com/?linkid=6294451
    Note If additional issues occur or any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. To create a separate service request, visit the following Microsoft Web site:
    http://support.microsoft.com/contactus/?ws=support (http://support.microsoft.com/contactus/?ws=support)
    Prerequisites
    To apply this hotfix, you must have Windows XP SP2 installed.
    Restart requirement
    You must restart the computer after you apply this hotfix.
    Hotfix replacement information
    This hotfix does not replace any other hotfixes.
    File information
    The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel. Date Time Version Size File name
    30-Mar-2005 19:53 5.1.2600.2643 577,024 User32.dll
    30-Mar-2005 01:30 5.1.2600.2643 1,836,544 Win32k.sys
    if you still do not know how to Fix CPU Usage 100%?
    I suggest you try targeted software - registry cleaner to fix cpu usage 100%
    Because there are many cases causing high cpu utilization.
    1. If you do a lot of web surfing and are concerned about spyware, adware infecting your machine, they will cause system crashes and CPU utilization reaches 100 percent. Some good registry cleaner has the function of spyware & adware removal.
    2. You install many beta version of the software, Drivers are not certified, which resulted in many errors, you get high cpu usage.
    3.100% CPU Usage while you use Internet Explorer
    4. many unneed Startup Program.
    5.Others PC Errors. - DLL errors, runtime errors, Windows-Installer Errors, Windows Startup Errors,paths Broken DLLs, OCX, and ActiveX Components all will cause 100% cpu usage. Your PC will run very slowly.
    Registry cleaner can do a complete scan of your entire file system and registry in under 2 minutes! Fix High Cpu Usage. Improve PC Speed By Up to 70%!
    http://www.100-cpu-usage.com/ suggest you to download registry cleaner to fix 100% cpu usage too.
    PCErrorsfixer.com - Top 3 Windows Registry Cleaners, Improve PC Performance,5 Star Rated. Fix 100% CPU Usage, Runtime Error, DLL Error,Windows Startup Errors,Internet Explorer Errors, Speed Up your slow PC.

Maybe you are looking for

  • MS-6533E VGA Driver problem on Windows NT

    Hi We recently bought a computer with a MS-6533E board with a vga plug on it.  I am trying to find a driver for Windows NT 4 (sp6a), I couldn't find a driver for it on the CD-Rom that came with the board. I went on the web page, I downloaded http://d

  • Cannot connect to scanner or reinstall software

    Recenlty my  Office Jet 7210 AIO would no longer connect for scanning. I ran the HP HP Print and Scan Doctor Diagnostics tool and it sees the scanner just fine, but tells me I need to reinstall the HP Solutions software. I have tried several times to

  • How do I get Firefox from "saving" to Downloads EVERY PDF file I open ??

    Greetings, New to Firefox. Running Mac Leopard and needed Firefox because a business website running a business replay podcast did not recognize Safari. So far so good. I actually prefer Firefox to Safari now. One little thing. Every time I browse th

  • Select Tables for reduction

    Hi , in step "Select Tables for Reduction" , each table has to be selected one- by- one for reduction. Is there any functionality to select more than ONE tables starting with Custom Name Space and mark them for "NO Transfer" ? Possibly with help of m

  • MfE Log File on E72

    Any ideas on how to keep the MfE logfile contained (other than regularly deleting it. Even though MfE is working OK, the log is filling with info messages. Mark Enderby