micronaut-projects / micronaut-gradle-plugin

A Gradle Plugin for Micronaut
Apache License 2.0
67 stars 44 forks source link

New Error with AOT plugin 4.2.1: Cannot read field "channel" because "poolHandle" is null #902

Open jjathman opened 11 months ago

jjathman commented 11 months ago

Expected Behavior

Executing HTTP requests should be successful

Actual Behaviour

We are seeing this exception (top of the stack trace shown) in one of our applications after updating to the 4.2.1 version of the Micronaut AOT plugin. Even disabling every optimization still seems to demostrate this issue. Reverting to 4.2.0 fixes the problem. This code executes several concurrent HTTP requests using a Flux. The requests do utilize a separate thread pool.

14:56:00.710 [Test worker] ERROR reactor.core.publisher.Operators - Operator called default onErrorDropped
java.lang.NullPointerException: Cannot read field "channel" because "poolHandle" is null
    at io.micronaut.http.client.netty.DefaultHttpClient.lambda$exchangeImpl$27(DefaultHttpClient.java:1109)
    at reactor.core.publisher.MonoFlatMapMany$FlatMapManyMain.onNext(MonoFlatMapMany.java:163)
    at reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:82)
    at reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:82)
    at io.micronaut.http.client.netty.CancellableMonoSink.tryForward(CancellableMonoSink.java:69)
    at io.micronaut.http.client.netty.CancellableMonoSink.request(CancellableMonoSink.java:146)
    at reactor.core.publisher.MonoNext$NextSubscriber.request(MonoNext.java:108)
    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.MonoNext$NextSubscriber.onSubscribe(MonoNext.java:70)
    at io.micronaut.http.client.netty.CancellableMonoSink.subscribe(CancellableMonoSink.java:62)
    at reactor.core.publisher.MonoFromPublisher.subscribe(MonoFromPublisher.java:67)
    at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
    at io.micronaut.core.async.propagation.ReactivePropagation$1.subscribe(ReactivePropagation.java:54)
    at io.micronaut.core.async.propagation.ReactivePropagation$1.subscribe(ReactivePropagation.java:54)

Steps To Reproduce

No response

Environment Information

No response

Example Application

No response

Version

io.micronaut.aot version 4.2.1

melix commented 11 months ago

What version of Micronaut is this application using? Any chance you can share a reproducer? I suspect we need an AOT release built against Micronaut 4.2 but not fully convinced yet.

jjathman commented 11 months ago

@melix we are using Micronaut 4.2.1. I'll see if I can simplify something to get a small reproducer. I'm not quite sure what is unique about this particular application versus the others we have which don't seem to encounter this issue.

melix commented 11 months ago

Alternatively, you can try to build the following branch of AOT: https://github.com/micronaut-projects/micronaut-aot/pull/260

(edit, this is now on master)

Run ./gradlew pTML, then in your project, add mavenLocal() as a repository and configure aot to use 2.2.0-SNAPSHOT:

micronaut {
    aot {
        version = "2.2.0-SNAPSHOT"
    }
}
ideadapt commented 6 months ago

We currently face this issue in production using Micronaut 4.3.6 (edit: still with 4.5). We have many declarative HttpClients in use, but only some instances of them produce above error. More stacktrace:

