Abacn opened a new issue, #36053:
URL: https://github.com/apache/beam/issues/36053
### What happened?
User reported ConcurrentModificationException happens during Mqtt checkpoint
finalization:
```
java.util.ConcurrentModificationException
at
java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1013)
at java.base/java.util.ArrayList$Itr.next(ArrayList.java:967)
at
org.apache.beam.sdk.io.mqtt.MqttIO$MqttCheckpointMark.finalizeCheckpoint(MqttIO.java:444)
at
org.apache.beam.runners.dataflow.worker.StreamingModeExecutionContext.lambda$flushState$1(StreamingModeExecutionContext.java:446)
at
org.apache.beam.runners.dataflow.worker.windmill.work.processing.StreamingCommitFinalizer.lambda$finalizeCommits$0(StreamingCommitFinalizer.java:76)
at
org.apache.beam.runners.dataflow.worker.util.BoundedQueueExecutor.lambda$executeMonitorHeld$0(BoundedQueueExecutor.java:233)
at
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
```
The cause is that `reader.getCheckpointMark()` returns same checkpoint mark
every time:
https://github.com/apache/beam/blob/c367bd3347e41473c15ef8968ca43283221cb2e7/sdks/java/io/mqtt/src/main/java/org/apache/beam/sdk/io/mqtt/MqttIO.java#L616
and after that the checkpointmark still get modified on every advance.
When another thread try to finalize checkpoint by iterating over messages,
the underlying arraylist hold by checkpointmark gets modified, causing
ConcurrentModificationException
We should return a new, immutable, checkpointmark on
https://github.com/apache/beam/blob/c367bd3347e41473c15ef8968ca43283221cb2e7/sdks/java/io/mqtt/src/main/java/org/apache/beam/sdk/io/mqtt/MqttIO.java#L615
### Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
### Issue Components
- [ ] Component: Python SDK
- [ ] Component: Java SDK
- [ ] Component: Go SDK
- [ ] Component: Typescript SDK
- [ ] Component: IO connector
- [ ] Component: Beam YAML
- [ ] Component: Beam examples
- [ ] Component: Beam playground
- [ ] Component: Beam katas
- [ ] Component: Website
- [ ] Component: Infrastructure
- [ ] Component: Spark Runner
- [ ] Component: Flink Runner
- [ ] Component: Samza Runner
- [ ] Component: Twister2 Runner
- [ ] Component: Hazelcast Jet Runner
- [ ] Component: Google Cloud Dataflow Runner
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]