-
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
ConcurrentModificationException in LoggerContext due to race condition #3234
Comments
I'd suggest fixing this by making |
The `InternalLoggerRegistry` implementation introduced in version `2.24.2` did not return a copy of the registry, when `InternalLoggerRegistry.getLoggers()` was called. This could lead to a `ConcurrentModificationException` if a thread creates a new logger, while another thread calls `LoggerContext.updateLoggers()`. Closes #3234
Nice catch! 💯 |
I'm not certain this is related, but we're seeing what looks like a deadlock around
|
I think it is unrelated, but looking at the stack trace it is almost definitely a dead lock. Do you know what is the other lock (
|
@ppkarwasz unfortunately we didn't deep dive |
@ppkarwasz I have opened #3252 for the apparent deadlock - thanks! |
Description
Presumably due to a1dfa85 my application throws an error when loggers get changed from multiple threads.
This is likely because
InternalLoggerRegistry#getLoggers
does not return a thread-safe stream.Streams are by nature evaluated on the fly, thus still using the values of
loggerRefByNameByMessageFactory
afterreadLock
was unlocked.When multiple threads modify
loggerRefByNameByMessageFactory
, sometimes it errors with the attached error.This happens inconsistently because it's a race condition, but I've been able to get this error a few times.
Configuration
Version: 2.24.2
Operating system: Windows
JDK: openjdk version "21.0.4" 2024-07-16 LTS
Logs
This shows the stream being collected due to the forEach call in
LoggerContext#updateLoggers
, but there being no read lock, therefore causing this race condition.Reproduction
I unfortunately cannot provide an example because I do not have much experience with reproducing race conditions.
The text was updated successfully, but these errors were encountered: