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

Core: Infinite loop in Java SDK's RoundRobinSwitch and UniformRandomSwitch with gatling 3.10 #4494

Closed
nvervelle opened this issue Dec 19, 2023 · 7 comments
Assignees
Milestone

Comments

@nvervelle
Copy link

Hello,

I just tried to upgrade to gatling 3.10.0 from gatling 3.9.5.6, and I get StackOverflowError when running gatling (it seems to fail when building the simulation). I just have this log, I can try to make a reproducible example but not sure I will success.

07:44:34.854 [ERROR] i.g.a.Gatling$ - Run crashed
java.lang.StackOverflowError: null
        at java.base/java.util.Spliterator.getExactSizeIfKnown(Spliterator.java:414)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:508)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
        at io.gatling.javaapi.core.internal.Executables.toChainBuilders(Executables.java:31)
        at io.gatling.javaapi.core.internal.Executables.toChainBuilder(Executables.java:42)
        at io.gatling.javaapi.core.condition.RoundRobinSwitch$On.on(RoundRobinSwitch.java:74)
        at io.gatling.javaapi.core.condition.RoundRobinSwitch$On.on(RoundRobinSwitch.java:74)
        at io.gatling.javaapi.core.condition.RoundRobinSwitch$On.on(RoundRobinSwitch.java:74)
        ...
        at io.gatling.javaapi.core.condition.RoundRobinSwitch$On.on(RoundRobinSwitch.java:74)
        at io.gatling.javaapi.core.condition.RoundRobinSwitch$On.on(RoundRobinSwitch.java:74)
        at io.gatling.javaapi.core.condition.RoundRobinSwitch$On.on(RoundRobinSwitch.java:74)
Wrapped by: java.lang.reflect.InvocationTargetException: null
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:79)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:484)
        at io.gatling.app.SimulationClass$Java.params(SimulationClass.scala:35)
        at io.gatling.app.Runner.load(Runner.scala:72)
        at io.gatling.app.Runner.run(Runner.scala:57)
        at io.gatling.app.Gatling$.start(Gatling.scala:92)
        at io.gatling.app.Gatling$.fromArgs(Gatling.scala:54)
        at io.gatling.app.Gatling$.main(Gatling.scala:42)
        at io.gatling.app.Gatling.main(Gatling.scala)
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:79)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:484)
        at io.gatling.app.SimulationClass$Java.params(SimulationClass.scala:35)
        at io.gatling.app.Runner.load(Runner.scala:72)
        at io.gatling.app.Runner.run(Runner.scala:57)
        at io.gatling.app.Gatling$.start(Gatling.scala:92)
        at io.gatling.app.Gatling$.fromArgs(Gatling.scala:54)
        at io.gatling.app.Gatling$.main(Gatling.scala:42)
        at io.gatling.app.Gatling.main(Gatling.scala)
Caused by: java.lang.StackOverflowError
        at java.base/java.util.Spliterator.getExactSizeIfKnown(Spliterator.java:414)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:508)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
        at io.gatling.javaapi.core.internal.Executables.toChainBuilders(Executables.java:31)
        at io.gatling.javaapi.core.internal.Executables.toChainBuilder(Executables.java:42)
        at io.gatling.javaapi.core.condition.RoundRobinSwitch$On.on(RoundRobinSwitch.java:74)
        at io.gatling.javaapi.core.condition.RoundRobinSwitch$On.on(RoundRobinSwitch.java:74)
        at io.gatling.javaapi.core.condition.RoundRobinSwitch$On.on(RoundRobinSwitch.java:74)
        ...
        at io.gatling.javaapi.core.condition.RoundRobinSwitch$On.on(RoundRobinSwitch.java:74)
        at io.gatling.javaapi.core.condition.RoundRobinSwitch$On.on(RoundRobinSwitch.java:74)
        at io.gatling.javaapi.core.condition.RoundRobinSwitch$On.on(RoundRobinSwitch.java:74)

@nvervelle
Copy link
Author

nvervelle commented Dec 19, 2023

In fact, I checked the code, and I think I found the problem :

  • in RoundRobinSwitch, method on() calls Executables.toChainBuilder() (without s)
  • this method returns a ChainBuilder (which is an Executable) and not a List<ChainBuilder>
  • instead of calling on(@NonNull List<ChainBuilder> choices), it calls itself on(@NonNull Executable executable, @NonNull Executable... executables) resulting in a infinite loop and StackOverflowError

@nvervelle
Copy link
Author

The problem seems to come from this commit by @slandelle . I think the problem is present on other classes (at least on UniformRandomSwitch)

@slandelle slandelle changed the title StackOverflowError with gatling 3.10 on RoundRobinSwitch Core: Infinite loop causing StackOverflowError on RoundRobinSwitch and UniformRandomSwitch with gatling 3.10 Dec 19, 2023
@slandelle slandelle self-assigned this Dec 19, 2023
@slandelle slandelle added this to the 3.10.1 milestone Dec 19, 2023
@slandelle
Copy link
Member

Thanks for reporting.

The same issue happens with UniformRandomSwitch.

@slandelle slandelle changed the title Core: Infinite loop causing StackOverflowError on RoundRobinSwitch and UniformRandomSwitch with gatling 3.10 Core: Infinite loop in Java SDK's RoundRobinSwitch and UniformRandomSwitch with gatling 3.10 Dec 19, 2023
@slandelle
Copy link
Member

Gatling 3.10.1 is up.

@nvervelle
Copy link
Author

Thanks @slandelle

I can now start the simulation with gatling 3.10.1.
It seems I have another problem though : I replaced calls CoreDsl.exitBlockOnFail(...) by CoreDsl.exitBlockOnFail().on(...) to take into account the breaking change in gatling DSL, but now errors fail to exit the simulation, the simulation seems to be stucked instead of finishing

I see logs stating that a request has failed, but nothing more happens to the simulation :
11:37:09.847 [DEBUG] i.g.h.e.r.DefaultStatsProcessor - Request 'applicant-submit-challenge' failed for user 2: status.find.is(200), but actually found 415

Any idea what can be causing such problem ?

@slandelle
Copy link
Member

@nvervelle Could you please open a distinct ticket?

@nvervelle
Copy link
Author

#4495 opened

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants