在使用spring-cloud-gateway和nacos中遇到的ConcurrentModification异常分析

在使用spring-cloud-gateway和nacos中遇到的ConcurrentModification异常分析

reactor.core.Exceptions$ErrorCallbackNotImplemented: java.util.ConcurrentModificationException
Caused by: java.util.ConcurrentModificationException: null
        at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909)
        at java.util.ArrayList$Itr.next(ArrayList.java:859)
        at reactor.core.publisher.FluxIterable$IterableSubscription.poll(FluxIterable.java:389)
        at reactor.core.publisher.FluxFlatMap$FlatMapMain.drainLoop(FluxFlatMap.java:634)
        at reactor.core.publisher.FluxFlatMap$FlatMapMain.drain(FluxFlatMap.java:540)
        at reactor.core.publisher.FluxFlatMap$FlatMapInner.onSubscribe(FluxFlatMap.java:924)
        at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:139)
        at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:63)
        at reactor.core.publisher.Flux.subscribe(Flux.java:7777)
        at reactor.core.publisher.FluxFlatMap$FlatMapMain.onNext(FluxFlatMap.java:389)
        at reactor.core.publisher.FluxIterable$IterableSubscription.slowPath(FluxIterable.java:243)
        at reactor.core.publisher.FluxIterable$IterableSubscription.request(FluxIterable.java:201)
        at reactor.core.publisher.FluxFlatMap$FlatMapMain.onSubscribe(FluxFlatMap.java:335)
        at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:139)
        at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:63)
        at reactor.core.publisher.FluxFlatMap.subscribe(FluxFlatMap.java:97)
        at reactor.core.publisher.FluxMap.subscribe(FluxMap.java:62)
        at reactor.core.publisher.FluxMap.subscribe(FluxMap.java:62)
        at reactor.core.publisher.Flux.subscribe(Flux.java:7777)
        at reactor.core.publisher.FluxFlatMap$FlatMapMain.onNext(FluxFlatMap.java:389)
        at reactor.core.publisher.FluxIterable$IterableSubscription.slowPath(FluxIterable.java:243)
        at reactor.core.publisher.FluxIterable$IterableSubscription.request(FluxIterable.java:201)
        at reactor.core.publisher.FluxFlatMap$FlatMapMain.onSubscribe(FluxFlatMap.java:335)
        at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:139)
        at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:63)
        at reactor.core.publisher.FluxFlatMap.subscribe(FluxFlatMap.java:97)
        at reactor.core.publisher.MonoCollectList.subscribe(MonoCollectList.java:59)
        at reactor.core.publisher.MonoMapFuseable.subscribe(MonoMapFuseable.java:59)
        at reactor.core.publisher.MonoFlattenIterable.subscribe(MonoFlattenIterable.java:101)
        at reactor.core.publisher.FluxMaterialize.subscribe(FluxMaterialize.java:40)
        at reactor.core.publisher.MonoCollectList.subscribe(MonoCollectList.java:59)
        at reactor.core.publisher.MonoPeekFuseable.subscribe(MonoPeekFuseable.java:74)
        at reactor.core.publisher.MonoFlattenIterable.subscribe(MonoFlattenIterable.java:101)
        at reactor.core.publisher.FluxDematerialize.subscribe(FluxDematerialize.java:39)
        at reactor.core.publisher.FluxDefer.subscribe(FluxDefer.java:54)
        at reactor.core.publisher.Flux.subscribe(Flux.java:7777)
        at reactor.core.publisher.Flux.subscribeWith(Flux.java:7941)
        at reactor.core.publisher.Flux.subscribe(Flux.java:7770)
        at reactor.core.publisher.Flux.subscribe(Flux.java:7734)
        at reactor.core.publisher.Flux.subscribe(Flux.java:7652)
        at org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter.lambda$onApplicationEvent$0(WeightCalculatorWebFilter.java:133)
        at org.springframework.beans.factory.ObjectProvider.ifAvailable(ObjectProvider.java:93)
        at org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter.onApplicationEvent(WeightCalculatorWebFilter.java:133)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:402)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:359)
        at org.springframework.cloud.gateway.route.RouteRefreshListener.reset(RouteRefreshListener.java:68)
        at org.springframework.cloud.gateway.route.RouteRefreshListener.resetIfNeeded(RouteRefreshListener.java:63)
        at org.springframework.cloud.gateway.route.RouteRefreshListener.onApplicationEvent(RouteRefreshListener.java:57)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:402)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:359)
        at org.springframework.cloud.alibaba.nacos.discovery.NacosWatch.lambda$nacosServicesWatch$0(NacosWatch.java:156)
        at com.alibaba.nacos.client.naming.core.EventDispatcher$Notifier.run(EventDispatcher.java:128)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

找了半天这个问题的所在,最后在一个大佬的文章中找到了答案:
解决问题文章

你可能感兴趣的:(Java,java,spring)