-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix concurrent date-time formatting issue in PatternLayout
#1485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Closes #1490. |
theit
pushed a commit
to theit/logging-log4j2
that referenced
this pull request
May 30, 2023
LuciferYang
added a commit
to apache/spark
that referenced
this pull request
Oct 23, 2023
### What changes were proposed in this pull request? This pr aims upgrade log4j from 2.20.0 to 2.21.0. ### Why are the changes needed? Support for the zstd compression algorithm has been added in the new version: apache/logging-log4j2#1508 | apache/logging-log4j2#1514 Meanwhile, the new version starts to use Java 11 for building, and the runtime version is still compatible with Java 8: apache/logging-log4j2#1369 The new version also brings some bug fixes, such as: - Fixed logging of java.sql.Date objects by appending it before Log4J tries to call java.util.Date.toInstant() on it: apache/logging-log4j2#1366 - Fixed concurrent date-time formatting issue in PatternLayout: apache/logging-log4j2#1485 - Fixed buffer size in Log4jFixedFormatter date time formatter: apache/logging-log4j2#1418 - Fixed the propagation of synchronous action failures in RollingFileManager and FileRenameAction: apache/logging-log4j2#1445 | apache/logging-log4j2#1549 - Fixed RollingFileManager to propagate failed synchronous actions correctly: apache/logging-log4j2#1445 and more. The complete release note is as follows: - https://github.com/apache/logging-log4j2/releases/tag/rel%2F2.21.0 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Pass GitHub Actions ### Was this patch authored or co-authored using generative AI tooling? No Closes #43478 from LuciferYang/SPARK-45625. Authored-by: yangjie01 <[email protected]> Signed-off-by: yangjie01 <[email protected]>
ppkarwasz
added a commit
that referenced
this pull request
Jul 4, 2025
This change disables the sharing of formatted timestamps between threads in `InstantPatternThreadLocalCachedFormatter`. Previously, a mutable `StringBuilder` was shared across threads via a cached object. This could lead to situations where one thread ("owner") was modifying the builder while another thread was reading from it, resulting in inaccurate or truncated timestamps. This fix ensures that only thread-local instances are used, preventing concurrency issues and improving timestamp correctness under load. This change is similar in nature to #1485 and fixes #3792.
ppkarwasz
added a commit
that referenced
this pull request
Jul 4, 2025
This change disables the sharing of formatted timestamps between threads in `InstantPatternThreadLocalCachedFormatter`. Previously, a mutable `StringBuilder` was shared across threads via a cached object. This could lead to situations where one thread ("owner") was modifying the builder while another thread was reading from it, resulting in inaccurate or truncated timestamps. This fix ensures that only thread-local instances are used, preventing concurrency issues and improving timestamp correctness under load. This change is similar in nature to #1485 and fixes #3792.
ppkarwasz
added a commit
that referenced
this pull request
Jul 5, 2025
This change disables the sharing of formatted timestamps between threads in `InstantPatternThreadLocalCachedFormatter`. Previously, a mutable `StringBuilder` was shared across threads via a cached object. This could lead to situations where one thread ("owner") was modifying the builder while another thread was reading from it, resulting in inaccurate or truncated timestamps. This fix ensures that only thread-local instances are used, preventing concurrency issues and improving timestamp correctness under load. This change is similar in nature to #1485 and fixes #3792.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes the concurrency issue in
DatePatternConverter
exhibiting itself under contention and whenThreadLocal
s are disabled. See @smarkwal's report for details.