micronaut-projects / micronaut-core

Micronaut Application Framework
http://micronaut.io
Apache License 2.0
6.02k stars 1.05k forks source link

Netty DefaultHttpClient logs "BUG - Handler not removed" after adding logbook #10514

Open balapal opened 6 months ago

balapal commented 6 months ago

Expected Behavior

I have added the logbook client handler to the netty pipeline as per documented at https://docs.micronaut.io/latest/guide/#nettyClientPipeline

It properly logs the request/response, but started to see this WARN level log messages: [client-nioEventLoopGroup-4-1] WARN i.m.h.client.netty.DefaultHttpClient - BUG - Handler not removed: ChannelHandlerContext[logbook, [id: 0x34d2..., L:/ipAddress:port - R:domain/ipAddress:port])

I have tried to find the in the micronaut code base where that log message could come from, but didn't find it.

Actual Behaviour

No response

Steps To Reproduce

  1. Create an HTTP client annotated with micronaut's @Client
  2. Add the LogbookNettyClientCustomizer as per the documentation: https://docs.micronaut.io/latest/guide/#nettyClientPipeline
  3. Call the method of the HTTP Client

Environment Information

JDK 17

Example Application

https://docs.micronaut.io/latest/guide/#nettyClientPipeline

Version

4.3.6

yawkat commented 6 months ago

annoying. it needs to stay in onRequestPipelineBuilt for http2 but has to go into onStreamPipelineBuilt for http1. and it may break entirely in a future update where i replace pipeliningserverhandler for http2. the perils of messing with the handler pipeline directly