You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Wenxiang Qiu (JIRA)" <ji...@apache.org> on 2018/05/21 11:24:00 UTC

[jira] [Created] (DIRSERVER-2234) Kinit via TCP causes ApacheDS to create a NioProcessor thread at 100% CPU

Wenxiang Qiu created DIRSERVER-2234:
---------------------------------------

             Summary: Kinit via TCP causes ApacheDS to create a NioProcessor thread at 100% CPU
                 Key: DIRSERVER-2234
                 URL: https://issues.apache.org/jira/browse/DIRSERVER-2234
             Project: Directory ApacheDS
          Issue Type: Bug
    Affects Versions: 2.0.0-M24
         Environment: ApacheDS
            Reporter: Wenxiang Qiu


ApacheDS uses a KerberosProtocolHandler as the handler of the 

IoAcceptor in KdcServer.java:

 
{code:java}
// Inject the protocol handler acceptor.setHandler( new KerberosProtocolHandler( this, store ) );
{code}
When a TCP connection is about to be closed, KerberosProtocolHandler$inputClosed(IoSession session) is invoked when 
{code:java}
filterChain.fireInputClosed();
{code}
is reached in AbstractPollingIoProcessor.java. But KerberosProtocolHandler$inputClosed(IoSession session) does nothing:
{code:java}
public void inputClosed( IoSession session )
{
}
{code}
which leaves the session unclosed, which in turn prevents its SocketChannel from being deregistered from the selector in NioProcessor. As a result, 
{code:java}
int selected = select(SELECT_TIMEOUT);
{code}
in AbstractPollingIoProcessor.Processor.run() keeps returning a readable channel, on which read() returns -1. This infinite loop consumes all available CPU.

 

By constrast, LdapServer sets a LdapProtocolHandler to its acceptor, and LdapProtocolHandler inherits inputClosed(IoSession session) from IoHandlerAdapter:
{code:java}
public void inputClosed(IoSession session) throws Exception {
    session.close(true);
}
{code}
which closes properly the session.

 

 

How to reproduce:

Simply run kinit with TCP (by setting udp_preference_limit = 1 in /etc/krb5.conf), and ApacheDS will be running at 100% CPU. Doing it again will consume more CPU resources depending on core number.

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)