You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@directory.apache.org by Ulrich Knecht <Ul...@avid.com> on 2008/08/20 12:58:04 UTC

NPE during directory search

Hi,

  we frequently encounter interrupted LDAP searches with our ApacheDS
1.5.3 instance under Windows XP. When looking at the wrapper.log, we
find
NullPointerException like shown below (in
SearchResultEntry.computeLength).
All further queries to the server then encounter the same error.

Did anyone encounter a similar error before? Any help greatly
appreciated!

Best Regards,

 Ulrich

excerpt from wrapper.log:

INFO   | jvm 1    | 2008/08/20 10:12:02 | [10:12:02] WARN
[org.apache.directory.server.ldap.LdapServer$LdapProtocolHandler] -
[MUC-UKnecht.global.avidww.com/10.129.199.46:4755] Unexpected exception
forcing session to close: sending disconnect notice to client.
INFO   | jvm 1    | 2008/08/20 10:12:02 |
org.apache.mina.filter.codec.ProtocolEncoderException:
java.lang.NullPointerException
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.filter.codec.ProtocolCodecFilter.filterWrite(ProtocolCod
ecFilter.java:224)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain.callPreviousFilterW
rite(AbstractIoFilterChain.java:361)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain.access$1300(Abstrac
tIoFilterChain.java:53)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.filterW
rite(AbstractIoFilterChain.java:659)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.filterWr
ite(AbstractIoFilterChain.java:587)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain.callPreviousFilterW
rite(AbstractIoFilterChain.java:361)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain.fireFilterWrite(Abs
tractIoFilterChain.java:355)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.transport.socket.nio.SocketSessionImpl.write0(SocketSess
ionImpl.java:166)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.BaseIoSession.write(BaseIoSession.java:17
7)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.BaseIoSession.write(BaseIoSession.java:16
8)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.directory.server.ldap.handlers.DefaultSearchHandler.searchMes
sageReceived(DefaultSearchHandler.java:389)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.directory.server.ldap.handlers.SearchHandler.messageReceived(
SearchHandler.java:41)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.handler.demux.DemuxingIoHandler.messageReceived(Demuxing
IoHandler.java:141)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.directory.server.ldap.LdapServer$LdapProtocolHandler.messageR
eceived(LdapServer.java:1179)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageR
eceived(AbstractIoFilterChain.java:570)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageRece
ived(AbstractIoFilterChain.java:299)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain.access$1100(Abstrac
tIoFilterChain.java:53)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.message
Received(AbstractIoFilterChain.java:648)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput.flush(S
impleProtocolDecoderOutput.java:58)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(Protoco
lCodecFilter.java:180)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageRece
ived(AbstractIoFilterChain.java:299)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain.access$1100(Abstrac
tIoFilterChain.java:53)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.message
Received(AbstractIoFilterChain.java:648)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilt
er.java:220)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run
(ExecutorFilter.java:264)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecuto
r.java:885)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.ja
va:907)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
java.lang.Thread.run(Thread.java:619)
INFO   | jvm 1    | 2008/08/20 10:12:02 | Caused by:
java.lang.NullPointerException
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.directory.shared.ldap.codec.search.SearchResultEntry.computeL
ength(SearchResultEntry.java:283)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.directory.shared.ldap.codec.LdapMessage.computeLength(LdapMes
sage.java:546)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.directory.shared.ldap.codec.LdapMessage.encode(LdapMessage.ja
va:622)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.directory.shared.ldap.codec.TwixEncoder.encodeBlocking(TwixEn
coder.java:125)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.directory.shared.ldap.codec.TwixEncoder.encode(TwixEncoder.ja
va:201)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.directory.shared.ldap.message.MessageEncoder.encode(MessageEn
coder.java:128)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.directory.shared.asn1.codec.Asn1CodecEncoder.encode(Asn1Codec
Encoder.java:57)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.filter.codec.ProtocolCodecFilter.filterWrite(ProtocolCod
ecFilter.java:214)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain.callPreviousFilterW
rite(AbstractIoFilterChain.java:361)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain.access$1300(Abstrac
tIoFilterChain.java:53)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.filterW
rite(AbstractIoFilterChain.java:660)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.filterWr
ite(AbstractIoFilterChain.java:588)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain.callPreviousFilterW
rite(AbstractIoFilterChain.java:361)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain.fireFilterWrite(Abs
tractIoFilterChain.java:356)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.transport.socket.nio.SocketSessionImpl.write0(SocketSess
ionImpl.java:167)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.BaseIoSession.write(BaseIoSession.java:17
7)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.BaseIoSession.write(BaseIoSession.java:16
8)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.directory.server.ldap.handlers.DefaultSearchHandler.searchMes
sageReceived(DefaultSearchHandler.java:389)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.directory.server.ldap.handlers.SearchHandler.messageReceived(
SearchHandler.java:42)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.handler.demux.DemuxingIoHandler.messageReceived(Demuxing
IoHandler.java:141)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.directory.server.ldap.LdapServer$LdapProtocolHandler.messageR
eceived(LdapServer.java:1180)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageR
eceived(AbstractIoFilterChain.java:570)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageRece
ived(AbstractIoFilterChain.java:299)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain.access$1100(Abstrac
tIoFilterChain.java:53)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.message
Received(AbstractIoFilterChain.java:649)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput.flush(S
impleProtocolDecoderOutput.java:58)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(Protoco
lCodecFilter.java:180)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageRece
ived(AbstractIoFilterChain.java:299)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain.access$1100(Abstrac
tIoFilterChain.java:53)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.message
Received(AbstractIoFilterChain.java:649)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilt
er.java:220)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run
(ExecutorFilter.java:264)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecuto
r.java:886)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.ja
va:908)
INFO   | jvm 1    | 2008/08/20 10:12:02 | 	... 1 more=20

Re: NPE during directory search

Posted by Emmanuel Lecharny <el...@gmail.com>.
Ulrich Knecht wrote:
> Hi,
>
>   we frequently encounter interrupted LDAP searches with our ApacheDS
> 1.5.3 instance under Windows XP. When looking at the wrapper.log, we
> find
> NullPointerException like shown below (in
> SearchResultEntry.computeLength).
> All further queries to the server then encounter the same error.
>
> Did anyone encounter a similar error before? Any help greatly
> appreciated!
>   
Seems that you have entries with some binary value which is null... :

...
                                    byte[] binaryValue = ( byte[] ) value;
                                    localValuesLength += 1 + 
TLV.getNbBytes( binaryValue.length )
                                        + binaryValue.length;
...

If the value is null, you'll get a NPE, straight.

I gonna fix that. Now, the question is how you successfully injected 
entries with a null value, and how the server has accepted them. I will 
try to reproduce the error.

Thanks for the report !

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