ppkarwasz commented on issue #3792:
URL: 
https://github.com/apache/logging-log4j2/issues/3792#issuecomment-3035412560

   Hi @fabian-braun,
   
   The core issue with `lastEpochInstantAndBuffer` is that it's **not 
immutable**, unlike the previous `CachedTime` implementation:
   
   
https://github.com/apache/logging-log4j2/blob/054a4f7084b8a03f932bc9dd40ebba55142a36be/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/DatePatternConverter.java#L161-L171
   
   Using a `String` instead of a `StringBuilder` would break the GC-free 
behavior expected when `log4j2.enableThreadlocals == true`, so we need to 
proceed carefully.
   
   Here’s what I propose:
   
   1. **In version 2.25.1** (scheduled for release next week), we remove 
`lastEpochInstantAndBuffer` entirely and eliminate inter-thread sharing. We’ll 
rely exclusively on the thread locals.
   2. **In version 2.26.0**, we could consider introducing a non-GC-free 
version of `InstantPatternThreadLocalCachedFormatter`. This variant would be 
used when `log4j2.enableThreadlocals = false`, and it would format timestamps 
to immutable `String` values.
   
   @vy What do you think? Since this is the last urgent issue for `2.25.1`, 
I’ll go ahead and open a PR for the first point shortly to help speed up 
development. That way, we can review the three open PRs over the weekend and 
aim to stage `2.25.1` next week.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to