Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException createParser [DATAES-942] #1495

Closed
spring-projects-issues opened this issue Oct 7, 2020 · 3 comments
Closed

NullPointerException createParser [DATAES-942] #1495

spring-projects-issues opened this issue Oct 7, 2020 · 3 comments
Labels
in: core type: bug

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Oct 7, 2020

Vity opened DATAES-942 and commented

 

I got an exception in the log, unfortunately I am not able to reproduce it. It happens after several index searches. The stack trace does not go through any part of my code.

 I had to switch back to classical REST operations. Obviously there is something wrong with the media-type for parsing and the code is not able to handle it.

Let me know if I can help somehow.

Exception(most recent call first)java.lang.NullPointerException: null
    at org.springframework.data.elasticsearch.client.reactive.DefaultReactiveElasticsearchClient.createParser(DefaultReactiveElasticsearchClient.java:800)
    at org.springframework.data.elasticsearch.client.reactive.DefaultReactiveElasticsearchClient.getElasticsearchException(DefaultReactiveElasticsearchClient.java:867)
    at org.springframework.data.elasticsearch.client.reactive.DefaultReactiveElasticsearchClient.contentOrError(DefaultReactiveElasticsearchClient.java:845)
    at org.springframework.data.elasticsearch.client.reactive.DefaultReactiveElasticsearchClient.lambda$handleServerError$31(DefaultReactiveElasticsearchClient.java:813)
    at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:118)
    at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:121)
    at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:385)
    at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:121)
    at reactor.core.publisher.FluxContextStart$ContextStartSubscriber.onNext(FluxContextStart.java:96)
    at reactor.core.publisher.FluxMapFuseable$MapFuseableConditionalSubscriber.onNext(FluxMapFuseable.java:287)
    at reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.onNext(FluxFilterFuseable.java:330)
    at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1782)
    at reactor.core.publisher.MonoCollect$CollectSubscriber.onComplete(MonoCollect.java:152)
    at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:136)
    at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:252)
    at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:136)
    at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:374)
    at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:373)
    at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:429)
    at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:655)
    at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:96)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
    at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1526)
    at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1275)
    at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1322)
    at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501)
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:440)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
    at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:795)
    at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:475)
    at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.lang.Thread.run(Thread.java:834)

 


Affects: 4.0.4 (Neumann SR4)

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 8, 2020

sothawo commented

can you have  a setup where there is an intercepting proxy like burp or OWASP ZAP between your applicaiton and Elasticsearch? You can configure Spring Data Elasticsearch to use a proxy. Then you might see what comes in as an answer on a failing request

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 8, 2020

sothawo commented

looking at the code and the line numbers from the stacktrace, it seems that

XContentType.fromMediaTypeOrFormat(mediaType)

returns null. That would mean, that the Elasticsearch lib cannot handle the media type that is passed to the function. The media type is extracted from the server's response with

String mediaType = response.headers().contentType().map(MediaType::toString).orElse(XContentType.JSON.mediaType());

so it's either what the server sent, or application/json. Which makes me wonder what comes from the server

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 9, 2020

sothawo commented

Can you set the log level for reactor.netty.http.client.HttpClientOperations to DEBUG?

I have locally set up a scenario where I use an intercepting proxy and change the response to a 501 with an unknown Content-Type. Setting the above log level gives me an entry in the log:

 

2020-10-09 23:09:27.994 DEBUG 58139 --- [ctor-http-nio-1] r.n.http.client.HttpClientOperations : [id: 0x5ce102d9, L:/127.0.0.1:55706 - R:localhost/127.0.0.1:8080] Received response (auto-read:false) : [Content-Type=application/some-strange-stuff, content-length=6234] 

where I can see the content-type that came in

@spring-projects-issues spring-projects-issues added type: bug in: core labels Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core type: bug
Projects
None yet
Development

No branches or pull requests

1 participant