java.lang.NullPointerException: Cannot read field \"channel\" because \"poolHandle\" is null
  at io.micronaut.http.client.netty.DefaultHttpClient.lambda$exchangeImpl$27(DefaultHttpClient.java:1110)
  at reactor.core.publisher.MonoFlatMapMany$FlatMapManyMain.onNext(MonoFlatMapMany.java:163)
  at reactor.core.publisher.MonoContextWriteRestoringThreadLocals$ContextWriteRestoringThreadLocalsSubscriber.onNext(MonoContextWriteRestoringThreadLocals.java:110)
  at reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:82)
  at reactor.core.publisher.FluxContextWriteRestoringThreadLocals$ContextWriteRestoringThreadLocalsSubscriber.onNext(FluxContextWriteRestoringThreadLocals.java:118)
  at io.micronaut.http.client.netty.CancellableMonoSink.tryForward(CancellableMonoSink.java:69)
  at io.micronaut.http.client.netty.CancellableMonoSink.request(CancellableMonoSink.java:146)
  at reactor.core.publisher.FluxContextWriteRestoringThreadLocals$ContextWriteRestoringThreadLocalsSubscriber.request(FluxContextWriteRestoringThreadLocals.java:163)
  at reactor.core.publisher.MonoNext$NextSubscriber.request(MonoNext.java:108)
  at reactor.core.publisher.MonoContextWriteRestoringThreadLocals$ContextWriteRestoringThreadLocalsSubscriber.request(MonoContextWriteRestoringThreadLocals.java:156)
  at reactor.core.publisher.MonoFlatMapMany$FlatMapManyMain.onSubscribe(MonoFlatMapMany.java:141)
  at reactor.core.publisher.MonoContextWriteRestoringThreadLocals$ContextWriteRestoringThreadLocalsSubscriber.onSubscribe(MonoContextWriteRestoringThreadLocals.java:95)
  at reactor.core.publisher.MonoNext$NextSubscriber.onSubscribe(MonoNext.java:70)
  at reactor.core.publisher.FluxContextWriteRestoringThreadLocals$ContextWriteRestoringThreadLocalsSubscriber.onSubscribe(FluxContextWriteRestoringThreadLocals.java:104)
  at io.micronaut.http.client.netty.CancellableMonoSink.subscribe(CancellableMonoSink.java:62)
  at reactor.core.publisher.MonoFromPublisher.subscribe(MonoFromPublisher.java:64)
  at reactor.core.publisher.MonoContextWriteRestoringThreadLocals.subscribe(MonoContextWriteRestoringThreadLocals.java:44)
  at reactor.core.publisher.Mono.subscribe(Mono.java:4512)
  at io.micronaut.http.client.filters.ClientServerRequestTracingPublisher.lambda$subscribe$0(ClientServerRequestTracingPublisher.java:52)
  at io.micronaut.http.context.ServerRequestContext.with(ServerRequestContext.java:49)
  at io.micronaut.http.client.filters.ClientServerRequestTracingPublisher.subscribe(ClientServerRequestTracingPublisher.java:52)
  at io.micronaut.core.async.propagation.ReactivePropagation.lambda$propagate$0(ReactivePropagation.java:72)
  at reactor.core.publisher.MonoFromPublisher.subscribe(MonoFromPublisher.java:64)
  at reactor.core.publisher.MonoContextWriteRestoringThreadLocals.subscribe(MonoContextWriteRestoringThreadLocals.java:44)
  at reactor.core.publisher.Mono.subscribe(Mono.java:4512)
  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:64)
  at reactor.core.publisher.MonoContextWriteRestoringThreadLocals.subscribe(MonoContextWriteRestoringThreadLocals.java:44)
  at reactor.core.publisher.FluxFromMonoOperator.subscribe(FluxFromMonoOperator.java:85)
  at io.micronaut.configuration.metrics.binder.web.WebMetricsPublisher.subscribe(WebMetricsPublisher.java:151)
  at reactor.core.publisher.Flux.subscribe(Flux.java:8777)
  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:64)
  at reactor.core.publisher.MonoContextWriteRestoringThreadLocals.subscribe(MonoContextWriteRestoringThreadLocals.java:44)
  at reactor.core.publisher.Flux.subscribe(Flux.java:8777)
  at reactor.core.publisher.FluxFlatMap.trySubscribeScalarMap(FluxFlatMap.java:202)
  at reactor.core.publisher.FluxFlatMap.subscribeOrReturn(FluxFlatMap.java:94)
  at reactor.core.publisher.Flux.subscribe(Flux.java:8762)
  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:64)
  at reactor.core.publisher.MonoContextWriteRestoringThreadLocals.subscribe(MonoContextWriteRestoringThreadLocals.java:44)
  at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:76)
  at reactor.core.publisher.MonoContextWriteRestoringThreadLocals.subscribe(MonoContextWriteRestoringThreadLocals.java:44)
  at reactor.core.publisher.InternalFluxOperator.subscribe(InternalFluxOperator.java:68)
  at reactor.core.publisher.FluxSwitchMapNoPrefetch$SwitchMapMain.subscribeInner(FluxSwitchMapNoPrefetch.java:218)
  at reactor.core.publisher.FluxSwitchMapNoPrefetch$SwitchMapMain.onNext(FluxSwitchMapNoPrefetch.java:164)
  at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122)
  at reactor.core.publisher.FluxContextWriteRestoringThreadLocals$ContextWriteRestoringThreadLocalsSubscriber.onNext(FluxContextWriteRestoringThreadLocals.java:118)
  at io.micronaut.core.async.publisher.Publishers$JustPublisher$1.request(Publishers.java:604)
  at reactor.core.publisher.FluxContextWriteRestoringThreadLocals$ContextWriteRestoringThreadLocalsSubscriber.request(FluxContextWriteRestoringThreadLocals.java:163)
  at reactor.core.publisher.FluxMap$MapSubscriber.request(FluxMap.java:164)
  at reactor.core.publisher.FluxSwitchMapNoPrefetch$SwitchMapMain.onSubscribe(FluxSwitchMapNoPrefetch.java:147)
  at reactor.core.publisher.FluxMap$MapSubscriber.onSubscribe(FluxMap.java:92)
  at reactor.core.publisher.FluxContextWriteRestoringThreadLocals$ContextWriteRestoringThreadLocalsSubscriber.onSubscribe(FluxContextWriteRestoringThreadLocals.java:104)
  at io.micronaut.core.async.publisher.Publishers$JustPublisher.subscribe(Publishers.java:594)
  at reactor.core.publisher.FluxSource.subscribe(FluxSource.java:71)
  at reactor.core.publisher.FluxContextWriteRestoringThreadLocals.subscribe(FluxContextWriteRestoringThreadLocals.java:46)
  at reactor.core.publisher.MonoFromFluxOperator.subscribe(MonoFromFluxOperator.java:83)
  at reactor.core.publisher.MonoContextWriteRestoringThreadLocals.subscribe(MonoContextWriteRestoringThreadLocals.java:44)
  at reactor.core.publisher.MonoZip$ZipCoordinator.request(MonoZip.java:220)
  at reactor.core.publisher.FluxMap$MapSubscriber.request(FluxMap.java:164)
  at reactor.core.publisher.FluxMap$MapSubscriber.request(FluxMap.java:164)
  at reactor.core.publisher.MonoZip$ZipInner.onSubscribe(MonoZip.java:470)
  at reactor.core.publisher.FluxMap$MapSubscriber.onSubscribe(FluxMap.java:92)
  at reactor.core.publisher.FluxMap$MapSubscriber.onSubscribe(FluxMap.java:92)
  at reactor.core.publisher.MonoZip.subscribe(MonoZip.java:129)
  at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:76)
  at reactor.core.publisher.MonoZip$ZipCoordinator.request(MonoZip.java:220)
  at reactor.core.publisher.MonoFlatMap$FlatMapMain.request(MonoFlatMap.java:194)
  at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.java:171)
  at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.java:171)
  at reactor.core.publisher.FluxFlatMap$FlatMapMain.onSubscribe(FluxFlatMap.java:373)
  at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.java:96)
  at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.java:96)
  at reactor.core.publisher.MonoFlatMap$FlatMapMain.onSubscribe(MonoFlatMap.java:117)
  at reactor.core.publisher.MonoZip.subscribe(MonoZip.java:129)
  at reactor.core.publisher.InternalFluxOperator.subscribe(InternalFluxOperator.java:68)
  at reactor.core.publisher.FluxContextWriteRestoringThreadLocals.subscribe(FluxContextWriteRestoringThreadLocals.java:46)
  at reactor.core.publisher.Flux.subscribe(Flux.java:8777)
  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:64)
  at reactor.core.publisher.MonoContextWriteRestoringThreadLocals.subscribe(MonoContextWriteRestoringThreadLocals.java:44)
  at reactor.core.publisher.Flux.subscribe(Flux.java:8777)
  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:64)
  at reactor.core.publisher.MonoContextWriteRestoringThreadLocals.subscribe(MonoContextWriteRestoringThreadLocals.java:44)
  at reactor.core.publisher.Flux.subscribe(Flux.java:8777)
  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:64)
  at reactor.core.publisher.MonoContextWriteRestoringThreadLocals.subscribe(MonoContextWriteRestoringThreadLocals.java:44)
  at reactor.core.publisher.Flux.subscribe(Flux.java:8777)
  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:64)
  at reactor.core.publisher.MonoContextWriteRestoringThreadLocals.subscribe(MonoContextWriteRestoringThreadLocals.java:44)
  at reactor.core.publisher.Flux.subscribe(Flux.java:8777)
  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:64)
  at reactor.core.publisher.MonoContextWriteRestoringThreadLocals.subscribe(MonoContextWriteRestoringThreadLocals.java:44)
  at reactor.core.publisher.Flux.subscribe(Flux.java:8777)
  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:64)
  at reactor.core.publisher.MonoContextWriteRestoringThreadLocals.subscribe(MonoContextWriteRestoringThreadLocals.java:44)
  at reactor.core.publisher.Flux.subscribe(Flux.java:8777)
  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:64)
  at reactor.core.publisher.MonoContextWriteRestoringThreadLocals.subscribe(MonoContextWriteRestoringThreadLocals.java:44)
  at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:76)
  at reactor.core.publisher.MonoFlatMapMany$FlatMapManyMain.onNext(MonoFlatMapMany.java:195)
  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:2571)
  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:2367)
  at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onSubscribe(Operators.java:2241)
  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.InternalMonoOperator.subscribe(InternalMonoOperator.java:76)
  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:2573)
  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:2331)
  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:68)
  at reactor.core.publisher.FluxDefer.subscribe(FluxDefer.java:54)
  at reactor.core.publisher.Mono.subscribe(Mono.java:4512)
  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:850)
  at reactor.core.publisher.FluxFlatMap$FlatMapMain.drainLoop(FluxFlatMap.java:612)
  at reactor.core.publisher.FluxFlatMap$FlatMapMain.drain(FluxFlatMap.java:592)
  at reactor.core.publisher.FluxFlatMap$FlatMapMain.onComplete(FluxFlatMap.java:469)
  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:373)
  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:4512)
  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:64)
  at reactor.core.publisher.MonoContextWriteRestoringThreadLocals.subscribe(MonoContextWriteRestoringThreadLocals.java:44)
  at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:76)
  at reactor.core.publisher.MonoContextWriteRestoringThreadLocals.subscribe(MonoContextWriteRestoringThreadLocals.java:44)
  at reactor.core.publisher.Mono.subscribe(Mono.java:4512)
  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:64)
  at reactor.core.publisher.MonoContextWriteRestoringThreadLocals.subscribe(MonoContextWriteRestoringThreadLocals.java:44)
  at reactor.core.publisher.FluxFromMonoOperator.subscribe(FluxFromMonoOperator.java:85)
  at io.micronaut.configuration.metrics.binder.web.WebMetricsPublisher.subscribe(WebMetricsPublisher.java:151)
  at reactor.core.publisher.Flux.subscribe(Flux.java:8777)
  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:64)
  at reactor.core.publisher.MonoContextWriteRestoringThreadLocals.subscribe(MonoContextWriteRestoringThreadLocals.java:44)
  at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:76)
  at io.micronaut.http.reactive.execution.ReactorExecutionFlowImpl.onComplete(ReactorExecutionFlowImpl.java:89)
  at io.micronaut.http.server.netty.NettyRequestLifecycle.handleNormal(NettyRequestLifecycle.java:94)
  at io.micronaut.http.server.netty.RoutingInBoundHandler.accept(RoutingInBoundHandler.java:227)
  at io.micronaut.http.server.netty.websocket.NettyServerWebSocketUpgradeHandler.accept(NettyServerWebSocketUpgradeHandler.java:156)
  at io.micronaut.http.server.netty.handler.PipeliningServerHandler$MessageInboundHandler.read(PipeliningServerHandler.java:388)
  at io.micronaut.http.server.netty.handler.PipeliningServerHandler.channelRead(PipeliningServerHandler.java:213)
  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.onHttpRequestChannelRead(WebSocketServerExtensionHandler.java:160)
  at io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtensionHandler.channelRead(WebSocketServerExtensionHandler.java:83)
  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:1410)
  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:919)
  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(Unknown Source)
yibo-long commented 1 month ago

I believe the issue is from micronaut-http-client, not aot. And this is possibly a mitigation to the solution: https://github.com/openlibraryenvironment/dcb-service/blob/9ed96e96da799ebbe2b64292b31eed2f6d0356d4/dcb/src/main/resources/application.yml#L52