apache / apache/bookkeeper

ConcurrentModificationException while logging a collection

Open
#2,243 0 comments 0 reactions 0 assignees View on GitHub
area/logging triage/week-4 type/bug
Dominant language
Java
Stars
2k
Forks
976
Avg merge
6d 15h
Merged PRs (30d)
7

Description

**BUG REPORT**

***Describe the bug***

I got this stackstrace while running BK

```
SLF4J: Failed toString() invocation on an object of type [java.util.HashSet]
Reported exception:
java.util.ConcurrentModificationException
at java.base/java.util.HashMap$HashIterator.nextNode(HashMap.java:1495)
at java.base/java.util.HashMap$KeyIterator.next(HashMap.java:1518)
at java.base/java.util.AbstractCollection.toString(AbstractCollection.java:456)
at org.slf4j.helpers.MessageFormatter.safeObjectAppend(MessageFormatter.java:299)
at org.slf4j.helpers.MessageFormatter.deeplyAppendParameter(MessageFormatter.java:271)
at org.slf4j.helpers.MessageFormatter.arrayFormat(MessageFormatter.java:233)
at org.slf4j.helpers.MessageFormatter.arrayFormat(MessageFormatter.java:173)
at org.slf4j.impl.xxxxxxxxxxxxx.error(xxxxxxxxxxxxx.java:236)
at org.apache.bookkeeper.client.PendingReadOp.submitCallback(PendingReadOp.java:631)
at org.apache.bookkeeper.client.PendingReadOp$LedgerEntryRequest.fail(PendingReadOp.java:170)
at org.apache.bookkeeper.client.PendingReadOp$SequenceReadRequest.sendNextRead(PendingReadOp.java:392)
at org.apache.bookkeeper.client.PendingReadOp$SequenceReadRequest.logErrorAndReattemptRead(PendingReadOp.java:435)
at org.apache.bookkeeper.client.PendingReadOp.readEntryComplete(PendingReadOp.java:581)
at org.apache.bookkeeper.proto.BookieClientImpl$2.safeRun(BookieClientImpl.java:369)
at org.apache.bookkeeper.common.util.SafeRunnable.run(SafeRunnable.java:36)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:830)
```
The failing log line is
```
LOG.error("Read of ledger entry failed: L{} E{}-E{}, Sent to {}, "
+ "Heard from {} : bitset = {}, Error = '{}'. First unread entry is ({}, rc = {})",
lh.getId(), startEntryId, endEntryId, sentToHosts, heardFromHosts, heardFromHostsBitSet,
BKException.getMessage(code), firstUnread, firstRc);
```

At this time I don't known which collection has been modified while logged (sentToHosts? heardFromHosts?) and I known that the concurrent is generated in slf4j but I think that the problem is in BK: a not concurrent collection has been modified by another thread (perhaps is just wrong the collection logging...).

***To Reproduce***

I'm sorry I don't have any mean to reproduce it

***Expected behavior***

Do not fail on a simple log line

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.