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

ConcurrentModificationException accessing map in KubernetesCrudDispatcher #5281

Closed
MikeEdgar opened this issue Jun 23, 2023 · 0 comments · Fixed by #5280
Closed

ConcurrentModificationException accessing map in KubernetesCrudDispatcher #5281

MikeEdgar opened this issue Jun 23, 2023 · 0 comments · Fixed by #5280
Assignees
Labels
Milestone

Comments

@MikeEdgar
Copy link
Contributor

Describe the bug

The MockWebServer occasionally crashes due to a ConcurrentModificationException caused from KubernetesCrudDispatcher. Here, this occurs from handleWatch, but appears to be possible elsewhere.

2023-06-23 13:54:00  okhttp3.mockwebserver.MockWebServer  SEVERE  MockWebServer[54552] connection from /127.0.0.1 crashed 
java.util.ConcurrentModificationException
	at java.base/java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:756)
	at java.base/java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:788)
	at java.base/java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:786)
	at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at io.fabric8.kubernetes.client.server.mock.KubernetesCrudDispatcher.lambda$handleWatch$6(KubernetesCrudDispatcher.java:298)
	at io.fabric8.kubernetes.client.server.mock.WatchEventsListener.onOpen(WatchEventsListener.java:63)

Fabric8 Kubernetes Client version

6.7.2

Steps to reproduce

Reproducible by running this test [1] in the Strimzi cluster operator test suite.

[1] https://github.com/strimzi/strimzi-kafka-operator/blob/016c98afdd0e173d3f07f523c73f9b9fdb418020/cluster-operator/src/test/java/io/strimzi/operator/cluster/operator/assembly/KafkaAssemblyOperatorWithPoolsMockTest.java#L621

Expected behavior

No ConcurrentModificationException :-)

Runtime

other (please specify in additional context)

Kubernetes API Server version

other (please specify in additional context)

Environment

Linux

Fabric8 Kubernetes Client Logs

No response

Additional context

N/A for runtime/server version. This occurs in unit tests with the mock web server.

@manusa manusa added the bug label Jul 4, 2023
@manusa manusa added this to the 6.8.0 milestone Jul 4, 2023
dongjoon-hyun pushed a commit to apache/spark that referenced this issue Jul 26, 2023
### What changes were proposed in this pull request?
The pr aims to upgrade kubernetes-client from 6.7.2 to 6.8.0.

### Why are the changes needed?
- The newest version brings some bug fixed & improvment, eg:
Fix fabric8io/kubernetes-client#5221: Empty kube config file causes NPE
Fix fabric8io/kubernetes-client#5281: Ensure the KubernetesCrudDispatcher's backing map is accessed w/lock
Fix fabric8io/kubernetes-client#5298: Prevent requests needing authentication from causing a 403 response
Fix fabric8io/kubernetes-client#5233: Generalized SchemaSwap to allow for cycle expansion
Fix fabric8io/kubernetes-client#5262: all built-in collections will omit empty in their serialized form.

- The full release notes:
https://github.com/fabric8io/kubernetes-client/releases/

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Pass GA.

Closes #42142 from panbingkun/SPARK-44537.

Authored-by: panbingkun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
ragnarok56 pushed a commit to ragnarok56/spark that referenced this issue Mar 2, 2024
### What changes were proposed in this pull request?
The pr aims to upgrade kubernetes-client from 6.7.2 to 6.8.0.

### Why are the changes needed?
- The newest version brings some bug fixed & improvment, eg:
Fix fabric8io/kubernetes-client#5221: Empty kube config file causes NPE
Fix fabric8io/kubernetes-client#5281: Ensure the KubernetesCrudDispatcher's backing map is accessed w/lock
Fix fabric8io/kubernetes-client#5298: Prevent requests needing authentication from causing a 403 response
Fix fabric8io/kubernetes-client#5233: Generalized SchemaSwap to allow for cycle expansion
Fix fabric8io/kubernetes-client#5262: all built-in collections will omit empty in their serialized form.

- The full release notes:
https://github.com/fabric8io/kubernetes-client/releases/

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Pass GA.

Closes apache#42142 from panbingkun/SPARK-44537.

Authored-by: panbingkun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment