question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ConcurrentModificationException in getLogs()

See original GitHub issue

We tried LogCaptor in some integration-style tests, where logging actually happens in background thread. Occasionally getLogs() throws ConcurrentModificationException - quick look into code shows that ListAppender.list is not thread-safe, so it’s almost certainly a race between test and application threads. I think it’s not a problem for actual logging since AppenderBase::doAppend is synchronized, but it is a problem when scanning the list. One possible fix would be to wrap all access to list into synchronized(listAppender). Or, maybe even better, swap it for CopyOnWrite / Collections::synchronizedList. Any views on that? Happy to submit PR as well.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
AndreyNudkocommented, Nov 17, 2021

@Hakky54 Awesome, thanks for the quick turnaround!

1reaction
Hakky54commented, Nov 17, 2021

@AndreyNudko The latest changes are now available within version 2.7.2

Read more comments on GitHub >

github_iconTop Results From Across the Web

ConcurrentModificationException caught · Issue #363 - GitHub
RemoteReporter-QueueProcessor" java.util.ConcurrentModificationException at java.util. ... getLogs() returns an unmodifiable collection.
Read more >
Resolve java.util.ConcurrentModificationException
Below the code that goes into error: Map<String, List<Note>> noteByCod = notes.stream().collect(Collectors.groupingBy(Note::getCod)); noteByCod.
Read more >
78741: ConcurrentModificationException exception cause ...
Description: Application crashes when trying to add slaves at startup. Same thread is iterating and modifying the map, synchronization does ...
Read more >
[#AXIS-2800] Axis locators not thread safe (java.util ...
ConcurrentModificationException : concurrent access to HashMap attempted by Thread). Status: Assignee: Priority: ... getParameterTypes()[0] == URL.class)).
Read more >
How to Avoid the Concurrent Modification Exception in Java
The ConcurrentModificationException in Java occurs when an object is attempted to be modified concurrently without permission.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found