elasticsearch/elasticsearch — Issue #1685: 0.19.0.RC1: NullPointer exception in XContentFactory.xContent (failed to execute search (building response))
Author: alambert
Created: 2012-02-08 17:00:01+00:00
State: open

Hi,

I just upgraded my cluster to v0.19.0.RC1 with fresh machines and new indexes, and some searches are now returning this error:

[2012-02-08 13:32:38,014][DEBUG][rest.action.search ] [x] failed to execute search (building response)
java.lang.NullPointerException
at org.elasticsearch.common.xcontent.XContentFactory.xContent(XContentFactory.java:106)
at org.elasticsearch.rest.action.support.RestXContentBuilder.restDocumentSource(RestXContentBuilder.java:92)
at org.elasticsearch.search.internal.InternalSearchHit.toXContent(InternalSearchHit.java:366)
at org.elasticsearch.search.internal.InternalSearchHits.toXContent(InternalSearchHits.java:179)
at org.elasticsearch.search.internal.InternalSearchResponse.toXContent(InternalSearchResponse.java:71)
at org.elasticsearch.action.search.SearchResponse.toXContent(SearchResponse.java:272)
at org.elasticsearch.rest.action.search.RestSearchAction$1.onResponse(RestSearchAction.java:96)
at org.elasticsearch.rest.action.search.RestSearchAction$1.onResponse(RestSearchAction.java:90)
at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.innerFinishHim(TransportSearchQueryThenFetchAction.java:195)
at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.finishHim(TransportSearchQueryThenFetchAction.java:175)
at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction$3.onResult(TransportSearchQueryThenFetchAction.java:155)
at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction$3.onResult(TransportSearchQueryThenFetchAction.java:149)
at org.elasticsearch.search.action.SearchServiceTransportAction$8.handleResponse(SearchServiceTransportAction.java:359)
at org.elasticsearch.search.action.SearchServiceTransportAction$8.handleResponse(SearchServiceTransportAction.java:350)
at org.elasticsearch.transport.netty.MessageChannelHandler.handleResponse(MessageChannelHandler.java:244)
at org.elasticsearch.transport.netty.MessageChannelHandler.process(MessageChannelHandler.java:215)
at org.elasticsearch.transport.netty.MessageChannelHandler.callDecode(MessageChannelHandler.java:138)
at org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:92)
at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:558)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:553)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:268)
at org.elasticsearch.common.netty.channel.Channels.fireMessageReceived(Channels.java:255)
at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.read(NioWorker.java:343)
at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:274)
at org.elasticsearch.common.netty.channel.socket.nio.NioWorker.run(NioWorker.java:194)
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102)
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)

I am still investigating this, but the debugger says the XContentType guesser is returning null. I have uploaded a screenshot of the debugger at http://i.imgur.com/agchg.png . The interesting thing is that Unicode.fromBytes(source, offset, length) returns a truncated document that is missing the initial {.

Still investigating over here...trying to get a smaller repro case.