perwendel / spark

A simple expressive web framework for java. Spark has a kotlin DSL https://github.com/perwendel/spark-kotlin
Apache License 2.0
9.63k stars 1.56k forks source link

java.util.ConcurrentModificationException from spark.route.Routes #1243

Open AndrewPerforce opened 3 years ago

AndrewPerforce commented 3 years ago

"private List routes" in spark.route.Routes should be synchronised.

java.util.ConcurrentModificationException: null at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1010) ~[?:?] at java.util.ArrayList$Itr.next(ArrayList.java:964) ~[?:?] at spark.route.Routes.findTargetsForRequestedRoute(Routes.java:215) ~[ha-core-fat.jar:PREP-TEST_ONLY] at spark.route.Routes.findMultiple(Routes.java:99) ~[ha-core-fat.jar:PREP-TEST_ONLY] at spark.http.matching.BeforeFilters.execute(BeforeFilters.java:35) ~[ha-core-fat.jar:PREP-TEST_ONLY] at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:133) ~[ha-core-fat.jar:PREP-TEST_ONLY] at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50) ~[ha-core-fat.jar:PREP-TEST_ONLY] at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1584) ~[ha-core-fat.jar:PREP-TEST_ONLY] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[ha-core-fat.jar:PREP-TEST_ONLY] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[ha-core-fat.jar:PREP-TEST_ONLY] at org.eclipse.jetty.server.Server.handle(Server.java:501) ~[ha-core-fat.jar:PREP-TEST_ONLY] at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383) ~[ha-core-fat.jar:PREP-TEST_ONLY] at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:556) ~[ha-core-fat.jar:PREP-TEST_ONLY] at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375) ~[ha-core-fat.jar:PREP-TEST_ONLY] at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273) ~[ha-core-fat.jar:PREP-TEST_ONLY] at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) ~[ha-core-fat.jar:PREP-TEST_ONLY] at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) ~[ha-core-fat.jar:PREP-TEST_ONLY] at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) ~[ha-core-fat.jar:PREP-TEST_ONLY] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) ~[ha-core-fat.jar:PREP-TEST_ONLY] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) ~[ha-core-fat.jar:PREP-TEST_ONLY] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) ~[ha-core-fat.jar:PREP-TEST_ONLY] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:135) ~[ha-core-fat.jar:PREP-TEST_ONLY] at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806) [ha-core-fat.jar:PREP-TEST_ONLY] at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938) [ha-core-fat.jar:PREP-TEST_ONLY] at java.lang.Thread.run(Thread.java:830) [?:?]

hoto commented 3 months ago

For people coming from the internet, to save you some time:

  1. It looks like official spark repo (this one) is dead
  2. There is an unofficial spark fork which has this bug fixed along some other ones, see https://github.com/Intellisrc/spark/pull/13
  3. If you don't want to use the unoficial repo then fork the oficial spark and copy over the fix from the unoficial fork then build and use it yourself