qos-ch / logback-access

Logback access jakarta project
Other
8 stars 8 forks source link

AccessEvent cannot return cookies when Jetty Request is recycled #11

Closed marinedayo closed 3 weeks ago

marinedayo commented 5 months ago

Logback Access 2.0.1 and Jetty 11. (Probably also occurs in the previous Logback Access 1.4 series.

The issue occurs because the Jetty web server recycles org.eclipse.jetty.server.Request Objects. When the server completes processing a given Request object, the server recycles the Request Object. After the Request Object is recycled, any various data related to the previous request will no longer be available. For example, if using an appender that processes asynchronously, the Request object may be recycled before logging.

AccessEvent has prepareForDeferredProcessing method to avoid this, but the cookie is not considered here.

https://github.com/qos-ch/logback-access/blob/40fada85146ecf1bf3cc89f8997b7fd27a02b3e8/common/src/main/java/ch/qos/logback/access/common/spi/AccessEvent.java#L623-L645

https://github.com/qos-ch/logback-access/blob/40fada85146ecf1bf3cc89f8997b7fd27a02b3e8/common/src/main/java/ch/qos/logback/access/common/spi/AccessEvent.java#L457-L473

ceki commented 4 months ago

Fixed in commit 8509ec23a653

ceki commented 4 months ago

relates to https://github.com/qos-ch/logback-access/issues/6

ceki commented 2 months ago

Fixed in logback-access version 2.0.2.

marinedayo commented 3 weeks ago

Please close this issue as well.