You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Emmanuel Lecharny <el...@apache.org> on 2009/07/30 10:30:49 UTC

Potential fix for the select() eating 100% CPU

Hi,

trying to get DIRMINA-681/678, I have created a branch 
(http://svn.apache.org/repos/asf/mina/branches/select-fix) with some fix 
for this problem.

To summarize,  the problem is that under certain conditions, the 
select() method can return immediately, even if it returns 0 (which 
means no activity has been detected on any channel). The side effect is 
that the loop goes crazy, eating 100% CPU.

The idea is to check that if select() returns 0, and if it's not due to 
a closed connection, and if it returns without having reached the 
timeout, then it's probably a epoll bug. We then create a new selector, 
and register all the channels on this new selector, and trash the old 
selector.

I don't have any load test for this new version, so I let those of you 
who have such tests to check the branch, and tell me if it fixes the 
issue - or if there are other problems-.

Many thanks !

PS : I would really appreciate if someone can post a piece of code 
demonstrating the problem.

-- 
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org