Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
4.8.0
-
None
-
Unknown
Description
The actual implementation of camel-platform-http-starter is not working as expected, in particular, when using undertow for example, after a couple of request the following exception is thrown:
2024-10-03T15:13:32.116+02:00 WARN 981444 --- [onPool-worker-1] c.c.p.h.s.SpringBootPlatformHttpConsumer : Error handling request due to: Invalid parameter, expected to be a pair but was hello java.lang.IllegalArgumentException: Invalid parameter, expected to be a pair but was hello at org.apache.camel.http.common.DefaultHttpBinding.readFormUrlEncodedBody(DefaultHttpBinding.java:294) ~[camel-http-common-4.8.0.redhat-00004.jar!/:4.8.0.redhat-00004] at org.apache.camel.http.common.DefaultHttpBinding.readRequest(DefaultHttpBinding.java:129) ~[camel-http-common-4.8.0.redhat-00004.jar!/:4.8.0.redhat-00004] at org.apache.camel.component.platform.http.springboot.PlatformHttpMessage.init(PlatformHttpMessage.java:64) ~[camel-platform-http-starter-4.8.0.redhat-00010.jar!/:4.8.0.redhat-00010] at org.apache.camel.component.platform.http.springboot.PlatformHttpMessage.<init>(PlatformHttpMessage.java:39) ~[camel-platform-http-starter-4.8.0.redhat-00010.jar!/:4.8.0.redhat-00010] at org.apache.camel.component.platform.http.springboot.SpringBootPlatformHttpConsumer.handleService(SpringBootPlatformHttpConsumer.java:91) ~[camel-platform-http-starter-4.8.0.redhat-00010.jar!/:4.8.0.redhat-00010] at org.apache.camel.component.platform.http.springboot.SpringBootPlatformHttpConsumer.lambda$service$0(SpringBootPlatformHttpConsumer.java:66) ~[camel-platform-http-starter-4.8.0.redhat-00010.jar!/:4.8.0.redhat-00010] at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[na:na] at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) ~[na:na] at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[na:na] at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[na:na] at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[na:na] at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[na:na] at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[na:na]
The route to reproduce this issue is the following, a really trivial one:
rest().post("/message").consumes("text/plain").to("direct:route"); from("direct:route").log("${body}");
Analyzing the stacktrace you can notice that we are mixing Async execution via CompletableFuture and non-Async Spring Boot code, therefore a single request is executed on multiple threads not handled by the underlying server or spring boot, that causes the concurrent modification exception.
Attachments
Issue Links
- links to