-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Using Map.of
in a ContextDataProvider
implementation throws UOE
#2098
Labels
bug
Incorrect, unexpected, or unintended behavior of existing code
Milestone
Comments
ppkarwasz
added
the
bug
Incorrect, unexpected, or unintended behavior of existing code
label
Dec 15, 2023
FYI the aws lambda appender has probably nothing to do with this issue anyway, as i've found out here #2099 |
ppkarwasz
added a commit
to ppkarwasz/logging-log4j2
that referenced
this issue
Dec 15, 2023
This PR marks `StringMap`s generated from Java `Map`s as frozen if the wrapped map is immutable. Fixes apache#2098
ppkarwasz
added a commit
to ppkarwasz/logging-log4j2
that referenced
this issue
Dec 15, 2023
This PR marks `StringMap`s generated from Java `Map`s as frozen if the wrapped map is immutable. Fixes apache#2098
Thanks for reporting this issue. Our Java This should be fixed in the next release. |
ppkarwasz
added a commit
to ppkarwasz/logging-log4j2
that referenced
this issue
Dec 21, 2023
This PR marks `StringMap`s generated from Java `Map`s as frozen if the wrapped map is immutable. Fixes apache#2098
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
I'm using logj2 with a custom
ContextDataProvider
, and then using the aws lambda appender. MyContextDataProvider
implementation usesMap.of
methods from JDK to create cheap immutable maps, but apparently that doesn't work and throws UOE.In the stacktrace it's shown that a method down the stack invokes
ImmutableCollections.AbstractImmutableMap::clear
, which throws UOE. Interesting enough, in many online examples they useCollections.emptyMap()
for the empty map, which doesn't throw UOE onclear
.What puzzles me though is that I wasn't able to reproduce this issue with the log4j2-core console appender. Is the amazon appender doing something strange, or is this a bug of log4j2-core?
Configuration
Version: 2.22.0
Operating system: Linux
JDK: 21 (amazon)
Logs
The text was updated successfully, but these errors were encountered: