You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
When executing a task (POST tasks/executions), if arguments has an extra space at the end, spring cloud dataflow may throw a StringIndexOutOfBoundsException. Server will respond with status code 500 and payload:
{"_embedded":{"errors":[{"message":"String index out of range: -1","logref":"StringIndexOutOfBoundsException","_links":{"self":{"href":"/"}}}]}}%
The stacktrace on spring cloud dataflow:
2021-07-09 14:46:43.043 ERROR 1 --- [nio-8080-exec-3] o.s.c.d.s.k.KubernetesTaskLauncher : String index out of range: -1
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1967)
at org.springframework.cloud.deployer.spi.kubernetes.DefaultContainerFactory.lambda$createCommandArgs$0(DefaultContainerFactory.java:277)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1384)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
at org.springframework.cloud.deployer.spi.kubernetes.DefaultContainerFactory.createCommandArgs(DefaultContainerFactory.java:278)
at org.springframework.cloud.deployer.spi.kubernetes.DefaultContainerFactory.create(DefaultContainerFactory.java:102)
at org.springframework.cloud.deployer.spi.kubernetes.AbstractKubernetesDeployer.createPodSpec(AbstractKubernetesDeployer.java:201)
at org.springframework.cloud.deployer.spi.kubernetes.KubernetesTaskLauncher.launch(KubernetesTaskLauncher.java:238)
at org.springframework.cloud.deployer.spi.kubernetes.KubernetesTaskLauncher.launch(KubernetesTaskLauncher.java:120)
Setup a task app & task definition in spring cloud dataflow on kubernetes platform
Execute a task by calling API with a malformed argument, like the one below. Note the extra %20 at the end of arguments query param.
curl -X POST 'http://localhost:9393/tasks/executions?name=test&arguments=--a=b%20--c=d%20' -H 'Content-Type: application/json'
Additional context:
It is caused when handling arguments in k8s deployer. It splits the arguments using space and then separate key/value using =. However the code doesn't handle the case when = is not present in each argument. Not too sure about the best approach to handle it, should we ignore such arguments, or return a validation error.
Though it's a caused by bad API integration, it would be great if a better message can be returned. It's not easy to figure out the cause without looking into stacktrace & source code.
Thanks for supporting it!
The text was updated successfully, but these errors were encountered:
Thanks for the thorough write-up, @guoyiang. If you've cycles, please feel free to submit a PR to gracefully handle this workflow. We can pair to get this handled and bring it to the desired state.
Description:
When executing a task (
POST tasks/executions
), ifarguments
has an extra space at the end, spring cloud dataflow may throw aStringIndexOutOfBoundsException
. Server will respond with status code 500 and payload:The stacktrace on spring cloud dataflow:
Release versions:
Steps to reproduce:
%20
at the end ofarguments
query param.Additional context:
It is caused when handling arguments in k8s deployer. It splits the arguments using space and then separate key/value using
=
. However the code doesn't handle the case when=
is not present in each argument. Not too sure about the best approach to handle it, should we ignore such arguments, or return a validation error.Though it's a caused by bad API integration, it would be great if a better message can be returned. It's not easy to figure out the cause without looking into stacktrace & source code.
Thanks for supporting it!
The text was updated successfully, but these errors were encountered: