Skip to content
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

Fix ConcurrentModificationException in updateLoggers() #3235

Open
wants to merge 1 commit into
base: 2.24.x
Choose a base branch
from

Conversation

ppkarwasz
Copy link
Contributor

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

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
@garydgregory
Copy link
Member

Hi all,

Does this mean a 2.24.3 is around the corner?

@ppkarwasz
Copy link
Contributor Author

Does this mean a 2.24.3 is around the corner?

@garydgregory, I would wait a couple of weeks to see if other bugs are reported, but, yes, I think we should release a 2.24.3.

We can also release 2.25.0, but that will bring other problems and I have some long term plans for 2.24.x.

@@ -513,7 +512,7 @@ public Logger getLogger(final String name) {
* @return a collection of the current loggers.
*/
public Collection<Logger> getLoggers() {
return loggerRegistry.getLoggers().collect(Collectors.toList());
return loggerRegistry.getLoggers();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we rather keep the old defensive copy around to avoid similar problems from integrators?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collectors.toList() does make a copy, right?

I could add a test for that in case the implementation of InternalLoggerRegistry.getLoggers() changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants