Replies: 1 comment
-
Found the root cause: we replaced JsonExceptionHandler, due to micronaut 4 breaking change of JsonExceptionHandler (JsonProcessingException change to JsonSyntaxException), we missed the update. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have an microservice application that uses
micronaut-platform-bom version 4.5.1
micronaut.core version 4.5.4
I have a test that sends incomplete json body "{" and the microservice would return 400 http status code.
After I update the application with
micronaut-platform-bom version 4.7.0
micronaut.core version 4.7.5
The same test that sends incomplete json body "{" would get the microservice return 500 http status code.
How can I get the original behavior? My understanding is that if the client sends an incomplete json body, that service should return 400 as per https://github.com/micronaut-projects/micronaut-core/blob/v4.7.5/http-server-netty/src/test/groovy/io/micronaut/http/server/netty/binding/DefaultJsonErrorHandlingSpec.groovy#L28
Error log
| / () ___ _ __ ___ _ __ __ _ _ | |
| |/| | |/ | '/ _ | ' \ / _
| | | | __| | | | | | (__| | | (_) | | | | (_| | |_| | |_ "|_| |_|_|\___|_| \___/|_| |_|\__,_|\__,_|\__|" "19:58:39.024 [default-nioEventLoopGroup-4-2] ERROR i.m.http.server.RouteExecutor - Unexpected error occurred: Unexpected end-of-input: expected close marker for Object (start marker at [Source: REDACTED (
StreamReadFeature.INCLUDE_SOURCE_IN_LOCATIONdisabled); line: 1, column: 1])" " at [Source: REDACTED (
StreamReadFeature.INCLUDE_SOURCE_IN_LOCATIONdisabled); line: 1, column: 2]" "io.micronaut.json.JsonSyntaxException: Unexpected end-of-input: expected close marker for Object (start marker at [Source: REDACTED (
StreamReadFeature.INCLUDE_SOURCE_IN_LOCATIONdisabled); line: 1, column: 1])" " at [Source: REDACTED (
StreamReadFeature.INCLUDE_SOURCE_IN_LOCATIONdisabled); line: 1, column: 2]" " at io.micronaut.jackson.databind.JacksonDatabindMapper.readValue(JacksonDatabindMapper.java:201)" " at io.micronaut.json.body.JsonMessageHandler.read(JsonMessageHandler.java:108)" " at io.micronaut.http.netty.body.NettyJsonHandler.read(NettyJsonHandler.java:131)" " at io.micronaut.http.server.netty.binders.NettyBodyAnnotationBinder.transform(NettyBodyAnnotationBinder.java:184)" " at io.micronaut.http.server.netty.binders.NettyBodyAnnotationBinder$1.lambda$new$0(NettyBodyAnnotationBinder.java:125)" " at io.micronaut.core.execution.ImperativeExecutionFlowImpl.flatMap(ImperativeExecutionFlowImpl.java:72)" " at io.micronaut.http.server.netty.binders.NettyBodyAnnotationBinder$1.<init>(NettyBodyAnnotationBinder.java:123)" " at io.micronaut.http.server.netty.binders.NettyBodyAnnotationBinder.bindFullBody(NettyBodyAnnotationBinder.java:116)" " at io.micronaut.http.bind.binders.DefaultBodyAnnotationBinder.bind(DefaultBodyAnnotationBinder.java:70)" " at io.micronaut.http.bind.binders.DefaultBodyAnnotationBinder.bind(DefaultBodyAnnotationBinder.java:35)" " at io.micronaut.web.router.AbstractRouteMatch.fulfillValue(AbstractRouteMatch.java:366)" " at io.micronaut.web.router.AbstractRouteMatch.fulfillBeforeFilters(AbstractRouteMatch.java:322)" " at io.micronaut.web.router.DefaultUriRouteMatch.fulfillBeforeFilters(DefaultUriRouteMatch.java:39)" " at io.micronaut.http.server.binding.RequestArgumentSatisfier.fulfillArgumentRequirementsBeforeFilters(RequestArgumentSatisfier.java:57)" " at io.micronaut.http.server.netty.NettyRequestArgumentSatisfier.fulfillArgumentRequirementsBeforeFilters(NettyRequestArgumentSatisfier.java:50)" " at io.micronaut.http.server.RequestLifecycle.fulfillArguments(RequestLifecycle.java:513)" " at io.micronaut.http.server.netty.NettyRequestLifecycle.fulfillArguments(NettyRequestLifecycle.java:136)" " at io.micronaut.http.server.RequestLifecycle.executeRoute(RequestLifecycle.java:191)" " at io.micronaut.http.server.RequestLifecycle.lambda$normalFlow$1(RequestLifecycle.java:182)" " at io.micronaut.http.filter.FilterRunner.provideResponse(FilterRunner.java:272)" " at io.micronaut.http.filter.FilterRunner.filterRequest(FilterRunner.java:207)" " at io.micronaut.http.filter.FilterRunner.lambda$filterRequest$2(FilterRunner.java:180)" " at io.micronaut.http.filter.AroundLegacyFilter$FilterChainImpl.proceed(AroundLegacyFilter.java:122)" " at io.micronaut.security.filters.SecurityFilter.lambda$checkRules$7(SecurityFilter.java:164)" " at reactor.core.publisher.MonoFlatMapMany$FlatMapManyMain.onNext(MonoFlatMapMany.java:163)" " at reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:82)" " at reactor.core.publisher.FluxConcatMapNoPrefetch$FluxConcatMapNoPrefetchSubscriber.innerNext(FluxConcatMapNoPrefetch.java:258)" " at reactor.core.publisher.FluxConcatMap$ConcatMapInner.onNext(FluxConcatMap.java:863)" " at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onNext(MonoPeekTerminal.java:180)" " at reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.onNext(FluxFilterFuseable.java:337)" " at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2545)" " at reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.request(FluxFilterFuseable.java:411)" " at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.request(MonoPeekTerminal.java:139)" " at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.set(Operators.java:2341)" " at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onSubscribe(Operators.java:2215)" " at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onSubscribe(MonoPeekTerminal.java:152)" " at reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.onSubscribe(FluxFilterFuseable.java:305)" " at reactor.core.publisher.MonoJust.subscribe(MonoJust.java:55)" " at reactor.core.publisher.Mono.subscribe(Mono.java:4495)" " at reactor.core.publisher.FluxConcatMapNoPrefetch$FluxConcatMapNoPrefetchSubscriber.onNext(FluxConcatMapNoPrefetch.java:206)" " at reactor.core.publisher.FluxIterable$IterableSubscription.slowPath(FluxIterable.java:335)" " at reactor.core.publisher.FluxIterable$IterableSubscription.request(FluxIterable.java:294)" " at reactor.core.publisher.FluxConcatMapNoPrefetch$FluxConcatMapNoPrefetchSubscriber.innerComplete(FluxConcatMapNoPrefetch.java:274)" " at reactor.core.publisher.FluxConcatMap$ConcatMapInner.onComplete(FluxConcatMap.java:887)" " at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onComplete(MonoPeekTerminal.java:299)" " at reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.onComplete(FluxFilterFuseable.java:391)" " at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2547)" " at reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.request(FluxFilterFuseable.java:411)" " at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.request(MonoPeekTerminal.java:139)" " at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.request(Operators.java:2305)" " at reactor.core.publisher.FluxConcatMapNoPrefetch$FluxConcatMapNoPrefetchSubscriber.request(FluxConcatMapNoPrefetch.java:338)" " at reactor.core.publisher.MonoNext$NextSubscriber.request(MonoNext.java:108)" " at reactor.core.publisher.MonoFlatMapMany$FlatMapManyMain.onSubscribe(MonoFlatMapMany.java:141)" " at reactor.core.publisher.MonoNext$NextSubscriber.onSubscribe(MonoNext.java:70)" " at reactor.core.publisher.FluxConcatMapNoPrefetch$FluxConcatMapNoPrefetchSubscriber.onSubscribe(FluxConcatMapNoPrefetch.java:164)" " at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:201)" " at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:83)" " at reactor.core.publisher.InternalFluxOperator.subscribe(InternalFluxOperator.java:62)" " at reactor.core.publisher.FluxDefer.subscribe(FluxDefer.java:54)" " at reactor.core.publisher.Mono.subscribe(Mono.java:4495)" " at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onComplete(FluxSwitchIfEmpty.java:82)" " at reactor.core.publisher.MonoFlatMap$FlatMapMain.onComplete(MonoFlatMap.java:189)" " at reactor.core.publisher.MonoNext$NextSubscriber.onComplete(MonoNext.java:102)" " at reactor.core.publisher.FluxFlatMap$FlatMapMain.checkTerminated(FluxFlatMap.java:847)" " at reactor.core.publisher.FluxFlatMap$FlatMapMain.drainLoop(FluxFlatMap.java:609)" " at reactor.core.publisher.FluxFlatMap$FlatMapMain.drain(FluxFlatMap.java:589)" " at reactor.core.publisher.FluxFlatMap$FlatMapMain.onComplete(FluxFlatMap.java:466)" " at reactor.core.publisher.FluxIterable$IterableSubscription.slowPath(FluxIterable.java:357)" " at reactor.core.publisher.FluxIterable$IterableSubscription.request(FluxIterable.java:294)" " at reactor.core.publisher.FluxFlatMap$FlatMapMain.onSubscribe(FluxFlatMap.java:371)" " at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:201)" " at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:83)" " at reactor.core.publisher.Mono.subscribe(Mono.java:4495)" " at io.micronaut.core.async.propagation.ReactivePropagation$1.subscribe(ReactivePropagation.java:54)" " at io.micronaut.core.async.propagation.ReactivePropagation$1.subscribe(ReactivePropagation.java:61)" " at reactor.core.publisher.MonoFromPublisher.subscribe(MonoFromPublisher.java:67)" " at reactor.core.publisher.Mono.subscribe(Mono.java:4495)" " at reactor.core.publisher.FluxFlatMap$FlatMapMain.onNext(FluxFlatMap.java:427)" " at reactor.core.publisher.FluxArray$ArraySubscription.slowPath(FluxArray.java:127)" " at reactor.core.publisher.FluxArray$ArraySubscription.request(FluxArray.java:100)" " at reactor.core.publisher.FluxFlatMap$FlatMapMain.onSubscribe(FluxFlatMap.java:371)" " at reactor.core.publisher.FluxMerge.subscribe(FluxMerge.java:70)" " at reactor.core.publisher.Mono.subscribe(Mono.java:4495)" " at io.micronaut.core.async.propagation.ReactivePropagation$1.subscribe(ReactivePropagation.java:54)" " at io.micronaut.core.async.propagation.ReactivePropagation$1.subscribe(ReactivePropagation.java:61)" " at reactor.core.publisher.MonoFromPublisher.subscribe(MonoFromPublisher.java:67)" " at reactor.core.publisher.Mono.subscribe(Mono.java:4495)" " at io.micronaut.core.async.propagation.ReactivePropagation$1.subscribe(ReactivePropagation.java:54)" " at io.micronaut.core.async.propagation.ReactivePropagation$1.subscribe(ReactivePropagation.java:61)" " at reactor.core.publisher.MonoFromPublisher.subscribe(MonoFromPublisher.java:67)" " at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)" " at io.micronaut.http.reactive.execution.ReactorExecutionFlowImpl.onComplete(ReactorExecutionFlowImpl.java:89)" " at io.micronaut.http.server.netty.NettyRequestLifecycle.handleNormal(NettyRequestLifecycle.java:101)" " at io.micronaut.http.server.netty.RoutingInBoundHandler.accept(RoutingInBoundHandler.java:235)" " at io.micronaut.http.server.netty.websocket.NettyServerWebSocketUpgradeHandler.accept(NettyServerWebSocketUpgradeHandler.java:156)" " at io.micronaut.http.server.netty.handler.PipeliningServerHandler$OptimisticBufferingInboundHandler.read(PipeliningServerHandler.java:500)" " at io.micronaut.http.server.netty.handler.PipeliningServerHandler.channelRead(PipeliningServerHandler.java:220)" " at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)" " at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)" " at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)" " at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93)" " at io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtensionHandler.channelRead(WebSocketServerExtensionHandler.java:87)" " at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)" " at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)" " at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)" " at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)" " at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)" " at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)" " at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)" " at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)" " at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)" " at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)" " at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:289)" " at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)" " at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)" " at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)" " at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1407)" " at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)" " at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)" " at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:918)" " at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)" " at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)" " at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)" " at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)" " at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)" " at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)" " at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)" " at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)" " at java.base/java.lang.Thread.run(Thread.java:1583)" "Caused by: com.fasterxml.jackson.core.io.JsonEOFException: Unexpected end-of-input: expected close marker for Object (start marker at [Source: REDACTED (
StreamReadFeature.INCLUDE_SOURCE_IN_LOCATIONdisabled); line: 1, column: 1])" " at [Source: REDACTED (
StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 2]"" at com.fasterxml.jackson.core.base.ParserMinimalBase._reportInvalidEOF(ParserMinimalBase.java:585)"
" at com.fasterxml.jackson.core.base.ParserBase._handleEOF(ParserBase.java:535)"
" at com.fasterxml.jackson.core.base.ParserBase._eofAsNextChar(ParserBase.java:552)"
" at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._skipWSOrEnd(UTF8StreamJsonParser.java:3063)"
" at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:716)"
" at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)"
" at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:342)"
" at com.fasterxml.jackson.databind.ObjectReader._bind(ObjectReader.java:2099)"
" at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1249)"
" at io.micronaut.jackson.databind.JacksonDatabindMapper.readValue(JacksonDatabindMapper.java:199)"
" ... 128 common frames omitted"
"19:58:39.219 [default-nioEventLoopGroup-4-2] INFO my.app.LoggingService - API: [500] [POST] /my/app/endpoint "
Beta Was this translation helpful? Give feedback.
All reactions