You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Jose Ignacio Gil Jaldo (JIRA)" <ji...@apache.org> on 2011/02/09 10:30:58 UTC

[jira] Commented: (DIRMINA-678) NioProcessor 100% CPU usage on Linux (epoll selector bug)

    [ https://issues.apache.org/jira/browse/DIRMINA-678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12992408#comment-12992408 ] 

Jose Ignacio Gil Jaldo commented on DIRMINA-678:
------------------------------------------------

Hi to all,

we may be facing the same issue, however I am not sure of it. We're using version 2.0.0.M6 and JDK under 2.6.X kernels (my local env is 2.6.32 and Prod environment is 2.6.18). The JDK version in Prod environment is 1.6.0_18.

The thing is that our NIOProcessor thread is 100% of the time runnable (according to visualvm). However, I have debugged the method int select(long timeout) in NioProcessor class and for some reason it does not wait the for the timeout but it returns 0 (which makes no sense to me, maybe it's my mistake since I am quite new to NIO but I would swear that it should stop until he has some key or the timeout expires).

Would you say I am experiencing that problem too?  I was thinking of upgrading to 2.0.2 and apply the patch that Emmanuel provided. Has it been tested and works?

Thanks a lot.

> NioProcessor 100% CPU usage on Linux (epoll selector bug)
> ---------------------------------------------------------
>
>                 Key: DIRMINA-678
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-678
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-M4
>         Environment: CentOS 5.x, 32/64-bit, 32/64-bit Sun JDK 1.6.0_12, also _11/_10/_09 and Sun JDK 1.7.0 b50, Kernel 2.6.18-92.1.22.el5 and also older versions,
>            Reporter: Serge Baranov
>             Fix For: 2.0.3
>
>         Attachments: snap973.png, snap974.png
>
>
> It's the same bug as described at http://jira.codehaus.org/browse/JETTY-937 , but affecting MINA in the very similar way.
> NioProcessor threads start to eat 100% resources per CPU. After 10-30 minutes of running depending on the load (sometimes after several hours) one of the NioProcessor starts to consume all the available CPU resources probably spinning in the epoll select loop. Later, more threads can be affected by the same issue, thus 100% loading all the available CPU cores.
> Sample trace:
> NioProcessor-10 [RUNNABLE] CPU time: 5:15
> sun.nio.ch.EPollArrayWrapper.epollWait(long, int, long, int)
> sun.nio.ch.EPollArrayWrapper.poll(long)
> sun.nio.ch.EPollSelectorImpl.doSelect(long)
> sun.nio.ch.SelectorImpl.lockAndDoSelect(long)
> sun.nio.ch.SelectorImpl.select(long)
> org.apache.mina.transport.socket.nio.NioProcessor.select(long)
> org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run()
> org.apache.mina.util.NamePreservingRunnable.run()
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker)
> java.util.concurrent.ThreadPoolExecutor$Worker.run()
> java.lang.Thread.run()
> It seems to affect any NIO based Java server applications running in the specified environment.
> Some projects provide workarounds for similar JDK bugs, probably MINA can also think about a workaround.
> As far as I know, there are at least 3 users who experience this issue with Jetty and all of them are running CentOS (some distribution default setting is a trigger?). As for MINA, I'm not aware of similar reports yet.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira