100% cpu usage due to nio selector.open

Hello guys,
I am developing a multiplayer game using nio.In the begging i read all document related to nio.I have never heared about this api uses 100% cpu at server side as well as client side.
When i start my server which is non blocking the cpu usage is dierctly raise to 100%.Working on Operating System windows 2000.Here is my code of server side.
public void initializeOperations() throws IOException,UnknownHostException
          System.out.println("Inside initialization");
          sel = Selector.open(); //THIS FUNCTION RAISES CPU PERFORMANCE TO 100%....
          server = ServerSocketChannel.open();
          server.configureBlocking(false);
          InetAddress ia = InetAddress.getLocalHost();
          //InetSocketAddress isa = new InetSocketAddress(ia,port);
          InetSocketAddress isa = new InetSocketAddress(ia,port);
          server.socket().bind(isa);
     public void run() //startServer() throws Exception
          try
               System.out.println("Inside startserver run()");
     initializeOperations();
               SelectionKey acceptKey = server.register(sel, SelectionKey.OP_ACCEPT );
               while (acceptKey.selector().select() > 0 )
          Set readyKeys = sel.selectedKeys();
          Iterator it = readyKeys.iterator();
          while (it.hasNext()) {
          SelectionKey key = (SelectionKey)it.next();
          it.remove();
          if (key.isAcceptable())
          System.out.println("Key is Acceptable");
ServerSocketChannel ssc = (ServerSocketChannel) key.channel();
     socket = (SocketChannel) ssc.accept();
     socket.configureBlocking(false);
SelectionKey another = socket.register(sel,SelectionKey.OP_READ|SelectionKey.OP_WRITE);
          if (key.isReadable())
                              System.out.println("Key is readable");
                              String ret = readMessage(key);
                              System.out.println("Frm clinet:"+ret);
                              socket = (SocketChannel)key.channel();
          catch(Exception e)
               System.out.println("Exception in ServerConnection:run()");
               e.printStackTrace();
Please see the code where i mentioned comment at that time cpu usage goes upto 100%.
i searched the forum and find that OP_WRITE is creating problem but in my case even client is not comming than also server side cpu usage raises.
please suggest proper solution
thank you

thank you for your suggestion...
so u r telling to compile my application in new version of jdk and run from there..m i right???ok...
i have tried this also in latest version jdk1.5.0_04 than also my cpu usage raise to 100%..
Now i m trying using 1.4.2_08 hope it will work....
is there any other idea to solve my problem please help me out...
thank you

Similar Messages

  • 100% CPU usage in DW CS5 when opening page...

    Hi there, I'm new here!
    I'm working on my site in DW and have already completed another site without having this problem. I open a *paticular* file, and my CPU usage goes to 100% when I use the split view. In code, DW runs fine, but as soon as it tries to render a preview (not in live mode) in the second pane, it starts going quickly between (notresponding) and very slow response. So it's slow or nothing!
    This page is using some z-index in the CSS and flash, so I don't know if maybe it's just my processor speed isn't up to it?
    I have tried it on my downstairs desktop (quad core, can't remember exact specs but could look it up, but it's faster than my ltop, obviously..), and it works slightly better. Does DW use scratch disks? Is there a way to turn off some CSS properties in the display to improve performance? I can work just in code for a lot of my work, but for placement it is much more intuitive to use a split view for me. HELP! (Please and thank you!)

    I am having a similar problem with some files when working in split view.  I have been experiencing slow performance and Dreamweaver goes into "Not Responding" state for 30-60 sec when I click somewhere (doesn't matter if I click in design or code portion) and also when I go to Undo something.  This has happened in other files, too.  Eventually it starts responding again but it is moving slowly. My task manager shows CPU and memory usage spiking up and down as well (specifically memory of Dreamweaver process).
    Sometimes it does it when Dreamweaver is open and I am doing something in another smaller window in front of it too (such as writing an email)…
    I had the task manager open and Dreamweaver (and nothing else) the other day, and Dreamweaver kept flashing back and forth to "Not Responding"… so I closed it and it made task manager freeze up so that it wouldn’t close and the task manager memory and CPU usage were spiking.
    Specs on my machine:
    HP xw6600 workstation
    Windows Vista SP2 (32-bit)
    Intel Xeon Processor (Quad-core, 2.33 GHz)
    4 gigs of RAM
    I am Running Dreamweaver CS5 with all updates installed
    I have already tried the following:
    Re-creating preferences file
    Re-creating registry files
    Re-creating personal config files
    Uninstalling and Re-installing Dreamweaver
    Running a Windows Live Care scan on my computer to check for viruses, registry file errors, etc.
    The only thought I have is that I when I installed CS5, i didnt uninstall CS4 first, thinking that I could just upgrade...
    When I went into add/remove programs Creative Suite CS4 still showed up in there, but the programs were not on my computer anymore.  I removed it anyway, but there were still some random folders left on my computer from it that I found when trying to solve this issue, such as preferences files from CS4 and personal config folders for Dreamweaver CS4, Photoshop CS4, Fireworks CS4 and Contribute CS4, which I deleted, but it has not solved the problem.
    I can't think of anything else to try short of wiping my hard drive and doing a clean install of OS and Creative Suite, which I really dont want to go through.
    Please help!

  • Queue consumer stops with 100% cpu usage

    I'm trying to use Berkeley DB queue with transactions. When I tested what happens when transactions with DB_APPEND are aborted I found that while it works and DB_CONSUME correctly skips over rolled back records, unfortunately extents that have those records are never deleted, which causes database to always grow. Next I tried DB_CONSUME with database opened using DB_INORDER flag and it seems there's a serious regression in Berkeley DB that causes it to loop indefinitely with 100% cpu usage when it encounters a rolled back record. I tested various versions and found that this bug doesn't happen with 5.1.29, but it is reproducible with 5.2.42, so this regression might have been introduced in 5.2. I have also tested 5.3 and 6.0, and both have this behavior. There may be something wrong with the way queue records are rolled back, one indication of that would be that in 5.1.29 doesn't have neither of the two problems I found with DB_QUEUE: extents are deleted after being consumed, and there are no issues when consuming with DB_INORDER either.
    You can find Python code to reproduce this issue here:
    https://gist.github.com/snaury/027a3c546f5b0a62a440
    Sorry for using Python and not e.g. C++, but it's a lot shorter that way.

    We have looked at the issues and they are valid.   We will roll the fixes out for this in our next release of BDB.   The test case was very useful and really helped to speed the process up.    If you have any questions, please contact me directly at [email protected]  Thanks again for bringing this to our attention.
    thanks
    mike

  • Problem:100 % cpu usage with tcp server dll

    Hello,
     I am trying to write a dll with labwindows/cvi that allows me to create a TCP Server. This dll is integrated in labview.I created this Dll with example provides by Labwindows/cvi(rtserver.dll).
    Description of my problem: when i execute this dll in a "While Loop" in labview,the TCp server wait a connection and 100% cpu usage occurs. However when a client is connect to the server,the CPU is normaly used because the program stop when he meets the timeout of the tcpread() function. I would like to know how i could limit CPU usage  when the server is awaiting a client in the labview "While loop".
    I know I could use a DELAY() to limit Cpu usage ,but I would like to know if there are any others solutions.
    thank you.

    i dont know your exact application, but i generally use Q to transfer data to TCP loop in my prgram it helps me in two ways.
    1. it automatically restricts the iteration when ther is no data (Less CPU Usage, Less Unnecessary Trafic)
    2. Q can eliminate problems arising due to non synchronization of loop
    Tushar Jambhekar
    [email protected]
    Jambhekar Automation Solutions
    LabVIEW Consultancy, LabVIEW Training
    Rent a LabVIEW Developer, My Blog

  • Music store & 100% CPU usage

    I've had this problem on my newly built computer, and my older machine. When I browse the iTunes music store, the status bar on the top will often move like it's opening the music store, but it'll do this for a long period of time (several minutes) and iTunes will work, but the music store will not load, and you cannot click the 'X' to stop the contacting of the music store. During this time if you open task manager, iTunes uses 100% of CPU resources. If you close iTunes it still uses 100%. you have to end the process in task manager in order to make it stop. On occasion the music store will work to view maybe one album, but if you search for another album, or click another link it'll do the whole not-responding-100% CPU usage cycle again.
    All drivers are up to date and like I said it's done this on two seperate computers of mine on the same iTunes account. I also have a laptop and the music store works completely fine on it. It's only on my desktops that I have this issue.
    Some specs on my machine if this will help
    Asus motherboard
    AMD Athlon XP 4000+ processor
    2gb Kingston 184 pin DDR ram
    Seagate SATA II 160 GB HD
    Windows XP PRO service pack 2
    thanks for your help!

    I'm only guessing here, but perhaps iTunes is having a conflict with another application. If you are anything like me you probably install your favourite applications on all your computers. As a shortcut to troubleshooting, perhaps consider an application you have installed on the desktops, but NOT on the laptop. Then try uninstalling that application from your desktop computer and test iTunes.
    HP Compaq dx6120 P4 2.8 GHz 1GB RAM (BABYJANE)   Windows XP   iPod : 5G 30GB (BLANCHE)

  • [10.1.2] Protected Mode causing 100% CPU Usage/Extra Processes on Win XP 32-bit?

    Hello,
    I'm not 100% sure if the two are related, but I have a client who was seeing 100% CPU usage using Adobe Acrobat Reader X 10.1.2 on Windows XP 32-bit and Firefox 11. The acrord32.exe process would hang around after closing the main window and eventually leading to tons of processes and his CPU at 100% use. I believe disabling Protected Mode may have solved this issue. I didn't see it documented anywhere so I figure I'd post about it here and see if anyone else was seeing this resolved as well.

    I noticed 'only' 50 % CPU usage. Not during Reader usage with ~ 20 %, but it started after closing main window.
    Two instances of acrord32.exe were created - the moment pdf was opened - of which one was using zero CPU.
    After opening another pdf, 2 more processes were created, so 4 in total. Have seen 2 of them using 100 %.
    Issue is easily recreated.
    This is all in 10.1.3, no fix from Adobe, only THE fix from you: turning of Protected Mode!
    After which now only one proces is created, with 1 to 3 pdf documents opened at same time.
    This instance is then nicely shutdown after the last pfd is closed.

  • Shockwave Flash 11.6.602.168 100% CPU usage

    Hi,
    Our computer has 100% CPU usage every time we get in websites that utilize Flash, or watch youtube.
    Browser: FF 19.0
    Flash 11.6.602.168
    Computer: HP Pentium 4, 2.8 GHz, 3G memory, up-to-date BIOS and other drivers.
    Graphic card: EVGA GeFprce 6200
    Windows 7 32 bits
    This window is freshly installed, has AVG on. We do not have many software's installed, except MS Office. All fans and CPU are clean. The computer runs fairly fast: we tried opening multiple FF tabs simultaneously, plus Excel, Word, Solitaire etc. without any problems. However, whenever we get into websites with Flash, the CPU uasage goes to 100% and stays there. Memory usage has always been stable, around 30%. We have tried the following steps, but it hasn't gotten better:
    - Turned off all applications, opened only one tab with that website.
    - Updated all drivers and applications: FF, Flash, Graphic card etc.
    - Turned ON and OFF hardware acceleration for both Flash and FF, also tried to turn one On, the other OFF, and vise versa.
    - Disabled all add-on's, extensions and Plug-in's, except Flash.
    - Uninstalled and reinstall FF and Flash; restarted several times.
    - Temporarily turned OFF protected mode.
    - Uninstalled FF, Flash, then installed IE 9, then Flash for IE: didn't work.
    - Uninstalled IE 9, Flash, then installed IE10 then reinstalled Flash for IE: also didn't work.
    - We do not keep browsing history.
    Examples of websites that we have had problems with: pbskids.org, barbie.com, and other school websites for kids to do homework or watch youtube.
    While in many websites such as CNN.com, yahoo.com, when we opened it, the CPU usage did spike, but came back to 1-5% within 5 seconds.
    This computer is for our kids. Do we really need to buy an i5 or i7 computer so the kids can play and do homework? Or is there any other way that we can do?
    Thank you

    Moving to the Using Flash Player forum, as this isn't specific to the Beta.
    In the Youtube video, if you right-click and choose Show Video Info, it will show you whether you're using Hardware Acceleration for both Video Rendering and Video Decoding.
    If you're seeing Software Rendering and/or Software Decoding and you're watching a high-def video, it's going to use a ton of CPU.
    Do you see similar behavior in other browsers?  (Chrome, IE)  The Flash Player distributions are actually quite different for each browser.  It would be an interesting data point.

  • Recently FireFox often has been causing 100% CPU usage and locks up until it finishes the process (various ones). Clearing cookies/cache didn't help. Any ideas?

    Windows 2000 SP4, 1g RAM, Firefox 9.0.1
    We keep IE6 and Firefox open simultaneously for 2 different mail accounts. Firefox was always much faster even with 3 or 4 tabs open, but for the past couple of weeks when trying to update a screen the CPU suddenly goes to 100% usage and of course nothing will move until the particular process is finished. Closing one or more tabs does not help. If I close Firefox completely with Task Manager CPU usage goes back down to nil. After restarting Firefox CPU usage may or may not go back up depending upon whether it tries to continue the previous task that was locking it up.
    It did not do this with Firefox 3.6 but then again it didn't happen immediately after updating to 9.0.1 either.

    100% CPU usage occurred most often toward the end of the working day when busy trying to print on-line postage. We don't have any memory-consuming plugins but according to the knowledge base articles Firefox memory usage can gradually increase during the day even if you do nothing. It seems that may be the problem so we close and restart Firefox more often now as that usually fixes the problem. However, if we get stuck on a particular website update that causes the CPU to to go 100%, we can always start Firefox without previous tabs so the update will stop, or simply use a different browser until we have time to let the computer play games with itself.
    So our workaround of restarting Firefox turns out to be the final solution (until we find something better - will post it if we do). Vic

  • Crystalras.exe consuming 100% CPU usage

    Hi everyone,
    When we try to open an instance of one of our Crystal reports from InfoView, the crystalras.exe process runs at 100% CPU usage and the report never shows up. After a few minutes, we get the following message:
    The request timed out because there has been no reply from the server for 600,000 milliseconds.
    Does anyone know where the problem could come from? Could this be because the report is retrieving too much data?
    Thanks in advance for any help.

    Dear Both,
    I traced the RAS server as suggested by Tim and obtained a log that - I have to admit - is quite difficult for me to understand. Could I send it to one of you for examination? Thanks in advance.
    Ted, please find below my answers to your questions:
    Just to close out possible data source issues, are the reports going against Business Views or Universes?
    The report is based on Business Views.
    Do you have Processing Extensions specified for the reports?
    Sorry but what are Processing Extensions?
    Also, when you checked in the Crystal Reports Designer, was it Designer installed on the same machine where the page server and RAS server is running?
    Yes, it is installed on the same machine.
    Also, since it affects both Page Server and RAS, it may require CRPE traces to get to the bottom of this (CRPE - 'creepy' - is the CR engine used by both the Page and RAS server).
    I will certainly open a case with SAP to have them help me on that.
    Thank you both for your help. It is very appreciated.

  • HP LaserJet Pro MFP M127fn - DNS issue, hundreds of UDP connections affects my router 100% CPU usage

    Hi all,
    We've bought about ten pieces (HP LaserJet Pro MFP M127fn), tested only one the other 9 are waiting for their time to be sent in our branch offices. The MFP works fine, no complains till later that day I noticed that our Mikrotik Router was struguling with high CPU usage, it took me some time to find the issue and it was the new bought MFP. Don't know why but it creates hundreds of UDP connections and almost 100% CPU usage goes to DNS service. As soon as I shutdown the MFP and delete all the connections everything goes back to normal. I've disabled almost all services (HP web service, Ipv6, SNMP, AirPrint, SLP, LPD, WS-Discovery, Bonjour), leaving only Ipv4 but without luck the issue persists. Here are some print screens confirming my saying:
    http://i.imgur.com/UiOPSiu.jpg
    http://i.imgur.com/dlgObPb.jpg
    http://i.imgur.com/4RmQhot.jpg
    http://i.imgur.com/oBuo9UO.jpg
    http://i.imgur.com/Zf77V6b.jpg
    Don't know if it is the same case but it look like, found this post that ha no answer to the issue: http://h30434.www3.hp.com/t5/Printer-Networking-and-Wireless/New-HP-LaserJet-Pro-MFP-M127fw-network-...
    Why does this happen? And how to solve my issue? Thank you in advance.

    Hi @EugenX ,
    I have brought your issue to the attention of an appropriate team within HP. They will likely request information from you in order to look up your case details or product serial number. Please look for a private message from an identified HP contact. Additionally, keep in mind not to publicly post serial numbers and case details.
    If you are unfamiliar with how the Forum's private message capability works, this Post has instructions.
    Thank You.
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" on the right to say “Thanks” for helping!
    Gemini02
    I work on behalf of HP

  • 100% CPU usage with XP Cooler from PCAlert4

         Any idea why I would be running 100% cpu usage when running XP Cooler from PCAlert4?  I noticed PC was sluggish when running it so CTRL+ALT+DEL and under performance is 100% CPU with 245MB Ram Usage. No other TSR's running - several application but under 10% CPU usage without PCAlert and XP Cooler.
         I was also wondering if anyone had any ideas on the video?  I have the K7N2G with 768MB DDR PC 2100 (3x256) XP2200+ 266FSB running 1804MHz - Maxtor 30GB 7200RPM - 350W PSU (raidmax - yea yea I know, dont say a word though LOL) on board video and here is the problem - graphics are great, but they get choppy - running NFS HotPursuit 2 at 32bit 800x600 (doesnt seem to matter even when running 16bit 640x480still does it.) what setting am I missing?  Thanks in advance.

    Deathstalker (Richard),
         I did what you suggest in memory management and also changed out the mem on the board - it did make a difference, not as much as I had hoped, but it did.
    Raven,
         I have used Fraps in the past, forgot about it, but went ahead and downloaded it to get a better look.
    To the Both of you,
         Thanks so much for your replies, sometimes it just takes someone outside looking in to see the things overlooked.  But I went ahead and also ran all of the latest updates for the board (semi new system and I only installed with the CD that came with the Mobo) and everything is running better than expected.  Thanks again for your thoughts - keep 'em flowin, it's amazing whom we could help.  Take care.
    Don

  • Distiller 8 and 9 both locking up, 100 % CPU usage

    Not sure if its related, but probably, since it happened right after...I just transferred everything from my quad core mac pro to my new 8-core Mac Pro. Everything went well, but now Distiller 8 starts and then sits and gives the beachball of death, and one of the cores shows 100% cpu usage. (I have that utility that shows memory used, CPU usage, etc.). I hadn't bought Acrobat 9 yet so I downloaded it and installed, and Distiller 9 does the EXACT same thing. The ONLY thing I can call an "error message" is that I can see in the window after it launches is "Error in /Library/Application Support/Adobe PDF/Settings/PDFX4 2007.joboptions:/CheckCompliance out of Range."
    That message may have been there whole time, even when it worked, though. I don't know. At any rate, I need distiller working! Any ideas?

    Glad to hear all is well. Preference files can cause big problems. Eons
    ago, in the 1980s, I used a communications program called Red Ryder. I
    loved the program. After it was updated to a new version (it might have
    been called White Knight by that time), I started to have terrible
    problems. I wrote to their technical support. They couldn't duplicate
    the problem. It couldn't happen etc. I eventually got a little hot under
    the collar. After all, if I couldn't use my modem, I couldn't check my
    email, etc. It turned out to be a problem with my preference file when
    converted to the latest version, that was causing the problem. Since
    they always started with a new preference file, they couldn't duplicate
    the problem that was obvious to me.
    ...Mike

  • 100% CPU usage by iCal

    For some reason my iCal application uses 100% of CPU. What can I do to avoid it?

    I had a similar problem with iTunes.
    Here's the link to what fixed my problem immediately.  Please note: my problem was resolved following just the three steps pasted below.  The original link has additional steps that may be necessary, although I did not employ them, and my problem of 100% CPU USAGE is gone!!!  Thank God!
    URL source:     http://www.hotcomm.com/faq/FAQ_ResetWinsock.asp
    Good Luck
    Copyright (c) 2009 1stWorks Corporation. All rights reserved.
    This article gives instructions for resetting Winsock on Windows XP and Windows Vista: 
    Reset Winsock (Vista) 
    To reset Winsock in Vista: 
    1.Click the Windows Start button. 
    2. Type Cmd in the Start Search text box and press Ctrl-Shift-Enter (keyboard shortcut to run Command Prompt as Administrator). Click Continue to allow elevation request. 
    3. Type netsh winsock reset in the Command Prompt shell, and then press the Enter key. 
    URL source:     http://www.hotcomm.com/faq/FAQ_ResetWinsock.asp

  • Run program in 100% cpu usage

    hi all,
    does any body know how to set the java program to utilize 100% cpu usage? thanks!

    class Empty implements Runnable {
        Empty() {}
        public void run() {
            while(true) {}
        public static void main(String[] arg) {
            new Thread(new Empty()).start();
            new Thread(new Empty()).start();
            new Thread(new Empty()).start();
            new Thread(new Empty()).start();
    }Not sure why you would want to do this though?

  • Copying from USB NTFS device with Dolphin (KDE) causes 100% CPU usage

    I am copying +/- 30 GB of Music files (flac) from my external USB HDD which is formatted as NTFS.
    I have installed ntfs-3g and am experiencing near 100% CPU usage. What's wrong?
    Additional info: I am using KDE and initiated the copying through dolphin. KDE's system monitor only shows CPU usage near 100%, but no processes in the process view could be responsable.
    Thanks!

    What mount options are used for that ntfs drive?
    Edit: There are many similar threads but I couldn't find a solution other than trying out some kernel and cpufrequtils fun.
    Last edited by karol (2011-01-16 18:12:15)

Maybe you are looking for